无法使用 cqlsh 删除或更新 Cassandra 3.11.2 中的记录
Not able to to delete or update a record in Cassandra 3.11.2 using cqlsh
我在 Cassandra 中有一个具有以下架构的列族。
CREATE TABLE app_documents (
key text PRIMARY KEY,
created_at timestamp,
created_by text,
details text,
id text
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';
CREATE INDEX app_documents_id_idx ON app_documents (id);
在这个 CF 中,我有一个键 'abc' 的记录,我能够 select 使用查询
的记录
select * from app_documents WHERE key = 'abc';
现在我正在尝试使用以下查询删除或更新它。
delete from app_documents WHERE key = 'abc';
update app_documents set created_by = 'pd' where key = 'abc';
但以上命令对记录没有影响。 table 中的其他记录按预期工作,但只有这条记录有点卡在这种状态。
我的 Cassandra 设置只有一个节点。
通常当数据库中的数据具有未来的时间戳时会发生这种情况,并且通过执行 select writetime(created_by) from app_documents WHERE key = 'abc';
确认 - 记录的时间戳为 8 月 9 日 - 未来 2 天。获得此类条目的通常原因是:
- 客户端计算机上的时钟关闭了一段时间 - 始终建议在客户端计算机上也设置
ntp
运行,而不仅仅是在 Cassandra 服务器上
- 时间戳由客户端明确设置 - 这可能会导致不可预测的行为,并且只有在需要时才应设置明确的时间戳,例如业务逻辑,但即使在这种情况下,进行一些检查也是有意义的将防止在将来插入时间戳
我在 Cassandra 中有一个具有以下架构的列族。
CREATE TABLE app_documents (
key text PRIMARY KEY,
created_at timestamp,
created_by text,
details text,
id text
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';
CREATE INDEX app_documents_id_idx ON app_documents (id);
在这个 CF 中,我有一个键 'abc' 的记录,我能够 select 使用查询
的记录select * from app_documents WHERE key = 'abc';
现在我正在尝试使用以下查询删除或更新它。
delete from app_documents WHERE key = 'abc';
update app_documents set created_by = 'pd' where key = 'abc';
但以上命令对记录没有影响。 table 中的其他记录按预期工作,但只有这条记录有点卡在这种状态。
我的 Cassandra 设置只有一个节点。
通常当数据库中的数据具有未来的时间戳时会发生这种情况,并且通过执行 select writetime(created_by) from app_documents WHERE key = 'abc';
确认 - 记录的时间戳为 8 月 9 日 - 未来 2 天。获得此类条目的通常原因是:
- 客户端计算机上的时钟关闭了一段时间 - 始终建议在客户端计算机上也设置
ntp
运行,而不仅仅是在 Cassandra 服务器上 - 时间戳由客户端明确设置 - 这可能会导致不可预测的行为,并且只有在需要时才应设置明确的时间戳,例如业务逻辑,但即使在这种情况下,进行一些检查也是有意义的将防止在将来插入时间戳