-
Notifications
You must be signed in to change notification settings - Fork 1.1k
test(server): test transaction locked keys #1669
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
Conversation
adiholden
commented
Aug 8, 2023
- Add test utility class that will add suspension to transaction execution.
- Add test for locked keys in transaction
1. add test utility class that will add suspension to transaction execution. 2. add test for locked keys in transaction Signed-off-by: adi_holden <[email protected]>
Signed-off-by: adi_holden <[email protected]>
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.
Great, I imagined it in a similar way.
Just as an idea: For other tests to use it it'd be convenient if the TransactionSuspension would itself start a fiber and loops, so you could do
auto lock_check = CheckWillBeLocked("key", ...) // starts fiber and lets go once locks are rightly acquired
Run(mycmd)
But as the only user (or not?) are cluster tests its all open for you to decide 🙂
src/server/test_utils.cc
Outdated
|
||
void TransactionSuspension::Start() { | ||
CommandId cid{"TEST", CO::WRITE | CO::GLOBAL_TRANS, -1, 0, 0, 0}; | ||
transaction_.reset(new dfly::Transaction{&cid}); |
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.
Use make_unique()
🙏
src/server/multi_test.cc
Outdated
for (int i = 0; i < 1000; ++i) { | ||
if (service_->IsLocked(0, "key1") && service_->IsLocked(0, "key2")) { | ||
break; | ||
} | ||
ThisFiber::SleepFor(1ms); | ||
} |
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.
We use this hack in many places, maybe move ExpectConditionWithinTimeout to test_utils.h and use it here?
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.
This has the advantage of failing the test in the case of a timeout, because right now even if TransactionSuspension
does nothing, the test will still pass
Signed-off-by: adi_holden <[email protected]>
Signed-off-by: adi_holden <[email protected]>
Signed-off-by: adi_holden <[email protected]>
./dragonfly_test | ||
./multi_test --multi_exec_mode=1 | ||
./multi_test --multi_exec_mode=3 |
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.
Consider moving these to the daily instead