Remove orphan file rows if we notice the payload is missing

This commit is contained in:
Jeremy Lakeman 2014-03-01 05:45:32 +10:30
parent 880117f6db
commit 974c87adf2
2 changed files with 3 additions and 1 deletions

View File

@ -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));

View File

@ -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