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>
This commit is contained in:
Rusty Russell 2019-06-14 10:05:12 +09:30
parent eb5cc47bdd
commit 24cc371cdf

View File

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