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

etcdserver: use same ReadView for read-only txns #8071

Merged
merged 3 commits into from
Jun 9, 2017

Conversation

heyitsanthony
Copy link
Contributor

@heyitsanthony heyitsanthony commented Jun 9, 2017

Fixes inconsistencies from writes interfering with read-only txns.

@codecov-io
Copy link

Codecov Report

Merging #8071 into master will decrease coverage by 0.14%.
The diff coverage is 91.89%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8071      +/-   ##
==========================================
- Coverage   76.66%   76.51%   -0.15%     
==========================================
  Files         341      341              
  Lines       26511    26511              
==========================================
- Hits        20324    20286      -38     
- Misses       4741     4773      +32     
- Partials     1446     1452       +6
Impacted Files Coverage Δ
mvcc/kv.go 40% <100%> (+40%) ⬆️
etcdserver/apply.go 88.82% <91.42%> (-0.22%) ⬇️
mvcc/kv_view.go 80% <0%> (-20%) ⬇️
clientv3/namespace/watch.go 87.87% <0%> (-12.13%) ⬇️
pkg/fileutil/purge.go 73.68% <0%> (-7.9%) ⬇️
pkg/adt/interval_tree.go 89.63% <0%> (-3.66%) ⬇️
raft/node.go 90.17% <0%> (-2.24%) ⬇️
rafthttp/msgappv2_codec.go 71.3% <0%> (-1.74%) ⬇️
rafthttp/peer.go 90.22% <0%> (-1.51%) ⬇️
etcdserver/cluster_util.go 76.64% <0%> (-1.46%) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a8c073c...a47cafd. Read the comment docs.

Copy link
Contributor

@gyuho gyuho left a comment

Choose a reason for hiding this comment

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

lgtm. thanks!
Will backport to 3.2 after merge.

/cc @xiang90

Anthony Romano added 3 commits June 9, 2017 09:20
Already used internally by mvcc, but needed by etcdserver txns.
A read-only txn isn't serialized by raft, but it uses a fresh
read txn for every mvcc access prior to executing its request ops.
If a write txn modifies the keys matching the read txn's comparisons,
the read txn may return inconsistent results.

To fix, use the same read-only mvcc txn for the duration of the etcd
txn. Probably gets a modest txn speedup as well since there are
fewer read txn allocations.
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