2

在 Cassandra 中截断计数器列族时,计数器是否会受到与仅删除单个列或行相同的限制?

我是否必须删除列族并重新创建它以完全清除它,或者我应该很好地截断它?

4

1 回答 1

5

The issue is the same: if you are doing simultaneous deletes or truncates and increments, the result is undefined.

The issue is that delete is effectively setting the counter value to zero. Truncate is setting all counter values to zero. The 'set' operation does not commute with the 'inc' operation, so a mixture of simultaneous operations gives unpredictable results.

If you aren't doing increments or can pause them, then it is perfectly safe doing a truncate. There is no need to drop the column family. If you cannot stop the increments then it depends on your client. Dropping the column family will cause the client to fail until it is recreated - if the client can survive those errors and then continue that might work. But the best would be to temporarily pause the increments.

于 2013-06-26T11:21:23.453 回答