Cassandra: Query answers 500 on a partition whose items were all deleted

オープン 初心者向け
#795 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
databases

調査の方向性

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:

  1. PutItem {"pk": "a", "sk": "1"}.
  2. Query with pk = :p, :p = "a": Count: 1.
  3. DeleteItem {"pk": "a", "sk": "1"}.
  4. The same Query, with ConsistentRead false and true: both answer 500 {'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日 1時間
マージ済み PR(30日)
67

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ExtendDB/extenddb のほかの issue

ExtendDB/extenddb の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。