-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Commit transaction for each configuration change #17119
Conversation
a1e06dd
to
d60a1b2
Compare
a147643
to
247d081
Compare
Confirmed that this PR can fix #17100 and also #17052 @serathius Please feel free to resurrect #17017 after this PR is merged. From what we understood so far, #17017 does not introduce regression. Instead, it just discovered an existing issue. |
The workflow |
Little confused about the naming and the proposed solution. Call to
As for naming, what do you mean by cache in etcd/server/etcdserver/api/membership/cluster.go Lines 421 to 462 in 2cf112f
Shouldn't it be ok as long consistent index in bbolt is consistent with the conf change? When I recently surprised by the differences of the apply code for updating consistent index between apply normal etcd/server/etcdserver/server.go Lines 1831 to 1841 in 2cf112f
etcd/server/etcdserver/server.go Lines 1980 to 1993 in 2cf112f
I will need some time to deep dive and understand your finding. It might take me some time. Thanks for your understanding. |
Thanks, awesome finding! Thanks for looking into this. After we address this issue we should have a followup discussion on our testing gaps, because here we just got lucky that I added this test. |
I'm not certain why the pod was deleted. It may have been killed for a resource or preemption reason on the kubernetes test infra cluster. Below are the final logs for the prowjob: {"Time":"2023-12-14T15:42:36.887712595Z","Action":"output","Package":"go.etcd.io/etcd/tests/v3/common","Test":"TestUserAdd_Simple/PeerAutoTLS/no_password_without_noPassword_set","Output":"/home/prow/go/src/github.com/etcd-{"component":"entrypoint","file":"k8s.io/test-infra/prow/entrypoint/run.go:173","func":"k8s.io/test-infra/prow/entrypoint.Options.ExecuteProcess","level":"error","msg":"Entrypoint received interrupt: terminated","severity":"error","time":"2023-12-14T15:42:38Z"}
++ early_exit_handler
++ '[' -n 17 ']'
++ kill -TERM 17
++ cleanup_dind
++ [[ false == \t\r\u\e ]]
+ EXIT_VALUE=143
+ set +o xtrace
make: *** [Makefile:53: test-e2e-release] Terminated For now I will retry it. If we see this error again I will raise an issue in /retest |
247d081
to
d0d762a
Compare
Just as I mentioned in #17100 (comment), there are two issues. Let me provide more context & details.
|
buf txWriteBuffer |
read buffer
etcd/server/storage/backend/read_tx.go
Line 43 in 2cf112f
buf txReadBuffer |
syncs data from write buffer to read buffer at the end of the etcd TXN (Note: it isn't bbolt TXN, FYI https://drive.google.com/file/d/1GAVg206rqrL4at14Dpr837SrtFCrJ-hJ/view?usp=drive_link)
etcd/server/storage/backend/batch_tx.go
Line 310 in 2cf112f
t.buf.writeback(&t.backend.readTx.buf) |
about Consistent index
Note that the issues mentioned above have nothing to do with consistent-index. If anyone has any concern or suggestion on consistent-index, Please let's discuss it in a separate session.
Current when etcd remove a member, it just removes it from bbolt db, but doesn't update the cache. On the other hands, etcd periodically commit each bbolt transaction. When etcd processes the next conf change request, it might not have commit the previous member remove request into bbolt. Accordingly it breaks the linerizability. Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
d0d762a
to
b6ded5c
Compare
Thanks for explanation, for me this is more scary than just "Peer URLs already exists". For me this is etcd transaction buffers breaking "readCommited" guarantee when deleting keys. Impact is limited because etcd doesn't do a lot of key deletion, as KV adds a tombstone instead of deletion. However the problem is that it breaks basic assumptions that can pop out in other places. I have added a simple test to reproduce it #17124 |
Please feel free to let me know if you can reproduce whatever other issue on top of this PR. |
It turns out to be more generic issue #17124 (comment) |
Extracted the change for the test case TestMemberReplace into a separate PR #17125, so that it can be reviewed & merged separately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// | ||
// Please also refer to | ||
// https://github.com/etcd-io/etcd/pull/17119#issuecomment-1857547158 | ||
s.be.ForceCommit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be applying the same fix to MustSaveMemberToBackend
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, actually the comment right above s.be.ForceCommit()
already explains the reason. Please feel free to ping me if you need further clarification.
Also note this PR only resolves the issue for conf change. We need to think about a more generic solution for all similar changes on bucket other than key
, i.e auth, lease, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Good find @ahrtr and thanks for the detailed explanation.
Resolved in #17195 |
Current when etcd remove a member, it just removes it from bbolt db, but doesn't update the cache. On the other hands, etcd periodically commit each bbolt transaction. When etcd processes the next conf change request, it might not have finished committing the previous member remove request into bbolt. Accordingly it breaks the linerizability.
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.