我想了解以下方案的笨拙行级交易的工作方式?
假设行具有键'k'和作为元素集的值{e1,e2}
案例a)请求使用键'k'读取行,并将值e3附加到当前集{e1,e2,e3}
案例b)读取b读取键'k'的行,并将值e4附加到当前集{e1,e2,e4}
最终是{{e1,e2,e3,e4}
q1)。案例A或情况B中提到的请求失败了,如果由于行级交易而试图同时更新行的两个请求?
Q2)如果附加操作之间存在延迟,那么在后续更新中,预先更新很有可能会被覆盖吗?
Q3)如果以上是肯定的,我们正在考虑有条件的写作以实现我们想要的东西。例如,对于案例b)我们将使用前条件(checkandmutaterow)作为{e1,e2}的值。但是,我们的价值是一个字节值表示的bitset,它可能具有KBS的大小,并且担心具有此类尺寸的性能。我知道我们可以在每个单元格中存储时间戳,同时更新该单元格的值,并想知道我们是否可以将单元格值的时间戳作为前条件?如果没有,我们可以将显式更新的_TS作为单独的单元格保持。
Q4)我们可以使用批处理条件写入示例()和lib似乎不支持BACH条件写作
I would like to understand how BigTable row level transactions work for the following scenario?
Lets say row has the key 'k' and the value as set of elements {E1, E2}
case a) Request A read the row with key 'k' and appends the value E3 to the current set {E1, E2, E3}
case b) Read B read the row with key 'k' and appends the value E4 to the current set {E1, E2, E4}
What we want eventually is {{E1, E2, E3, E4}
Q1) Does one of the requests mentioned in the case a or case b fail if both of the requests trying to update the row at the same time because of the row level transaction ?
Q2) If there is a delay between the append operations, is there a good chance that the preceeding update will be overwritten with the subsequent update right ?
Q3) If the above is yes, we are considering conditional write to achieve what we want. For example for case b) we will use pre-condition (CheckAndMutateRow) for the value as {E1, E2}. However our value is a bitset represented in byte value that could have size in kbs and concerned about performance with such sizes. I understand that we could store the timestamp with each cell while updating the value for that cell and wondering if we could use the timestamp of the cell value as the pre-condition? If not, we can maintain the explicit updated_ts as the separate cell.
Q4) Could we use batch conditional write as the example (https://cloud.google.com/bigtable/docs/samples/bigtable-writes-conditional) and lib doesn't seem to support bach conditional write
发布评论
评论(1)
我不确定现在所有内容的答案,但是这里有一些信息可以帮助您入门。
附加和增量是按顺序应用的原子操作。如果两个操作是同时发送的可能只是按某种顺序应用它们。
如果您在操作之间添加延迟,则第二个将随后附加 - 是的,但是不会有任何覆盖,它只会将字节附加到现有的单元格值。
I'm not sure the answers to everything right now but here is some info that might help you get started.
Appends and increments are atomic operations that are applied in order. If both operations are sent at the same time it is possible to get {E1,E2,E3,E4} as a result but also {E1,E2,E4,E3}, but I don't think it would fail, it would probably just apply them in some order.
If you add a delay between operations, the second would be appended afterwards – yes, but there wouldn't be any overwriting it would just append the bytes to the existing cell value.