From 974c87adf27209018c8636c6340aeca9ab91bda3 Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Sat, 1 Mar 2014 05:45:32 +1030 Subject: [PATCH] Remove orphan file rows if we notice the payload is missing --- rhizome_store.c | 2 ++ tests/rhizomeprotocol | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rhizome_store.c b/rhizome_store.c index 30275521..14146797 100644 --- a/rhizome_store.c +++ b/rhizome_store.c @@ -792,6 +792,8 @@ enum rhizome_payload_status rhizome_open_read(struct rhizome_read *read, const r if (errno == ENOENT) { if (config.debug.externalblobs) DEBUGF("Stored file does not exist: %s", blob_path); + // make sure we remove an orphan file row + rhizome_delete_file(&read->id); return RHIZOME_PAYLOAD_STATUS_NEW; } WHYF_perror("open(%s)", alloca_str_toprint(blob_path)); diff --git a/tests/rhizomeprotocol b/tests/rhizomeprotocol index bbfec5f9..76ebb14a 100755 --- a/tests/rhizomeprotocol +++ b/tests/rhizomeprotocol @@ -478,7 +478,7 @@ setup_MissingPayload() { test_MissingPayload() { set_instance +A rm $SERVALINSTANCE_PATH/$FILEHASH - execute --exit-status=255 $servald rhizome extract file $BID file1a + execute --exit-status=1 $servald rhizome extract file $BID file1a stop_servald_server start_servald_server wait_until grep -i "Stored file $FILEHASH" $LOGA