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: possible preemption under FiberAtomicGuard #4692

Merged
merged 1 commit into from
Mar 4, 2025
Merged

fix: possible preemption under FiberAtomicGuard #4692

merged 1 commit into from
Mar 4, 2025

Conversation

romange
Copy link
Collaborator

@romange romange commented Mar 3, 2025

  1. Fix FreeMemWithEvictionStep that could preempt under FiberAtomicGuard.
    This could happen during the return from the inner loop. Now, we break
    from the guard first and then preempt in a safe place.
  2. Rename LocalBlockingCounter to LocalLatch
    because it's a variation of latch (see std::latch for example).
  3. Rename PreUpdate to PreUpdateBlocking to emphasize it can block.
  4. Fix mutations counting: consider either insertions or changing the existing entry.
    Before that we incremented this counter for misses as well.

@romange romange requested review from kostasrim and adiholden March 3, 2025 20:23
@romange romange force-pushed the DbSlice2 branch 2 times, most recently from 0d92f43 to 0aed929 Compare March 3, 2025 20:27
@romange romange changed the title chore: rename functions/classes in db_slice code fix: possible preemption under FiberAtomicGuard Mar 3, 2025
1. Fix FreeMemWithEvictionStep that could preempt under FiberAtomicGuard.
   This could happen during the return from the inner loop. Now, we break
   from the guard first and then preempt in a safe place.
2. Rename LocalBlockingCounter to LocalLatch
   because it's a variation of latch (see std::latch for example).
3. Rename PreUpdate to PreUpdateBlocking to emphasize it can block.
4. Fix mutations counting: consider either insertions or changing the existing entry.
   Before that we incremented this counter for misses as well.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Copy link
Contributor

@kostasrim kostasrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -481,15 +481,15 @@ BorrowedInterpreter::~BorrowedInterpreter() {
ServerState::tlocal()->ReturnInterpreter(interpreter_);
}

void LocalBlockingCounter::unlock() {
DCHECK(mutating_ > 0);
void LocalLatch::unlock() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like LocalLatch :)

@romange romange merged commit ea6fdad into main Mar 4, 2025
10 checks passed
@romange romange deleted the DbSlice2 branch March 4, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants