Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

UpdateItem: an empty secondary-index key sent through legacy AttributeUpdates gets the UpdateExpression wording on every backend

Đang mở
#423 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cassandra, mongodb, postgresql, python, rust, sqlite
Lĩnh vực
backend, databases

Hướng nghiên cứu

Read the four UpdateItem call sites in crates/storage-sqlite/src/data/update_item.rs, crates/storage-postgres/src/data/update_item.rs, crates/storage-cassandra/src/data/update_item.rs, and crates/storage-mongodb/src/data_engine.rs, plus the context definition in crates/core/src/validation/mod.rs. Check how maps.legacy_attribute_updates is set in crates/engine/src/update_item.rs, then add the string, binary, LSI, and absent-item cases to tests/test_index_key_validation_on_update.py. Done when those cases match the service across all four backends.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Observed

Found in the review of #416. When UpdateItem sets a secondary-index key to an empty string or binary through the legacy AttributeUpdates parameter, the service answers with the PutItem form of the message, which names the index and the key. ExtendDB answers with the UpdateExpression form, which names neither.

UpdateItem AttributeUpdates {"gs": {"Action": "PUT", "Value": {"S": ""}}}    (gs is the key of gs-index)
  service:  400 ValidationException | One or more parameter values are not valid. A value specified for a secondary index key is not supported. The AttributeValue for a key attribute cannot contain an empty string value. IndexName: gs-index, IndexKey: gs
  ExtendDB: 400 ValidationException | One or more parameter values are not valid. The update expression attempted to update a secondary index key to a value that is not supported. The AttributeValue for a key attribute cannot contain an empty string value.

The same holds for a binary key (gb, gb-index), an LSI key (ls, ls-index), and for an item that does not exist yet. Type mismatches sent through AttributeUpdates already match the service, which uses the expression wording for those.

Measured on Cassandra against the service. SQLite, PostgreSQL and MongoDB pass the same context at their own call sites (below) and were not measured separately.

Reading of the code

The engine desugars AttributeUpdates into an UpdateExpression (crates/engine/src/update_item.rs, desugar_attribute_updates) and records the request form in ExpressionMaps::legacy_attribute_updates (line 150), which the item-size rule reads. The storage layers receive maps and pass SecondaryIndexEmptyContext::UpdateExpression unconditionally when they check the written index keys:

  • crates/storage-sqlite/src/data/update_item.rs:97
  • crates/storage-postgres/src/data/update_item.rs:211
  • crates/storage-cassandra/src/data/update_item.rs:174
  • crates/storage-mongodb/src/data_engine.rs:1888

The Item variant already produces the service's PutItem wording (crates/core/src/validation/mod.rs:1491).

Fix direction

At the four sites, select SecondaryIndexEmptyContext::Item when maps.legacy_attribute_updates is set. Add the legacy cases (string, binary, LSI, absent item) to tests/test_index_key_validation_on_update.py and run them against the service and all four backends. Depends on #416 for the test file.

Reproduce

aws dynamodb update-item --endpoint-url https://127.0.0.1:8000 --table-name t \
  --key '{"pk": {"S": "a"}}' \
  --attribute-updates '{"gs": {"Action": "PUT", "Value": {"S": ""}}}'
Ngôn ngữ chính
Rust
Star
517
Fork
60
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
25

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ExtendDB/extenddb

Tất cả issue của ExtendDB/extenddb

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.