Fix two bugs in read operation that caused test failure
1. Fix client not reading all server addresses in READ response The metadata server sends address info for ALL chunk servers holding a chunk, but the client only read info for ONE server. This caused message parsing to become misaligned for subsequent chunks. Added a loop to iterate through all num_servers and read each server's address list (using the first one, skipping the rest). 2. Fix tag value conflict between metadata and chunk server responses TAG_RETRIEVE_METADATA_FOR_READ was 1, which conflicted with chunk download range indices (0, 1, 2, 3...). When the second chunk download response came with range_idx=1, it was incorrectly treated as a metadata response. Changed TAG values from positive to negative integers since range indices are always non-negative. Also updated the test to properly exit on success instead of assert(0). https://claude.ai/code/session_01QYDQCNiUj1cjrsS6qRgkvd
This commit is contained in:
+2
-2
@@ -166,8 +166,8 @@ int test_client_tick(void *state_, void **ctxs,
|
||||
if (memcmp(client->buf, msg, sizeof(msg)-1)) {
|
||||
assert(0); // TODO
|
||||
}
|
||||
assert(0); // TODO
|
||||
break;
|
||||
printf("Test PASSED: Read data matches written data\n");
|
||||
exit(0); // Test completed successfully
|
||||
}
|
||||
|
||||
*timeout = -1;
|
||||
|
||||
Reference in New Issue
Block a user