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

Multiple iterators in read-write transactions #1093

Closed
asdine opened this issue Oct 21, 2019 · 2 comments
Closed

Multiple iterators in read-write transactions #1093

asdine opened this issue Oct 21, 2019 · 2 comments
Labels
status/stale The issue hasn't had activity for a while and it's marked for closing.

Comments

@asdine
Copy link

asdine commented Oct 21, 2019

What version of Go are you using (go version)?

$ go version
go version go1.13 darwin/amd64

What version of Badger are you using?

v1.6.0

Does this issue reproduce with the latest master?

Yes

I'm opening a new issue because the existing ones are all closed for different reasons, please let me know if you prefer to move the conversation elsewhere.

There is currently no way to use multiple cursors in a RW transaction, which can be problematic when you want to read multiple data sets within the same transaction before applying some changes.

Example:

  • iterate over set A (with a given prefix)
  • for each element of set A, iterate over set B and apply some changes

The goal is to have a consistent view of the database before doing some changes.
If that can help, here is concrete use cases of mine. I need to run something equivalent to this request UPDATE t SET foo = 'bar' WHERE baz > 10. In this example, I need to:

  • iterate over all the records of table t (which are keys with a certain prefix in the Badger DB)
  • for each matching record, iterate over the indexes (which are keys with another prefix stored in the same DB) and delete the entries who refer to this record

This is obviously a dumb algorithm, but it is just given as an example of nested operations within the same transaction.

Do you think there is a way to allow having multiple cursors within the same rw transaction?

@stale
Copy link

stale bot commented Nov 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status/stale The issue hasn't had activity for a while and it's marked for closing. label Nov 20, 2019
@stale
Copy link

stale bot commented Nov 27, 2019

This issue was marked as stale and no activity has occurred since then, therefore it will now be closed. Please, reopen if the issue is still relevant.

@stale stale bot closed this as completed Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/stale The issue hasn't had activity for a while and it's marked for closing.
Development

No branches or pull requests

1 participant