vmware-archive / haret

A strongly consistent distributed coordination system, built using proven protocols & implemented in Rust.
461 stars 18 forks source link

Entering a namespace that doesn't exist returns incorrect value #57

Closed andrewjstone closed 7 years ago

andrewjstone commented 7 years ago

When attempting to "enter" a namespace that doesn't exist, the CLI hangs and will eventually timeout. However, instead of displaying timeout, it shows the primary for the last entered namespace.

Below, the uuid ending in 39 exists, but 40 does not.

andrewstone$ rlwrap target/debug/v2r2-cli-client 127.0.0.1:2002
v2r2> enter 2cc91edf-104b-4c60-9912-dd91116f3d39
Finished Redirecting. Primary = name: "r" group: "2cc91edf-104b-4c60-9912-dd91116f3d39" node_name: "dev2" node_addr: "127.0.0.1:3000", API Address = 127.0.0.1:3002
v2r2> enter 2cc91edf-104b-4c60-9912-dd91116f3d40
Retry complete. Primary = name: "r" group: "2cc91edf-104b-4c60-9912-dd91116f3d39" node_name: "dev2" node_addr: "127.0.0.1:3000", API Address = 127.0.0.1:3002
andrewjstone commented 7 years ago

If no prior namespace was entered, it returns primary unknown. This is also incorrect, as it doesn't indicate the namespace is unknown.

andrewjstone commented 7 years ago

The fixed code now returns Primary unknown when the primary can't be found. This is only a partial fix. I believe there shouldn't be a timeout at all. Instead, an error should be returned right away stating the namespace can't be found.

andrewjstone commented 7 years ago

Reopening to look into why the code waits for a timeout at all.

andrewjstone commented 7 years ago

Correct behavior:

andrewstone$ rlwrap target/debug/v2r2-cli-client 127.0.0.1:2002
v2r2> enter 2cc91edf-104b-4c60-9912-dd91116f3d50
Unknown namespace
v2r2> enter d604063d-92de-4e39-8f5a-49f9cb10f42b
Client registered. Primary = name: "r" group: "d604063d-92de-4e39-8f5a-49f9cb10f42b" node_name: "dev1" node_addr: "127.0.0.1:2000"
v2r2> enter 2cc91edf-104b-4c60-9912-dd91116f3d50
Unknown namespace