Questions tagged [two-phase-commit]
17 questions
6
votes
1 answer
Using two phase commits on Postgres
Assuming that a have a table called "t1" in a "db1" and other table called "t2" in a "db2", and I need to insert a record on both tables or fails.
Connected to db1, I guess I shall type this:
BEGIN;
PREPARE TRANSACTION 'pepe'; -- this says the…

Victor
- 3,841
- 2
- 37
- 63
4
votes
1 answer
Difference between 2PC (2 phase commit) and 2 PL (2 phase locking)
What is the difference between the two? The protocol on the surface looks different, but I would like to understand what is really different between the two and why they are not equivalent.

user855
- 19,048
- 38
- 98
- 162
2
votes
1 answer
Manipulating order of XA resources
Is there a way to manipulate the order of executing the registered XAResources within a transaction for quarkus?
In my scenario I have a database datasource and an ActiveMQ resource within the XA transaction configured. For me it seems that there is…

Michael
- 41
- 4
2
votes
0 answers
Flink two phase commit for map function to implement exactly-once semantics
Background:
We have a Flink pipeline which consists of multiple sources, multiple sinks and multiple operators along the pipeline which also update databases.
For the sake of the question and to make it simpler let's assume we have a pipeline which…

Slava Shpitalny
- 3,965
- 2
- 15
- 22
1
vote
1 answer
Achieve "all-or-nothing" transaction between Oracle and MongoDB
I have an usecase(migrate data from Oracle to MongoDB via Java app) where I required to implement transaction management to ensure "all-or-nothing" in the datastore.
Read the input data from Oracle Table (eg: sourcetable).
Execute two separate…

Mohan
- 3,893
- 9
- 33
- 42
1
vote
1 answer
concurrent program using simple two phase locking
Problem: I want to compute concurrently some equations using the so-called two-phase locking concept.
My approach: Create an array that will update in real time values of each variables. I am a bit stuck in the way I should create threads , apply…

user12392864
- 288
- 1
- 3
- 11
1
vote
1 answer
Two phase commit: what happens if the coordinator dies between sending two confirmations
I am trying to understand how two phase commit protocol works and I hit an issue that is unclear to me.
Let's say that the coordinator sent two requests for commit and both recipients acknowledged. Now it starts sending commit requests, but between…

gruszczy
- 40,948
- 31
- 128
- 181
1
vote
1 answer
Is 2-Phase commit safe or not
I find many readings that say 2PC is safe, which means it will either commit a transaction or rollback. More specifically, [If one commits, no one aborts; If one aborts, no one commits].…

calvin
- 2,125
- 2
- 21
- 38
0
votes
0 answers
How to perform update operations in distributed transaction before two-phase commit?
Most discussions about two-phase commit only talks about how to commit, but they don't talk about how to update/delete/insert data before commit. Do those operations also involve two phases? Do they require the coordinator to log? What happens if…

Zuchao Wang
- 19
- 3
0
votes
0 answers
Canceling a transaction through API
I'm developing a system that contains multiple microservices operating on the same database, which isn't ideal but is done for the sake of legacy support. As we refactored the old system we split old, transactional functionality into separate…

MrLinjak
- 65
- 7
0
votes
0 answers
Does Two Phase Commit mean all the Participant database updates have to use Pessimistic Locking?
I'm referring to the scenario of applying 2PC to heterogenous distributed transactions. Say I want to write to both database A and database B together in atomic fashion. Now reads and writes to database A and B each themselves could be from multiple…

Superziyi
- 609
- 1
- 9
- 30
0
votes
1 answer
Generic ResourceManager/IEnlistmentNotification for Azure Blob Storage operations to achieve 2 phase commit
My application using Azure SQL and Azure Blob Storage for some business requirements, most of the case need to support Atomic Transaction for both DB & Blob, if DB entry fails should rollback Blob as well(go all or no go), for DB side can use…

Kalaivanan2k4
- 37
- 5
0
votes
0 answers
How many message delays does two-phase locking requires to commit a txn in normal case?
I read some tutorials on two-phase commit
https://www.cs.cmu.edu/~dga/15-440/F10/lectures/Concurrency-Control.pdf [Slide 27]
It seems that, when there are multiple shards [participants], it needs 4 message delays for the coordinator to commit the…

steamgjk
- 11
- 1
0
votes
1 answer
Is Two Phase Commit suitable to ensure atomicity when sending an email?
Let's say I need to run some queries AND send an email in an atomic way.
A typical example is for a user sign-up form, I need to create the user and send the welcome email.
I can use a transaction :
begin transaction
create user
if creation failed,…

Emmanuel Meric de Bellefon
- 2,319
- 1
- 11
- 25
0
votes
1 answer
How to rollback child transaction if any exception in parent transaction?
I have two transaction manager for two database. I need to persist same data into both databases. If one transaction failed, other one need rollback. I have done like below
public interface DataService {
void saveData();
}
@Service
public class…

Sangeetharaj
- 169
- 3
- 14