Skip to content

Make membership updates idempotent and bound replica traversal - #33

Open
vitalivo wants to merge 1 commit into
stathat:masterfrom
vitalivo:fix/bounded-replica-search
Open

vitalivo wants to merge 1 commit into
stathat:masterfrom
vitalivo:fix/bounded-replica-search

Conversation

@vitalivo

Copy link
Copy Markdown

Fixes #23 and #32.

Adding an existing member increments count without adding a distinct member; removing an absent member decrements it. Make both operations idempotent so replica requests use the actual member count.

The replica search loops also fail to terminate when they start at index zero and cannot find enough distinct members. Bound traversal to one pass through the ring, returning only distinct members that are present. A regression uses two names with the same CRC32 replica hash to exercise this even when the membership count is correct.

Both regressions fail on the original code, including a two-second test timeout for the collision. Full go test -vet=off -race -cover passes (94.1% coverage). Vet is disabled because the pre-existing ExampleAdd and ExampleRemove names fail modern Go vet; the package predates modules and was tested under its canonical GOPATH import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a idempotent Add|Remove method?

1 participant