2 phase commit in CockroachDb

95 Views Asked by At

I don't want to write a long and complicated question. Is it possible to do 2 phase commits in CockroachDb natively similar to how it is done in Postgres?

How do we do it in Postgres?

PREPARE TRANSACTION transaction_id

Whether it is good or bad (vacuum issues) is irrelevant, this question is about whether it is supported or not. CockroachDB documentation talks about distributed transactions and 2 phase commits but I have not found a single code example. The reason why I am asking this question about CockroachDb is that it has a very interesting High Availability design which is based on Raft and Gossiping.

Any idea if that can be done in CockroachDB?

1

There are 1 best solutions below

0
JaneXing1998 On

Reposting answer from @rafiss:

there was some confusion here. The linked answer is talking about a different thing that we call "two-phase commit" internally in the CockroachDB codebase. CockroachDB does not support the two-phase commit protocol that Postgres has, described here.