diff --git a/SIMTEST.txt b/SIMTEST.txt new file mode 100644 index 0000000..fecb209 --- /dev/null +++ b/SIMTEST.txt @@ -0,0 +1,2 @@ +Notes on simulation testing: + - Trace the branch coverage of the test and find why some branches are never reached diff --git a/src/chunk_server.c b/src/chunk_server.c index eb7b300..6eee73a 100644 --- a/src/chunk_server.c +++ b/src/chunk_server.c @@ -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 // is correct while reading back the data. Handle fd; - if (file_open(path, &fd) < 0) + if (file_open(path, &fd) < 0) // TODO: open in overwrite mode return -1; int copied = 0; while (copied < data.len) { diff --git a/src/client.c b/src/client.c index 6f662c0..048a00e 100644 --- a/src/client.c +++ b/src/client.c @@ -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)) continue; - // It's possible that this chunk server's connection - // was dropped but we still didn't process the DISCONNECT - // event. - int conn_idx = tcp_index_from_tag(&mfs->tcp, found); - if (conn_idx < 0) - continue; + int conn_idx = tcp_index_from_tag(&mfs->tcp, i); + assert(conn_idx > -1); if (output) *output = tcp_output_buffer(&mfs->tcp, conn_idx); @@ -1252,6 +1248,8 @@ static void process_event_for_write(MouseFS *mfs, return; } + mfs->operations[opidx].hashes[i] = hash; + uint32_t num_holders; if (!binary_read(&reader, &num_holders, sizeof(num_holders))) { mfs->operations[opidx].result = (MouseFS_Result) { .type=MOUSEFS_RESULT_WRITE_ERROR }; diff --git a/src/metadata_server.c b/src/metadata_server.c index ce63de0..b2f5324 100644 --- a/src/metadata_server.c +++ b/src/metadata_server.c @@ -798,6 +798,8 @@ 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.