Bug fixes

This commit is contained in:
2025-11-15 10:38:45 +01:00
parent a11740ab41
commit a366b46398
4 changed files with 9 additions and 7 deletions
+2
View File
@@ -0,0 +1,2 @@
Notes on simulation testing:
- Trace the branch coverage of the test and find why some branches are never reached
+1 -1
View File
@@ -146,7 +146,7 @@ static int store_chunk(ChunkStore *store, string data, SHA256 *hash)
// This is okay as long as we check that the hash // This is okay as long as we check that the hash
// is correct while reading back the data. // is correct while reading back the data.
Handle fd; Handle fd;
if (file_open(path, &fd) < 0) if (file_open(path, &fd) < 0) // TODO: open in overwrite mode
return -1; return -1;
int copied = 0; int copied = 0;
while (copied < data.len) { while (copied < data.len) {
+4 -6
View File
@@ -292,12 +292,8 @@ static int get_chunk_server(MouseFS *mfs, Address *addrs, int num_addrs, ByteQue
if (!have_insertection(addrs, num_addrs, mfs->chunk_servers[i].addrs, mfs->chunk_servers[i].num_addrs)) if (!have_insertection(addrs, num_addrs, mfs->chunk_servers[i].addrs, mfs->chunk_servers[i].num_addrs))
continue; continue;
// It's possible that this chunk server's connection int conn_idx = tcp_index_from_tag(&mfs->tcp, i);
// was dropped but we still didn't process the DISCONNECT assert(conn_idx > -1);
// event.
int conn_idx = tcp_index_from_tag(&mfs->tcp, found);
if (conn_idx < 0)
continue;
if (output) if (output)
*output = tcp_output_buffer(&mfs->tcp, conn_idx); *output = tcp_output_buffer(&mfs->tcp, conn_idx);
@@ -1252,6 +1248,8 @@ static void process_event_for_write(MouseFS *mfs,
return; return;
} }
mfs->operations[opidx].hashes[i] = hash;
uint32_t num_holders; uint32_t num_holders;
if (!binary_read(&reader, &num_holders, sizeof(num_holders))) { if (!binary_read(&reader, &num_holders, sizeof(num_holders))) {
mfs->operations[opidx].result = (MouseFS_Result) { .type=MOUSEFS_RESULT_WRITE_ERROR }; mfs->operations[opidx].result = (MouseFS_Result) { .type=MOUSEFS_RESULT_WRITE_ERROR };
+2
View File
@@ -798,6 +798,8 @@ static int process_chunk_server_sync(MetadataServer *state,
if (!file_tree_uses_hash(&state->file_tree, hash)) if (!file_tree_uses_hash(&state->file_tree, hash))
continue; continue;
// TODO: execution never reaches this point for some reason
// If the chunk is properly replicated or under-replicated, // If the chunk is properly replicated or under-replicated,
// add it to the ms_add_list. // add it to the ms_add_list.