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

[2DC] Apply transactions atomically on replica universe #1808

Closed
ndeodhar opened this issue Jul 15, 2019 · 1 comment
Closed

[2DC] Apply transactions atomically on replica universe #1808

ndeodhar opened this issue Jul 15, 2019 · 1 comment
Assignees
Labels
area/docdb YugabyteDB core features roadmap-tracking-issue This issue tracks a major roadmap item, and usually appears in the roadmap list.

Comments

@ndeodhar
Copy link
Contributor

To apply transactions atomically on replica universe, we need to introduce an additional status WAITING_TO_COMMIT. This will wait for all replica tablets to receive CDC changes for a transaction. Once all tablets have received changes and recorded those in their WALs, the transaction can be committed.

Flow will be:

  • Replica tserver receives the replicated WAL record(s) in response to GetCDCRecords RPC.

  • If the record is Transaction create/update: It sends the transaction record to transaction tablet leader which adds to its WAL.

  • If record is Write op for a transaction: It sends the record to tablet leader of the key. The tablet leader ensures that there is no conflict, writes the record to its WAL, and creates provisional record.

  • If record is Transaction Applying record for a tablet involved in the transaction: Replication leader will send an RPC to the transaction leader, indicating that the tablet involved has received all records for the transaction. Transaction leader will record this information in its WAL and transactions table (using field tablets_received_applying_record) and sets transaction status to WAITING_TO_COMMIT.

  • If transaction status is WAITING_TO_COMMIT and all involved tablets have received their Applying message, then transaction leader changes transaction status to COMMITTED and sends a new Applying message to all involved tablets, notifying them to commit the transaction. If all tablets have not yet received all records involved in the transaction, then the status remains unchanged at WAITING_TO_COMMIT and the changes are not yet applied on the replica universe.

  • Similar to above, if record is Transaction Commit record: Replication leader will send an RPC to transaction leader. Transaction leader checks whether all tablets involved in the transaction have received their Applying records. If not, then it will set transaction status to WAITING_TO_COMMIT. If all involved tablets have received Applying record, then the transaction leader sets the status to COMMITTED, and sends a new Applying record to all involved tablets, notifying them to commit the transaction.

@ndeodhar ndeodhar added the area/docdb YugabyteDB core features label Jul 15, 2019
@ndeodhar ndeodhar added this to the v2.0 milestone Jul 15, 2019
@ndeodhar ndeodhar self-assigned this Jul 15, 2019
@ndeodhar ndeodhar removed this from the v2.0 milestone May 13, 2020
@rkarthik007 rkarthik007 added the roadmap-tracking-issue This issue tracks a major roadmap item, and usually appears in the roadmap list. label Jul 24, 2020
@rahuldesirazu
Copy link
Contributor

This is a duplicate of #10976.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docdb YugabyteDB core features roadmap-tracking-issue This issue tracks a major roadmap item, and usually appears in the roadmap list.
Projects
None yet
Development

No branches or pull requests

3 participants