我們正在使用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