refactor: introduce TransactionContext to decouple Transaction and PendingUpdate#591
Open
wgtmac wants to merge 1 commit intoapache:mainfrom
Open
refactor: introduce TransactionContext to decouple Transaction and PendingUpdate#591wgtmac wants to merge 1 commit intoapache:mainfrom
wgtmac wants to merge 1 commit intoapache:mainfrom
Conversation
…endingUpdate
Add TransactionContext to own the shared state (table, metadata_builder,
kind) between Transaction and PendingUpdate. Both now hold a
shared_ptr<TransactionContext> instead of PendingUpdate holding a
weak_ptr<Transaction>.
This fixes two issues:
- pending_updates_ was weak_ptr, so dropping a PendingUpdate would
silently break Finalize/retry; now Transaction holds shared_ptr
- Table::New*() no longer creates a temporary Transaction; it creates
a TransactionContext directly and passes it to the PendingUpdate,
removing the circular dependency
Also clean up related redundancy:
- Hoist Transaction::Kind to a standalone enum class TransactionKind
- Remove Transaction::kind_ (duplicate of ctx_->kind)
- Remove auto_commit machinery; PendingUpdate::Commit() now calls
txn->Commit() explicitly on the table-created path
- TransactionContext::Make returns Result to propagate null table errors
This file contains hidden or 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
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.
Add TransactionContext to own the shared state (table, metadata_builder, kind) between Transaction and PendingUpdate. Both now hold a shared_ptr instead of PendingUpdate holding a weak_ptr.
This fixes two issues:
Also clean up related redundancy: