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

Fix epoch refresh of uncommitted safe tail #744

Merged
merged 1 commit into from
Sep 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cs/src/core/FasterLog/FasterLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1521,18 +1521,20 @@ private void EpochProtectAutoRefreshSafeTailAddressRunner()

private void AutoRefreshSafeTailAddressRunner(bool recurse)
{
long tail = 0;
do
{
if (TailAddress > SafeTailAddress)
tail = TailAddress;
if (tail > SafeTailAddress)
{
if (recurse)
Task.Run(EpochProtectAutoRefreshSafeTailAddressRunner);
else
epoch.BumpCurrentEpoch(() => AutoRefreshSafeTailAddressBumpCallback(TailAddress));
epoch.BumpCurrentEpoch(() => AutoRefreshSafeTailAddressBumpCallback(tail));
return;
}
_ongoingAutoRefreshSafeTailAddress = 0;
} while (TailAddress > SafeTailAddress && _ongoingAutoRefreshSafeTailAddress == 0 && Interlocked.CompareExchange(ref _ongoingAutoRefreshSafeTailAddress, 1, 0) == 0);
} while (tail > SafeTailAddress && _ongoingAutoRefreshSafeTailAddress == 0 && Interlocked.CompareExchange(ref _ongoingAutoRefreshSafeTailAddress, 1, 0) == 0);
}

private void AutoRefreshSafeTailAddressBumpCallback(long tailAddress)
Expand Down