Browse Source

gossipd: gossip_store errors after rewrite are fatal.

We can't continue, since we've moved the indexes.  We'll just crash
anyway, as seen from bugs #2742 and #2743.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
pull/2938/head
Rusty Russell 6 years ago
parent
commit
24cc371cdf
  1. 25
      gossipd/gossip_store.c

25
gossipd/gossip_store.c

@ -311,24 +311,23 @@ bool gossip_store_compact(struct gossip_store *gs)
"gossip_store: Entry at %zu->%zu not updated?", "gossip_store: Entry at %zu->%zu not updated?",
omap->from, omap->to); omap->from, omap->to);
if (count != gs->count - gs->deleted) { if (count != gs->count - gs->deleted)
status_broken("Expected %zu msgs in new gossip store, got %zu", status_failed(STATUS_FAIL_INTERNAL_ERROR,
"gossip_store: Expected %zu msgs in new"
" gossip store, got %zu",
gs->count - gs->deleted, count); gs->count - gs->deleted, count);
goto unlink_disable;
}
if (deleted != gs->deleted) { if (deleted != gs->deleted)
status_broken("Expected %zu deleted msgs in old gossip store, got %zu", status_failed(STATUS_FAIL_INTERNAL_ERROR,
"gossip_store: Expected %zu deleted msgs in old"
" gossip store, got %zu",
gs->deleted, deleted); gs->deleted, deleted);
goto unlink_disable;
}
if (rename(GOSSIP_STORE_TEMP_FILENAME, GOSSIP_STORE_FILENAME) == -1) { if (rename(GOSSIP_STORE_TEMP_FILENAME, GOSSIP_STORE_FILENAME) == -1)
status_broken( status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Error swapping compacted gossip_store into place: %s", "Error swapping compacted gossip_store into place:"
" %s",
strerror(errno)); strerror(errno));
goto unlink_disable;
}
status_trace( status_trace(
"Compaction completed: dropped %zu messages, new count %zu, len %"PRIu64, "Compaction completed: dropped %zu messages, new count %zu, len %"PRIu64,

Loading…
Cancel
Save