Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign uptxn: avoid useless calculation and wake-up msgs #4813
Merged
Conversation
@@ -91,6 +95,9 @@ impl WaitTable { | |||
} | |||
|
|||
fn add_waiter(&mut self, ts: u64, waiter: Waiter) -> bool { | |||
if self.wait_table.is_empty() { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
LGTM |
This comment has been minimized.
This comment has been minimized.
} else { | ||
None | ||
}; | ||
let key_hashes = gen_key_hashes_if_needed(&waiter_mgr_scheduler, &keys); |
This comment has been minimized.
This comment has been minimized.
WAIT_TABLE_IS_EMPTY.store(is_empty, Ordering::Relaxed); | ||
} | ||
|
||
pub fn load_wait_table_is_empty() -> bool { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
LGTM |
Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
Rest LGTM |
notify_waiter_mgr(&waiter_mgr_scheduler, lock_ts, key_hashes, commit_ts); | ||
notify_deadlock_detector(&detector_scheduler, is_pessimistic_txn, lock_ts); | ||
notify_waiter_mgr_if_needed(&waiter_mgr_scheduler, lock_ts, key_hashes, commit_ts); | ||
notify_deadlock_detector_if_needed(&detector_scheduler, is_pessimistic_txn, lock_ts); |
This comment has been minimized.
This comment has been minimized.
AndreMouche
Jun 6, 2019
Member
Could we merge these two functions into one since they are always used together? Maybe define a new function which call these two functions?
This comment has been minimized.
This comment has been minimized.
youjiali1995
Jun 6, 2019
Author
Contributor
The function needs many parameters, and I think it is a bit redundant.
src/storage/txn/process.rs
Outdated
if wait_table_is_empty { | ||
None | ||
} else { | ||
Some(vec![]) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Rest LGTM |
Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
0d87c69
to
acc89d1
This comment has been minimized.
This comment has been minimized.
LGTM |
youjiali1995
added a commit
to youjiali1995/tikv
that referenced
this pull request
Jun 13, 2019
* pessimistic-txn: avoid useless wake-up msgs if wait talbe is empty Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * bugfix Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * fix conflict Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * fix data race Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * fix test Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * bugfix Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
youjiali1995
added a commit
to youjiali1995/tikv
that referenced
this pull request
Jun 13, 2019
* pessimistic-txn: avoid useless wake-up msgs if wait talbe is empty Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * bugfix Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * fix conflict Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * fix data race Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * fix test Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * bugfix Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
sticnarf
pushed a commit
to sticnarf/tikv
that referenced
this pull request
Oct 27, 2019
* pessimistic-txn: avoid useless wake-up msgs if wait talbe is empty Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * bugfix Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * fix conflict Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * fix data race Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * fix test Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * bugfix Signed-off-by: youjiali1995 <zlwgx1023@gmail.com> * address comment Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
youjiali1995 commentedMay 30, 2019
Signed-off-by: youjiali1995 zlwgx1023@gmail.com
What have you changed? (mandatory)
Add atomic variable
WAIT_TABLE_IS_EMPTY
. If it is true, the wait table is empty and there is no need to calculate keys' hashes and wake up waiters.What are the type of the changes? (mandatory)
How has this PR been tested? (mandatory)
Please describe the tests that you ran to verify your changes. Have you finished unit tests, integration tests, or manual tests? What additional tests would give you greater confidence in this change?
Does this PR affect documentation (docs) or release note? (mandatory)
No
Does this PR affect tidb-ansible update? (mandatory)
No
Add a few positive/negative examples (optional)
Now there is no wake-up msg sent to waiter manager if only uses the optimistic transaction.
