Hey~!Regarding concurrent updates across DC clusters, I have a question:For the same row of a table, I have two updatesupdate1, set a = a+1update2, set a = a+1The Scylla cluster is deployed across 3DCs, where there is a 30ms network communication delay between DC02 and DC01, and between DC02 and DC03. RF=3 for each DC. We use DC02 to receive requests. Set LWT=only_rmw_uses_lwt.The UpdateItem request will be sent to Alternator. As far as I know, CL = LOCAL_QUORUM, which means that there are two replica nodes in DC02 that have completed the update, and this request can be returned.
Then, here comes the problem. Suppose update1 reaches DC02 first, and after getting returned in DC02, update2 also reaches DC02. At this time, update1 is only executed in DC02 (the delay is at the ms level), but considering the 30ms network communication delay across DC, update1 is not updated in DC01 and DC03.So, will update2 be executed immediately in DC02? Or does update2 need to wait for update1 to finish executing in DC01 and DC03 before it starts executing
?
I have read the following article, but in response to my problem, I did not draw a conclusion.
In other words, the "a = a + 1" will happen concurrently, and separately, in each region, and the last set value will eventually win - but it's the last "value", not the last "operation". You may end up seeing a incremented only once.In Alternator, we can change "LOCAL_SERIAL" to "SERIAL" if you want isolation across the entire cluster in all DCs, but again this has a big latency cost, and a high-availability cost (if a DC is down, you can't write), and again is not yet configurable without manually changing the code.
Thank you, Nadav.Your explanation is very careful.在2020年10月13日星期二 UTC+8 下午2:18:48<Nadav Har'El> 写道:In other words, the "a = a + 1" will happen concurrently, and separately, in each region, and the last set value will eventually win - but it's the last "value", not the last "operation". You may end up seeing a incremented only once.In Alternator, we can change "LOCAL_SERIAL" to "SERIAL" if you want isolation across the entire cluster in all DCs, but again this has a big latency cost, and a high-availability cost (if a DC is down, you can't write), and again is not yet configurable without manually changing the code.In the scenario described in my question, update1 and update2 go to the same data center (DC02).
The update1 request will return after having successfully written two copies on the local DC (DC02). The third replica in the local DC, and all replicas on other DCs, will be updated "eventually", but the client will not wait for them.
The update2 request will begin to write its two copies on the local DC (DC02), and there is no need to wait for update1 to update the remaining copies (The third replica in the local DC, and all replicas on other DCs).In other words, update2 will be executed immediately after update1 is returned?
Because the two update operations go to the same data center, there will be no "You may end up seeing a incremented only once." situation, right?
--Is my understanding correct?
You received this message because you are subscribed to the Google Groups "ScyllaDB users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scylladb-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scylladb-users/e0dc9a9e-011e-45e9-a069-4fc8c176cf6bn%40googlegroups.com.