Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linearizability tests - Add support for delete api #14802

Merged
merged 4 commits into from
Dec 6, 2022

Conversation

geetasg
Copy link

@geetasg geetasg commented Nov 17, 2022

@codecov-commenter
Copy link

codecov-commenter commented Nov 17, 2022

Codecov Report

Merging #14802 (e1ea963) into main (6a156bd) will decrease coverage by 0.19%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main   #14802      +/-   ##
==========================================
- Coverage   75.64%   75.44%   -0.20%     
==========================================
  Files         457      457              
  Lines       37423    37416       -7     
==========================================
- Hits        28309    28230      -79     
- Misses       7347     7403      +56     
- Partials     1767     1783      +16     
Flag Coverage Δ
all 75.44% <ø> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/etcdserver/api/v3rpc/util.go 67.74% <0.00%> (-12.91%) ⬇️
server/proxy/grpcproxy/register.go 69.76% <0.00%> (-11.63%) ⬇️
client/v3/leasing/util.go 91.66% <0.00%> (-6.67%) ⬇️
client/pkg/v3/fileutil/purge.go 68.85% <0.00%> (-6.56%) ⬇️
client/v3/namespace/watch.go 87.87% <0.00%> (-6.07%) ⬇️
client/v3/concurrency/session.go 88.63% <0.00%> (-4.55%) ⬇️
server/etcdserver/api/v3rpc/watch.go 84.12% <0.00%> (-3.50%) ⬇️
server/proxy/grpcproxy/watch.go 93.64% <0.00%> (-2.90%) ⬇️
server/etcdserver/api/v3election/election.go 66.66% <0.00%> (-2.78%) ⬇️
client/v3/experimental/recipes/key.go 75.34% <0.00%> (-2.74%) ⬇️
... and 13 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ahrtr ahrtr marked this pull request as draft November 18, 2022 05:47
@ahrtr
Copy link
Member

ahrtr commented Nov 18, 2022

Please mark it ready for review when it's ready.

@@ -119,6 +129,9 @@ func initState(request etcdRequest, response etcdResponse) EtcdState {
} else {
state.FailedWrites[request.putData] = struct{}{}
}
case Delete:
//TODO should state have 'deleted' field?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed.

@serathius
Copy link
Member

You still need to integrate tests into ./tests/linearizability/traffic.go.
You can just change

DefaultTraffic Traffic = readWriteSingleKey{key: "key", writes: []opChance{{operation: Put, chance: 100}}}

to

DefaultTraffic Traffic = readWriteSingleKey{key: "key", writes: []opChance{{operation: Put, chance: 90}, {operation: Delete, chance: 10}}}

And add a case Delete to switch within (t readWriteSingleKey) Writefunction to that will callclient.Delete`.

@serathius
Copy link
Member

serathius commented Nov 18, 2022

We are also missing tests for failed Delete request, but those are hard to write due to how model works. I can help and add them in later PR.

@serathius
Copy link
Member

Overall it looks good, just need to handle delete errors. Great job!

@serathius
Copy link
Member

serathius commented Nov 29, 2022

Checked the linearizability failure. As expected it's an issue with handling Delete error.

image

Linearizability tests reported error as Get returned empty string. There is a missing Delete request in the graph. We need to also track failed requests as fail can a network error from perspective from client, but etcd managed to persist it.

@serathius serathius changed the title WIP linearizability tests - Add support for delete api linearizability tests - Add support for delete api Nov 30, 2022
@serathius
Copy link
Member

serathius commented Nov 30, 2022

Can you fix DCO check?
you just need to do add a line Signed-off-by: X to your commit message.

This can be done automatically on latest commit via git commit --amend --signoff.

As there are some more commits to be updated you should be able to do that with git fetch upstream && git checkout origin/delete_api && git rebase origin/main --signoff && git push origin HEAD:delete_api -f assuming name of remotes is upstream for the etcd repo, and origin for your fork.

@serathius
Copy link
Member

serathius commented Nov 30, 2022

I started testing the model and found issues related to put request failed but was persisted and following delete checks if object was deleted. Will keep you posted if I figure out a solution.

Geeta Gharpure added 2 commits December 1, 2022 09:39
@geetasg geetasg force-pushed the delete_api branch 2 times, most recently from 9edfdb3 to 1d82f4d Compare December 1, 2022 17:41
Signed-off-by: Marek Siarkowicz <[email protected]>
Signed-off-by: Marek Siarkowicz <[email protected]>
@geetasg
Copy link
Author

geetasg commented Dec 1, 2022

notes -
test using

   pushd tools/mod; go install go.etcd.io/gofail; popd
    mkdir -p /tmp/linearizability
    FAILPOINTS=true make build
    cat server/etcdserver/raft.fail.go
    EXPECT_DEBUG=true GO_TEST_FLAGS=-v RESULTS_DIR=/tmp/linearizability make test-linearizability

or -
make gofail-enable
make build
GO_TEST_FLAGS=-v make test-linearizability

@geetasg geetasg marked this pull request as ready for review December 5, 2022 04:06
@geetasg
Copy link
Author

geetasg commented Dec 5, 2022

Marking ready for review based on checked - https://github.com/etcd-io/etcd/pull/14802/checks
Please take a look @serathius @ahrtr


func stepDelete(state EtcdState, request etcdRequest, response etcdResponse) (bool, EtcdState) {
if response.err != nil {
state.FailedWrites[""] = struct{}{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
state.FailedWrites[""] = struct{}{}
state.FailedWrites[state.Value] = struct{}{}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to record whatever value in state in FailedWrites.

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me with a minor comment.

Thank you @geetasg

This PR has some conflict with #14880. I tend to let this PR in firstly, and then update 14880 afterwards.

@serathius
Copy link
Member

FYI, this PR doesn't implement correct handling of failed delete requests. I looked into fixing this, however code got so complicated that I decided to change our approach of handling errors. This PR without #14880 will introduce flakiness.

I would be ok to merge this PR first assuming that we will merge #14880 right after.

@serathius
Copy link
Member

All PRs approved, let's start merging.

@serathius serathius merged commit 2263315 into etcd-io:main Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants