zllovesuki / specter

like ngrok, but more ambitious with DHT for flavor
MIT License
26 stars 1 forks source link

chord: FindSuccessor returned the wrong node #24

Closed zllovesuki closed 1 year ago

zllovesuki commented 1 year ago

Insert went to correct the nodes. At this point, no joins are happening:

        local_kv_test.go:390: message 289 inserted
        logger.go:130: 2023-01-26T09:40:09.987Z DEBUG   chord/local_kv.go:62    KV Put  {"node": 1159167524425, "target": "Remote", "key": "key 290: ...", "id": 2690397138713}
        logger.go:130: 2023-01-26T09:40:09.987Z DEBUG   chord/local_kv.go:62    KV Put  {"node": 2817335783655, "target": "Local", "key": "key 290: ...", "id": 2690397138713}
        local_kv_test.go:390: message 290 inserted
[...]
        logger.go:130: 2023-01-26T09:40:09.990Z DEBUG   chord/local_kv.go:62    KV Put  {"node": 1159167524425, "target": "Remote", "key": "key 300: ...", "id": 2705985598441}
        logger.go:130: 2023-01-26T09:40:09.991Z DEBUG   chord/local_kv.go:62    KV Put  {"node": 2817335783655, "target": "Local", "key": "key 300: ...", "id": 2705985598441}
        local_kv_test.go:390: message 300 inserted

However during validation, it went to the wrong node:

        logger.go:130: 2023-01-26T09:40:10.532Z DEBUG   chord/local_kv.go:71    KV Get  {"node": 1159167524425, "target": "Remote", "key": "key 290: ...", "id": 2690397138713}
        logger.go:130: 2023-01-26T09:40:10.533Z DEBUG   chord/local_kv.go:71    KV Get  {"node": 2714747531593, "target": "Local", "key": "key 290: ...", "id": 2690397138713}
[...]
        logger.go:130: 2023-01-26T09:40:10.536Z DEBUG   chord/local_kv.go:71    KV Get  {"node": 1159167524425, "target": "Remote", "key": "key 300: ...", "id": 2705985598441}
        logger.go:130: 2023-01-26T09:40:10.536Z DEBUG   chord/local_kv.go:71    KV Get  {"node": 2714747531593, "target": "Local", "key": "key 300: ...", "id": 2705985598441}
        local_kv_test.go:430: stale ownership counts: 15
        local_kv_test.go:431: missing indicies: [290 300]
        local_kv_test.go:432: mismatched indicies: []
        local_kv_test.go:443: missing key index 290 routed to node 2714747531593 but found in node 2817335783655
        local_kv_test.go:443: missing key index 300 routed to node 2714747531593 but found in node 2817335783655
        local_kv_test.go:449: 
                Error Trace:    /home/jenkins/agent/workspace/specter/chord/local_kv_test.go:449
                                            /home/jenkins/agent/workspace/specter/chord/local_kv_test.go:290
                Error:          Not equal: 
                                expected: 600
                                actual  : 598
                Test:           TestConcurrentJoinKV/test_with_64_nodes_and_600_keys
                Messages:       expect 600 keys to be found, but only 598 keys found with 2 missing and 0 mismatched

.fixK() and .closestPreceedingNode() may be broked

zllovesuki commented 1 year ago

fixed by 8810c90dcab342eeae8758fcddd5d31343ae53e2