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

Transaction test unlock wal fix #514

Merged
merged 3 commits into from
May 24, 2023
Merged

Conversation

Yuval-Ariel
Copy link
Contributor

@Yuval-Ariel Yuval-Ariel commented May 21, 2023

closes #493

When external_delay = true, a stop token is taken in addition to the LockWal stop token. when UnlockWal() is called, it releases the stop token and calls bg_cv_.SignalAll() . this wakes a sleeping writing thread to call EndWriteStall() which in turn increments stall_ended_count_. stall_ended_count_ is the counter that the UnlockWal() thread is waiting on in WaitForStallEndedCount. this is where our current code is stuck since during #346 , we've moved the waiting to a cv in the WriteController and not in the DB since there can be many dbs sharing a WriteController. The thread in UnlockWal() is stuck since when the writing thread wakes up (after detor of Stop Token), it does not call EndWriteStall() but simply stays in the while loop since the IsStopped condition is still true (the external_delay token).
looking at the code of UnlockWal, it doesnt seem viable to release the UnlockWal() thread when theres still an active stop token which is what the current test is doing.

fix by:
release the external stop token taken before calling UnlockWal() so that both the stop conditions will be removed when UnlockWal() checks WaitForStallEndedCount.

@Yuval-Ariel Yuval-Ariel added the bug fix Fixes a known bug label May 21, 2023
@Yuval-Ariel Yuval-Ariel requested a review from ofriedma May 21, 2023 08:46
@Yuval-Ariel Yuval-Ariel self-assigned this May 21, 2023
@ofriedma
Copy link
Contributor

@Yuval-Ariel there are conflicts in the PR

@Yuval-Ariel Yuval-Ariel force-pushed the transaction_test_unlock_wal_fix branch from 486a5d4 to 55ab457 Compare May 21, 2023 09:10
Yuval-Ariel and others added 2 commits May 24, 2023 09:57

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@Yuval-Ariel Yuval-Ariel merged commit d0cdbbd into main May 24, 2023
@Yuval-Ariel Yuval-Ariel deleted the transaction_test_unlock_wal_fix branch May 24, 2023 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix Fixes a known bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unit tests: transaction_test UnlockWALStallCleared fails
2 participants