Add new chunk hashes to the cs_add_list when creating or updating them in the chunk server

This commit is contained in:
2025-11-15 10:55:11 +01:00
parent a366b46398
commit 11054cae86
3 changed files with 10 additions and 2 deletions
+1
View File
@@ -1,2 +1,3 @@
Notes on simulation testing:
- Make sure your program works without fault injections
- Trace the branch coverage of the test and find why some branches are never reached
+9
View File
@@ -553,6 +553,7 @@ process_metadata_server_auth_response(ChunkServer *state, int conn_idx, ByteView
}
directory_scanner_free(&scanner);
return 0;
}
static int
@@ -686,6 +687,10 @@ process_client_create_chunk(ChunkServer *state, int conn_idx, ByteView msg)
sys_free(mem);
if (hash_set_insert(&state->cs_add_list, new_hash) < 0) {
assert(0); // TODO
}
if (ret < 0)
return send_error(&state->tcp, conn_idx, false, MESSAGE_TYPE_CREATE_CHUNK_ERROR, S("I/O error"));
@@ -737,6 +742,10 @@ process_client_upload_chunk(ChunkServer *state, int conn_idx, ByteView msg)
if (ret < 0)
return send_error(&state->tcp, conn_idx, false, MESSAGE_TYPE_UPLOAD_CHUNK_ERROR, S("I/O error"));
if (hash_set_insert(&state->cs_add_list, new_hash) < 0) {
assert(0); // TODO
}
MessageWriter writer;
ByteQueue *output = tcp_output_buffer(&state->tcp, conn_idx);
-2
View File
@@ -798,8 +798,6 @@ static int process_chunk_server_sync(MetadataServer *state,
if (!file_tree_uses_hash(&state->file_tree, hash))
continue;
// TODO: execution never reaches this point for some reason
// If the chunk is properly replicated or under-replicated,
// add it to the ms_add_list.