gpt4 book ai didi

cassandra - 从 Cassandra 计数器列族中删除整行

转载 作者:行者123 更新时间:2023-12-01 02:21:20 26 4
gpt4 key购买 nike

我们有 counter column family ,类似这样:
创建列族访问_counter_cf
使用 key_validation_class =UTF8Type
和比较器 = 'CompositeType(LongType, LongType, UTF8Type)'
和 default_validation_class=CounterColumnType;

当我们在 CLI 中从这个列族(我们使用 Hector)中删除一行时,它看起来被删除了
但是当我们增加同一行(相同的行键)中的计数器时,它会继续从先前的计数器值(删除前的值)增加计数器。
请帮助理解这种行为,

最佳答案

当前的 Cassandra 计数器实现有许多严重的限制。其中之一是已删除列(或已删除行中的列)的增量被视为未定义行为。来自 Cassandra counters wiki page :

Counter removal is intrinsically limited. For instance, if you issue very quickly the sequence "increment, remove, increment" it is possible for the removal to be lost (if for some reason the remove happens to be the last received messages). Hence, removal of counters is provided for definitive removal only, that is when the deleted counter is not increment afterwards. This holds for row deletion too: if you delete a row of counters, incrementing any counter in that row (that existed before the deletion) will result in an undetermined behavior.



简而言之,您不应该尝试在计数器列族中重复使用已删除的行。

关于cassandra - 从 Cassandra 计数器列族中删除整行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20272009/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com