我试图在同一个表中插入两个进程。因此,首先我尝试使用 LWT 输入分区和集群键值,如果成功,则意味着该进程可以在该时间桶内继续该工作,否则另一个进程已经完成该桶。LWT 设置为一致性级别 One 和串行一致性级别 LOCAL_SERIAL。
如果第一个插入成功,则工作完成,另一个插入也完成,一致性级别也为 1。第一条语句有一个 TTL 语句,用于执行工作的进程在中间终止的情况,该行在 TTL 为 90 之后将为空。
即使我运行单个进程,LWT 也会因读取或写入超时异常而失败。
这是准备好的声明和我得到的例外。任何帮助表示赞赏。
com.datastax.driver.core.exceptions.ReadTimeoutException:
Cassandra timeout during read query at consistency LOCAL_QUORUM
(2 responses were required but only 1 replica responded)
com.datastax.driver.core.exceptions.WriteTimeoutException:
Cassandra timeout during write query at consistency LOCAL_SERIAL
(2 replica were required but only 1 acknowledged the write)
statement = {DefaultPreparedStatement@10844}
preparedId = {PreparedId@10886}
query = "INSERT INTO event_store(evt_type, rcncl_date, rcncl_ts) values( ?, ?, ?) IF NOT EXISTS USING TTL 90;"
queryKeyspace = "test"
routingKey = null
consistency = {ConsistencyLevel@10882} "ONE"
serialConsistency = {ConsistencyLevel@10883} "LOCAL_SERIAL"
traceQuery = false
retryPolicy = null