--
You received this message because you are subscribed to the Google Groups "CockroachDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cockroach-db...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cockroach-db/CAOk%2BzfcLGOwYqcTpGHpdT%3DkHdmJ94tTD2SD_FiEr%2BvBUNe3sDQ%40mail.gmail.com.
1. Detect the status of the transaction txn1 by inspecting the Transaction record. (In this case it was committed). So send PushTxnRequest to the key range owning the Transaction record.2. Resolve the write intent.
Thanks, this is useful. So the TxnCoordSender which detects an incomplete write intent. it will first complete that previous transaction and then restart the ongoing transaction right?Consider the following scenario.TxnCoord1ID txn1write 'name' 'Alice'write 'title' 'Nitroservices'while committing, if txn1 fails after storing the Transaction record with state 'committed', but before resolving the write intent.TxnCoord2ID txn2write 'color' 'blue'write 'title' 'Microservices'In this case the write to 'title' detects an unresolved write intent. So it needs to do two things.1. Detect the status of the transaction txn1 by inspecting the Transaction record. (In this case it was committed). So send PushTxnRequest to the key range owning the Transaction record.2. Resolve the write intent.After this is done, restart txn2.Looking at the code, it looks like this is how it will work. Right?
Hi Andrei,Parallel commit and the Transaction record in STAGING state is interesting. I see that before the parallel commit feature was implemented, there was no need for storing keys for all the writes in the Transaction record and the write intents could be resolved for each key independently by the future transactions touching a specific key.
Not sure if there were some subtle issues with this? Particularly with interleaving read-write and read-only transactions? (Possibly not, depending on when the push transaction requests are considered successful. If they always succeed for the Transaction record which is marked either Aborted or Committed by earlier PushTxnRequest, the write intents will always be resolved)
I see that parallel commit was done specifically to reduce the latency caused by waiting for two round trips (one for writing the transaction record and one for the actual key value (which happens in parallel for multiple keys)).
The same could be achieved if the Transaction record keeps track of all the keys, and adding the state PREPARING_TO_COMMIT / ABORT before COMMIT, and then delegate the responsibility of resolving the intents to the leader of the range holding the Transaction record? The leader of that range can always keep trying sending ResolveWriteIntent requests. It can also keep track of transactions which are preparing to commit or preparing to abort when the leader failover happens, and keep sending the ResolveWriteIntent requests. The use of the STAGING state does something similar I guess, But I was just thinking, what if the range holding the Transaction record acts as a transaction coordinator?
That doesn't sound right. I think we always had the lock_spans field (used to be called intent_spans) in the Transaction proto. I think the transaction record for a finalized transaction always contained enough information to cleanup all intents.
On Mon, Sep 13, 2021 at 8:31 PM Andrei Matei <and...@cockroachlabs.com> wrote:That doesn't sound right. I think we always had the lock_spans field (used to be called intent_spans) in the Transaction proto. I think the transaction record for a finalized transaction always contained enough information to cleanup all intents.The intent spans will be populated only on the EndTransaction request. And I think they are important to make sure committed transaction records are not garbage collected before all the affecting intents are resolved? So if there is no GC, it is ok to just have a transaction record with transaction status, and all the pending write intents can be independently resolved by the subsequent (read or write) transactions which involve the keys of the pending intents.