3 ms·
> There are in fact distributed transactions, and cross shard joins. You can in fact do full cross shard ACID transactions. The Vitess docs explicitly say that
by evanweaver 7y ago
> There are in fact distributed transactions, and cross shard joins. You can in fact do full cross shard ACID transactions.
The Vitess docs explicitly say that 2PC transactions are not isolated and are not ACID.
Did something change?
- dkhenry 7y agoWe will normally list it as ACI*D since there is a situation where you can break isolation.
- evanweaver 7y agoWhat situation? Are cross-shard transactions ever isolated?
- dkhenry 7y agoYes they are normally isolated, however its only at a READ_COMMITTED level, and a nuance of the implementation is that you may see committed data rolled back by the protocol in the event of a failure. Its still technically READ_COMMITTED, but its an unexpected behavior from stock MySQL so we make sure to qualify our documentation.
- kd5bjo 7y agoI may be just tripping over semantics here, but how can you consider data that may still be automatically rolled back to be “committed”? I thought that’s supposed to mean the data has been fully stored such that it can only be changed/removed by a subsequent transaction.
- dkhenry 7y agoThe data will be committed, but you may get a subsequent read that has the previous value, before it is overwritten by the final value. This would only occur if the shard where the commit is occurring fails, while the promoted shard replays the transaction before the final commit is propagated to the user. Since the shard as failed is impossible for a single transaction to experience this behavior, but an outside observer would be able to see this behavior. Transactionally everything would still be isolated, but outside the transaction you would see behavior you won't expect.
- evanweaver 7y agoWhat you describe is read uncommitted. From your own docs: > A third party that performs cross-database reads can observe partial commits while a 2PC transaction is in progress. Regardless of rollback status, the in-flight transaction will not be observed correctly across shards, for example, with a cross-shard join. It doesn't matter what the consistency guarantee within a shard is; this is not ACID nor is it serializable.
- dkhenry 7y agoIts not, its still read committed. Its the same thing as if you had to read from two rows in a transaction, and your isolation was read committed, and both those rows would be modified by a different transaction. Its possible you read the first row, a transaction is committed and then you read the second row with the updates from the transaction. You have just read a partial commit. It is ACID and it is not serializable, the thing is MySQL lets you use higher levels of isolation like repeatable read or serializable which are very useful and today Vitess can't guarantee that in a 2PC.