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

Allow memoryengine transactions without locking #244

Closed
tie opened this issue Oct 9, 2020 · 3 comments
Closed

Allow memoryengine transactions without locking #244

tie opened this issue Oct 9, 2020 · 3 comments

Comments

@tie
Copy link
Contributor

tie commented Oct 9, 2020

Currently we can’t write tests for concurrent transactions since memoryengine acquires lock on Begin. We should allow creating memoryengine instance that doesn’t lock so that we can test ACID properties of concurrent (but not necessarily parallel) transactions.

Note that with #231 it would be possible to pass such option via context.Context.

Related: #243

@tie tie changed the title Allow creating memoryengine without locking Allow memoryengine transactions without locking Oct 9, 2020
@asdine
Copy link
Collaborator

asdine commented Oct 9, 2020

This is actually pretty complicated, because that would basically force us to implement MVCC in the memoryengine, which by itself is a huge project.
The current memory engine provides the same guarantees as BoltDB or SQLite, which is one concurrent writer and multiple concurrent readers.
Is there something that you think is missing in the memoryengine?

@tie
Copy link
Contributor Author

tie commented Oct 9, 2020

It’s indeed hard for the general case, but the point is to be able to synchronously test concurrent transactions for cases like #243. Currently it should suffice to clone the underlying BTree on Begin and return an error on Commit if another transaction modified the tree. This should (mostly) match the behavior in BadgerDB.

Perhaps this could also be a separate implementation in a new testengine package.

@asdine
Copy link
Collaborator

asdine commented May 1, 2021

The memory engine is now lock-free

@asdine asdine closed this as completed May 1, 2021
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

No branches or pull requests

2 participants