-
Notifications
You must be signed in to change notification settings - Fork 4
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
Multi-document "Pando" MongoDriver format #71
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make sure we're starting from a clean slate.
Turns out all the pain of dealing with Document vs BsonDocument was self-inflicted. We can just deal with BsonDocument everywhere and benefit from increased type safety.
Transactions don't work the way I assumed, so I've decided to make a wrapper class, TransactionalCollection, that works the way I want. It maintains a ThreadLocal<ClientSession> and injects that into every operation, ensuring that we won't accidentally do a one-off operation that punches through the transaction. It's also flexible about transaction semantics. Code that needs its operations to be in a single transaction can call ensureTransactionStarted, and it's ok for this to be called repeatedly at mutiple levels of the stack. Then MainDriver calls commitTransactionIfAny at the end of every session (unless an exception is thrown). The result is that transactions can be begun at any level of the stack, and will be committed at the appropriate time. This flexibility allows code like SequoiaDriver to remain agnostic about transactions, since that driver doesn't actually need them for its own sake; but MainDriver needs a transaction for refurbish, and it can establish one with no cooperation from SequoiaDriver. Conversely, PandoDriver will need transactions for almost every operation, and it can establish them too; and yet later, if PandoDriver finds ways to skip transactions in certain cases, it has the freedom to do so.
prdoyle
force-pushed
the
mongo-multi
branch
3 times, most recently
from
September 17, 2023 18:19
188b067
to
bdda81d
Compare
This allows the initial Pando implementation commit to show all the changes between the two.
prdoyle
force-pushed
the
mongo-multi
branch
from
September 17, 2023 18:43
bdda81d
to
8f27c82
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements #2.