0

It seems to be the bug for me,

1) I created a keyspace with replication factor as '3'

 CREATE KEYSPACE IF NOT EXISTS replicationtest WITH replication = {'class':'SimpleStrategy','replication_factor' : 3};

NOTE: This is a single node cluster, still I kept the replication factor as 3, so that I will add new nodes to the cluster later

2) I set the consistency level as ONE

 cqlsh:replicationtest> CONSISTENCY ONE

3) I created a 'testtable'

CREATE TABLE IF NOT EXISTS testtable("partitionId" text, "name" text, "value" text, primary key ("partitionId","name"));

4) Now I tried simple INSERT query

INSERT INTO testtable("partitionId", "name", "value") VALUES ('testtable','testname', 'testvalue');

THIS IS WORKING AS EXPECTED Since the consistency LEVEL is ONE

5) Now I tried INSERT query with LWT (IF NOT EXISTS)

INSERT INTO testtable("partitionId", "name", "value") VALUES ('testtable','testnameanew', 'testvaluenew') IF NOT EXISTS; 

NOW IT FAILED WITH NoHostAvailable: ERROR

Could someone explain how to fix this ? How to execute this LWT with consistency as 1 ?

4

1 回答 1

1

Lwt 在后台使用串行一致的电平,并且由于 RF 为 3 ,它期望 s 2 节点启动。因此,操作按预期失败。阅读内容以获取更多信息。

于 2018-10-31T07:57:36.637 回答