-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2394: Fixed invalid read-time for RF==1 case.
Summary: Fixed: #2394: [YCQL] TTL enforcement delayed when non-default (weaker) read-consistency is used The issue happens in the situation (as in the Golang test at https://gist.githubusercontent.com/kmuthukk/f182837117f7af553a0d500c54e89ee3/raw): - CREATE TABLE with DEFAULT_TTL=5 - INSERT a few records - Sleep( 6 or more seconds ) - SELECT records - the returned result set must be empty In fact - the set is NOT empty, but it happens with ConsistencyLevel=ONE only. With ConsistencyLevel=QUORUM the test passed, because in this case the request must be processed by the LEADER and the LEADER always knows correct safe-time. In case of ConsistencyLevel=ONE the system can route the read request to any FOLLOWER. In case of RF=1 we work with the LEADER peer as with FOLLOWER - and this is the processed incorrectly corner case. Finally, the TTL does not work correctly because read-time is not valid (it's in past). The invalid read-time is returned by the MvccManager::SafeTimeForFollower() method. It returns invalid value in case of RF=1 (in case RF=3 the value is correct, because FOLLOWERS are correctly updated by the LEADER and the internal MVCC value propagated_safe_time_ is updated). In the case RF=1 the LEADER does not update itself and the MVCC variable propagated_safe_time_ is still in past. Solution: in case of RF=1 the MvccManager::SafeTimeForFollower() must use MvccManager::SafeTime(), which correctly calculates the up-to-date HybridTime value on the LEADER. Test Plan: ybd --java-test org.yb.loadtester.TestRF1Cluster#testDefaultTTLWithFixedRF ybd --java-test org.yb.loadtester.TestRF1Cluster#testDefaultTTLWithFixedRF -n 100 ybd --java-test org.yb.loadtester.TestRF1Cluster#testDefaultTTLWithChangedRF ybd --java-test org.yb.loadtester.TestRF1Cluster#testDefaultTTLWithChangedRF -n 100 GO script attached to the github issue. Reviewers: kannan, mikhail, sergei Reviewed By: sergei Subscribers: mikhail, bogdan, kannan, yql Differential Revision: https://phabricator.dev.yugabyte.com/D7330
- Loading branch information
1 parent
634fc17
commit 320759a
Showing
7 changed files
with
139 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters