Re: what's the read cl of list read-on-write operations?
> ​Given the rf is 3, r/w cl is quorum. > Initially, the list is empty, the user appends one element into the list: > list += [foo] > Then node A is down, and the user prepends another element: list = [bar] + list Then A comes back, assuming the list on A is still [foo], and the list on nodeB and nodeC is [bar, foo] > The user needs to modify the first element: > list[0] = foobar > Then what happens? > A modifies the foo to foobar, and B/C modifies bar to foobar? > Then when they are repaired, the final list version becomes: > [foobar, foobar]? It will read from other replicas up to the CL (as you've pointed out). It merges the results of the reads with the update you make and should generate the correct output. There should be a timestamp associated with each cell, and when it does the merge B's [bar] will win, and the result should be [foobar, foo]. I haven't tested this but should be the overall result after repair.
Re: what's the read cl of list read-on-write operations?
But it seems that it uses cl to read list from cluster just like I said: https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java#L398 2018-04-20 16:12 GMT+08:00 DuyHai Doan : > The read operation on the list column is done locally on each replica so > replication factor does not really apply here > > On Fri, Apr 20, 2018 at 7:37 AM, Jinhua Luo wrote: >> >> Hi All, >> >> Some list operations, like set by index, needs to read the whole list >> before update. >> So what's the read consistency level of that read? Use the same cl of >> the setting for the normal read? >> >> - >> To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org >> For additional commands, e-mail: user-h...@cassandra.apache.org >> > - To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org For additional commands, e-mail: user-h...@cassandra.apache.org
Re: what's the read cl of list read-on-write operations?
Let me clarify my question more: Given the rf is 3, r/w cl is quorum. Initially, the list is empty, the user appends one element into the list: list += [foo] Then node A is down, and the user prepends another element: list = [bar] + list Then A comes back, assuming the list on A is still [foo], and the list on nodeB and nodeC is [bar, foo] The user needs to modify the first element: list[0] = foobar Then what happens? A modifies the foo to foobar, and B/C modifies bar to foobar? Then when they are repaired, the final list version becomes: [foobar, foobar]? 2018-04-20 21:56 GMT+08:00 DuyHai Doan : > The inconsistency scenario you describe can occur for sure > > Now repair (read repair, consistent read + weekly repair) is there to fix it > > "Why Cassandra do not read from cluster with somehow read CL before > updating the list?" > > Because read-before-write on the cluster level is an anti-pattern. > > The read-before-write at local storage is somehow already an anti-pattern. > That's why it's recommended to avoid using list as much as possible > > > > > On Fri, Apr 20, 2018 at 1:01 PM, Jinhua Luo wrote: >> >> Do you confirm it just reads the local storage? If so, I have a question: >> >> Think that, the user reads the list using QUORUM CL, e.g. the value is >> {a,b,c}, then, it wants to set the second item b. >> It sends such write request to some coordinator, but that coordinator >> has outdated version in its local storage, >> let's say it's {a,d}, then the item to set finally is not b but d, >> which is unexpected from the perspective of the previous read. >> >> Why Cassandra do not read from cluster with somehow read CL before >> updating the list? >> >> >> 2018-04-20 16:12 GMT+08:00 DuyHai Doan : >> > The read operation on the list column is done locally on each replica so >> > replication factor does not really apply here >> > >> > On Fri, Apr 20, 2018 at 7:37 AM, Jinhua Luo wrote: >> >> >> >> Hi All, >> >> >> >> Some list operations, like set by index, needs to read the whole list >> >> before update. >> >> So what's the read consistency level of that read? Use the same cl of >> >> the setting for the normal read? >> >> >> >> - >> >> To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org >> >> For additional commands, e-mail: user-h...@cassandra.apache.org >> >> >> > >> >> - >> To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org >> For additional commands, e-mail: user-h...@cassandra.apache.org >> > - To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org For additional commands, e-mail: user-h...@cassandra.apache.org
Re: what's the read cl of list read-on-write operations?
The inconsistency scenario you describe can occur for sure Now repair (read repair, consistent read + weekly repair) is there to fix it "Why Cassandra do not read from cluster with somehow read CL before updating the list?" Because read-before-write on the cluster level is an anti-pattern. The read-before-write at local storage is somehow already an anti-pattern. That's why it's recommended to avoid using list as much as possible On Fri, Apr 20, 2018 at 1:01 PM, Jinhua Luo wrote: > Do you confirm it just reads the local storage? If so, I have a question: > > Think that, the user reads the list using QUORUM CL, e.g. the value is > {a,b,c}, then, it wants to set the second item b. > It sends such write request to some coordinator, but that coordinator > has outdated version in its local storage, > let's say it's {a,d}, then the item to set finally is not b but d, > which is unexpected from the perspective of the previous read. > > Why Cassandra do not read from cluster with somehow read CL before > updating the list? > > > 2018-04-20 16:12 GMT+08:00 DuyHai Doan : > > The read operation on the list column is done locally on each replica so > > replication factor does not really apply here > > > > On Fri, Apr 20, 2018 at 7:37 AM, Jinhua Luo wrote: > >> > >> Hi All, > >> > >> Some list operations, like set by index, needs to read the whole list > >> before update. > >> So what's the read consistency level of that read? Use the same cl of > >> the setting for the normal read? > >> > >> - > >> To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org > >> For additional commands, e-mail: user-h...@cassandra.apache.org > >> > > > > - > To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org > For additional commands, e-mail: user-h...@cassandra.apache.org > >
Re: what's the read cl of list read-on-write operations?
Do you confirm it just reads the local storage? If so, I have a question: Think that, the user reads the list using QUORUM CL, e.g. the value is {a,b,c}, then, it wants to set the second item b. It sends such write request to some coordinator, but that coordinator has outdated version in its local storage, let's say it's {a,d}, then the item to set finally is not b but d, which is unexpected from the perspective of the previous read. Why Cassandra do not read from cluster with somehow read CL before updating the list? 2018-04-20 16:12 GMT+08:00 DuyHai Doan : > The read operation on the list column is done locally on each replica so > replication factor does not really apply here > > On Fri, Apr 20, 2018 at 7:37 AM, Jinhua Luo wrote: >> >> Hi All, >> >> Some list operations, like set by index, needs to read the whole list >> before update. >> So what's the read consistency level of that read? Use the same cl of >> the setting for the normal read? >> >> - >> To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org >> For additional commands, e-mail: user-h...@cassandra.apache.org >> > - To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org For additional commands, e-mail: user-h...@cassandra.apache.org
Re: what's the read cl of list read-on-write operations?
The read operation on the list column is done locally on each replica so replication factor does not really apply here On Fri, Apr 20, 2018 at 7:37 AM, Jinhua Luo wrote: > Hi All, > > Some list operations, like set by index, needs to read the whole list > before update. > So what's the read consistency level of that read? Use the same cl of > the setting for the normal read? > > - > To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org > For additional commands, e-mail: user-h...@cassandra.apache.org > >
what's the read cl of list read-on-write operations?
Hi All, Some list operations, like set by index, needs to read the whole list before update. So what's the read consistency level of that read? Use the same cl of the setting for the normal read? - To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org For additional commands, e-mail: user-h...@cassandra.apache.org