我们正在使用Cassandra的卡桑德拉空细胞!=墓碑细胞计数
cqlsh 5.0.1 | Cassandra 2.1.14.1272 | DSE 4.8.7 | CQL spec 3.2.1
我们有大约> 60万行,其中我们已经插在大多数细胞的NULL此行。我们运行一个查询,扫描8000行,日期为昨天,今天,明天。 然而,当我启用跟踪我只发现:
Read 101 live and 997 tombstone cells [SharedPool-Worker-1] | 2017-04-20 11:05:02.901000 | 10.74.70.30 | 11297
我知道,在卡桑德拉插入空值的那些细胞创建墓碑,但我为什么只能看到即使查询将返回8K记录,每个记录保持这样几个墓碑多个NULL?什么都可以解释这个?这些记录的TTL默认为30天,因此这个8k的结果集由于TTL而不能有墓碑。
编辑1
我的模式是:
CREATE TABLE transportation_events.events_for_load_ops_exceptions (
exception_phase text,
exception_date text,
event_id timeuuid,
actual_delivery_ts timestamp,
actual_pickup_ts timestamp,
carrier_due_ts timestamp,
carrier_id text,
carrier_mode text,
carrier_pickup_ts timestamp,
dest_loc_banner_code text,
dest_loc_class_code int,
dest_loc_id int,
dest_loc_name text,
dest_loc_type text,
dest_time_zone text,
destination_city text,
destination_postal_code text,
destination_state text,
destination_street_addr text,
exception_type text,
late_reason_code text,
load_id text,
load_type text,
loc_time_zone text,
orig_loc_id int,
orig_loc_name text,
orig_loc_type text,
orig_time_zone text,
origin_city text,
origin_postal_code text,
origin_state text,
origin_street_addr text,
reason_code_category text,
reason_code_desc text,
scheduled_delivery_ts timestamp,
scheduled_pickup_ts timestamp,
status_reason_code text,
stop_loc_id int,
stop_loc_name text,
stop_loc_type text,
stop_seq_num int,
stop_type text,
triggered_by text,
PRIMARY KEY ((exception_phase, exception_date), event_id)
) WITH CLUSTERING ORDER BY (event_id DESC)
而现在的储蓄卡桑德拉由
import com.datastax.driver.mapping.Mapper;
mapper.save(resultRecord);
我可以通过CQL是已插入的NULL看到。
查询我跟踪
select * from transportation_events.events_for_load_ops_exceptions where exception_phase='PLANNING' AND exception_date IN ('2017-04-19','2017-04-20','2017-04-21');
也许压实已删除大部分的墓碑?还有其他解释吗? 编辑2 如果有一种方法可以总结和查看墓碑及其原因,一次查询的共同点?像桌子上的墓碑转储一样?
你的表的模式是什么? – DineMartine
你究竟如何插入NULL值?据我所知,NULL在使用预处理语句时只会导致逻辑删除,因为Cassandra无法区分“未设置”参数和NULL参数。 C *版本<= 2.2.0允许您向insert语句提示提示C *将[NULL置为未设置](https://issues.apache.org/jira/browse/CASSANDRA-7304)。 – Ralf
使用dse API中的mapper.save自动插入NULL。当我使用CQLSH查询行时,我可以看到NULL。 – Tanvi