Cassandra: Query answers 500 on a partition whose items were all deleted
维护者通常 4 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 crates/storage-cassandra/src/data/query.rs 开始,其中结果循环调用 cassandra_util::get_column(&row, "item_data", "query parse")?,并在 delete_item.rs 留下的仅含静态数据的行上失败。在那里跳过 item_data 为 null 的行,并检查 Scan 读取是否有相同的循环。当对完全被删除的分区执行 Query 时,无论是否带 ConsistentRead,都返回 Count: 0,并通过 tests/ 中的双目标测试证明,即为完成。
由索引模型根据 Issue 内容生成。
描述
On the Cassandra backend, a Query whose partition key names a partition that held items, all of which have since been deleted, answers 500 InternalServerError instead of an empty result. Amazon DynamoDB answers 200 with Count: 0.
Reproduction
A table with a hash key pk (S) and a range key sk (S), on a local Cassandra 4.1 node:
PutItem{"pk": "a", "sk": "1"}.Querywithpk = :p,:p = "a":Count: 1.DeleteItem{"pk": "a", "sk": "1"}.- The same
Query, withConsistentReadfalse and true: both answer500 {'Code': 'InternalServerError', 'Message': 'Internal server error'}.
A conditional delete (attribute_exists(pk)) in step 3 gives the same result. The server logs:
ERROR extenddb_storage_cassandra::cassandra_util: query parse parse column 'item_data': General error: Column or Udt property 'item_data' is empty
Where
crates/storage-cassandra/src/data/delete_item.rs writes partition_max_delete_timestamp before it deletes the row (update_partition_max_delete_timestamp_at). On a table with a sort key that column is STATIC (ddl.rs), so once the last item is gone the partition still holds a row with only the static column set. The Query path in crates/storage-cassandra/src/data/query.rs reads item_data from every row it gets back with cassandra_util::get_column(&row, "item_data", "query parse")?, which fails on that static-only row.
Seen on main (5ff323beb) and on the branch of #424; the reproduction above was run against the #424 branch.
Suggested fix
Skip rows whose item_data is null in the Query (and Scan, if it has the same read) result loop, as rows with no item, rather than failing the request.
Test
A dual-target test in tests/ that puts one item, deletes it and asserts that a Query of its partition answers Count: 0, with and without ConsistentRead.
- 主要语言
- Rust
- 星标
- 517
- 派生
- 60
- 平均合并
- 5 天 4 小时
- 30 天内合并 PR
- 76
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ExtendDB/extenddb 的其他 Issue
-
ci:stability sqlite
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 4 天内回复
-
backend:cassandra ci:stability
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 4 天内回复
查看 ExtendDB/extenddb 的全部 Issue
相似的 Issue
-
bug i18n priority: medium ui
难度 2/5 1-3 小时 新手友好度 65/100
storytold/craft-anything#983 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
Dinnerbone/Rascal#91 · 2 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 76/100
higress-group/HiRoute#405 ·
维护者通常 1 天内回复
-
rust_analyzer flycheck: no CLI way to enable clippy from `check.overrideCommand`可能已有人在做 @TrapsterDK 今天认领。 未关闭needs-triage
难度 2/5 1-3 小时 新手友好度 77/100
bazelbuild/rules_rust#4392 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复