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

[QUESTION]: Can transactions be seen out-of-order within a single Go application? #2052

Open
BatmanAoD opened this issue Mar 26, 2024 · 0 comments
Labels
kind/question Something requiring a response

Comments

@BatmanAoD
Copy link

BatmanAoD commented Mar 26, 2024

Question.

I have a Go application where it is assumed that a sequence of transactions performed by one goroutine will be seen (by other goroutines within the same application) as occurring in the order in which the goroutine performed them. Is this always guaranteed?

I'm trying to understand a specific behavior I'm seeing that is something like this:

  • Goroutine 1:
    • Transaction 1:
      • Write b
    • Transaction 2:
      • Delete a
  • Goroutine 2:
    • Transaction 1:
      • Read a (using txn.Get inside db.View); it is not present (i.e. Get returns ErrKeyNotFound)
    • Transaction 2:
      • Read b (using txn.Get inside db.View); it is also not present

As long as no other goroutines delete a or b, shouldn't Goroutine 2 see at least one of a or b?

@BatmanAoD BatmanAoD added the kind/question Something requiring a response label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Something requiring a response
Development

No branches or pull requests

1 participant