带有更新查询的Cassandra问题

2024-10-04 01:35:46 发布

您现在位置:Python中文网/ 问答频道 /正文

Cassandra无法更新列表(uuid)列类型,但其他列可以更新更新了。这个当我们在Python中第一次插入然后更新时发生,但是如果我们在update查询之前设置了sleep,那么更新查询可以更新列表(uuid)列。 这可能是什么原因?在

更新查询很简单:

update a set tids = [d181cf28-1e60-4120-92c4-902dfec88a4c] where cid=d181cf28-1e60-4120-92c4-902dfec88a4a and did=e3e8ac10-47b4-48b6-9b72-302a1d98456d and cname='m_2017' and vn=0 IF EXISTS 

Tags: and类型列表uuidupdate原因sleepwhere
1条回答
网友
1楼 · 发布于 2024-10-04 01:35:46

最后,我在卡桑德拉的文档中找到了答案:

https://docs.datastax.com/en/cassandra/3.0/cassandra/dml/dmlLtwtTransactions.html

在我的场景中,事务的顺序是

Delete (Without if exist) -> Insert(Without if not exist) -> Update(With if exist).

在这个序列中,最后一次更新是轻量级的交易。所以如果我们让整个序列变得轻量级,那么它就解决了问题。其他有时这个序列工作正常,有时无法更新行。在

相关问题 更多 >