Questions tagged [distributed-transactions]

An operational bundle which consists of multiple ACID transactions, usually on multiple servers, which must all commit or roll back. A transaction manager coordinates this through two-phase commits.

600 questions
105
votes
11 answers

Unable to begin a distributed transaction

I'm trying to run SQL against a linked server, but I get the errors below : BEGIN DISTRIBUTED TRANSACTION SELECT TOP 1 * FROM Sessions OLE DB provider "SQLNCLI" for linked server "ASILIVE" returned message "No transaction is active.". Msg 7391,…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
93
votes
5 answers

How do two-phase commits prevent last-second failure?

I am studying how two-phase commit works across a distributed transaction. It is my understanding that in the last part of the phase the transaction coordinator asks each node whether it is ready to commit. If everyone agreed, then it tells them to…
Gili
  • 86,244
  • 97
  • 390
  • 689
78
votes
3 answers

Two phase commit

I believe most of people know what 2PC (two-phase commit protocol) is and how to use it in Java or most of modern languages. Basically, it is used to make sure the transactions are in sync when you have 2 or more DBs. Assume I've two DBs (A and B)…
dongshengcn
  • 6,434
  • 7
  • 35
  • 44
74
votes
5 answers

Synchronising transactions between database and Kafka producer

We have a micro-services architecture, with Kafka used as the communication mechanism between the services. Some of the services have their own databases. Say the user makes a call to Service A, which should result in a record (or set of records)…
36
votes
6 answers

What is a "distributed transaction"?

The Wikipedia article for Distributed transaction isn't very helpful. Can you give a high-level description with more details of what a distributed transaction is? Also, can you give me an example of why an application or database should perform a…
Zombie
  • 361
  • 1
  • 3
  • 4
27
votes
3 answers

Kafka - How to commit offset after every message using High-Level consumer?

I'm using Kafka's high-level consumer. Because I'm using Kafka as a 'queue of transactions' for my application, I need to make absolutely sure I don't miss or re-read any messages. I have 2 questions regarding this: How do I commit the offset to…
25
votes
4 answers

How does three-phase commit avoid blocking?

I am trying to understand how three-phase commit avoids blocking Consider the following two failure scenarios: Scenario 1: In phase 2 the coordinator sends preCommit messages to all cohorts and has gotten an ack from all except cohort A. Network…
user782220
  • 10,677
  • 21
  • 72
  • 135
23
votes
1 answer

Delivery of JMS message before the transaction is committed

I have a very simple scenario involving a database and a JMS in an application server (Glassfish). The scenario is dead simple: 1. an EJB inserts a row in the database and sends a message. 2. when the message is delivered with an MDB, the row is…
ewernli
  • 38,045
  • 5
  • 92
  • 123
21
votes
3 answers

TransactionScope: Avoiding Distributed Transactions

I have a parent object (part of a DAL) that contains, amongst other things, a collection (List) of child objects. When I'm saving the object back to the DB, I enter/update the parent, and then loop through each child. For maintainability, I've…
CJM
  • 11,908
  • 20
  • 77
  • 115
20
votes
6 answers

Why is 2-phase commit not suitable for a microservices architecture?

I've read a post saying that: We can not implement traditional transaction system like 2 phase commit in micro-services in a distributed environment. I agree completely with this. But it would be great if someone here can explain the exact…
20
votes
7 answers

The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server was unable to begin a distributed transaction

I'm trying to run a distributed transaction from my machine (SQL Server 2012) to a client server (SQL Server 2008). I'm trying to run: begin distributed transaction select * from [172.01.01.01].master.dbo.sysprocesses Commit Transaction and I…
Cameron Castillo
  • 2,712
  • 10
  • 47
  • 77
19
votes
1 answer

EF: db.SaveChanges() vs dbTransaction.Commit

I am fairly new to entity framework and I have a doubt on EF's db.SaveChange. From some posts and MSDN I learned that db.SaveChange by default does all the changes in transaction. Also there is a way we can create a transaction of our own using…
18
votes
1 answer

Three phase commit

I understand that three phase commit was made to solve the problem of "two phase commit" when in the second phase the coordinator and the cohort fails at the same time it is impossible to know if the coordinator had decided on a commit…
Ken
  • 365
  • 1
  • 6
  • 16
17
votes
3 answers

How to design global distributed transaction(none database)? Can JTA use for none db transaction?

I think this is a fairly common question: how to put my business logic in a global transaction in distributed systems environment? Cite an example, I have a TaskA containing couples of sub tasks: TaskA {subtask1, subtask2, subtask3 ... } each of…
zx_wing
  • 1,918
  • 3
  • 26
  • 39
17
votes
4 answers

How ACID is the two-phase commit protocol?

I came across a situation where I started doubting whether the two-phase commit protocol really guarantees the ACID properties, especially the 'A' part of it. Let's look at a theoretical distributed transaction involving 2 resources. (More practical…
1
2 3
39 40