Cassandra更新以几个节点静默失败

Olg*_*run 2 cassandra datastax-java-driver

我有以下情况.

有一个CQL表(Cassandra 2.0.12)

CREATE TABLE article (
  version timeuuid,
  id timeuuid,
  active boolean,
  contentbody text,
  contentformat text,
  createdat text,
  entitytype text,
  externalsources list<text>,
  geolat double,
  geolong double,
  lastcomments list<text>,
  lastmodifiedat text,
  lstmodbyuserid text,
  lstmodbyusername text,
  previewimage text,
  publishedatarticle text static,
  publishedatver text,
  status text,
  subcategory text,
  subtitle text,
  title text,
  userid text static,
  username text static,
  PRIMARY KEY ((version), id)
) WITH
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.100000 AND
  gc_grace_seconds=864000 AND
  index_interval=128 AND
  read_repair_chance=0.000000 AND
  replicate_on_write='true' AND
  populate_io_cache_on_flush='false' AND
  default_time_to_live=0 AND
  speculative_retry='99.0PERCENTILE' AND
  memtable_flush_period_in_ms=0 AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'LZ4Compressor'};
Run Code Online (Sandbox Code Playgroud)

并使用datastax-java-driver(cassandra-driver-core 2.1.1)使用它

当集群包含3个节点数据更新时,如

UPDATE article SET title='updated title2',subtitle=null,status='draft',subCategory='{"id":"a6b68330-2ef5-4267-98c5-cd793edbb1a8","name":"sub cat name","color":"blue","parentCategory":{"id":"prim_cat_id","name":"prim cat name","color":"blue"}}',contentBody='someOtherBody',contentFormat='someOtherFormat',geoLat=138782.34,geoLong=138782.34,lastModifiedAt='2015-03-02 11:14:57',publishedAtArticle=null,publishedAtVer=null,lstModByUserId='e264fb2c-2485-488a-965f-765d139be9ea',lstModByUsername='reg1 user',externalSources=[],previewImage='{"width":1,"height":2,"duration":32,"original":"orig string","thumbs":{"prefix":"prefix str","ext":"jpg","sizes":["size1","size2"]}}' WHERE version=2480d891-c0cd-11e4-a691-df79ef55172c AND id=2480d890-c0cd-11e4-a691-df79ef55172c;
Run Code Online (Sandbox Code Playgroud)

在大约一半的情况下无法正常工作(没有我在Cassandra日志中看到的错误,没有任何可疑的痕迹,没有失败的答案或异常,我可以看到它只是通过SELECT没有成功).对于来自一个节点的集群,它始终有效.

在案件调查中你能帮我指点一些方向吗?

Rom*_*kin 5

由于您提到您的节点时间不同步,因此您可能有一个罕见但仍然可能的情况.

如果节点之间的时间不同步,则可能会在更新/插入期间导致一些不可预测的结果.

通常在写入时,具有最新时间戳的那个获胜.如果你的一个节点落后时间,那么当它成为一个协调器时,它会用你的时间戳标记你的所有记录,因此决定这个更新太旧了,因为已经有其他更新的时间戳更新了(来自具有更新时间戳的节点)准确的时间).因此丢弃更新.