CreateTable accepts an empty GlobalSecondaryIndexes or LocalSecondaryIndexes list, and DynamoDB refuses it

未关闭 适合新手
#1,023 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
87/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust

调研方向

从 crates/core/src/validation/mod.rs 中的 validate_create_table 开始,检查 validate_attribute_definitions 相对于 GSI 和 LSI 验证的执行顺序。按照 issue 中描述的错误文案和优先级,添加空列表检查,包括两个列表都为空的情况。完成标准是:空列表会在属性定义错误之前返回匹配的 DynamoDB ValidationException。

由索引模型根据 Issue 内容生成。

描述

Amazon DynamoDB refuses a CreateTable whose GlobalSecondaryIndexes or LocalSecondaryIndexes member is an empty list. It answers One or more parameter values were invalid: List of GlobalSecondaryIndexes is empty, or the same text with LocalSecondaryIndexes, and creates no table. It reports the empty list before an attribute definition that no key uses. ExtendDB has no check for an empty list. When the request also defines an attribute that no key uses, ExtendDB answers the attribute definition count text instead.

Measured in us-east-1 on 2026-11-14. Each request went out twice and got the same answer both times. Every request is PAY_PER_REQUEST with the key pk S HASH and sk S RANGE. AttributeDefinitions names pk, sk, label and stamp, all S, except in the last row. The GSI is {IndexName: "by-label", KeySchema: [label HASH], Projection: ALL}, and the LSI is {IndexName: "by-stamp", KeySchema: [pk HASH, stamp RANGE], Projection: ALL}. DynamoDB answers each row with ValidationException, and a DescribeTable after it answers ResourceNotFoundException Requested resource not found: Table: <table> not found.

Index members of the request DynamoDB
GlobalSecondaryIndexes: [] One or more parameter values were invalid: List of GlobalSecondaryIndexes is empty
LocalSecondaryIndexes: [] One or more parameter values were invalid: List of LocalSecondaryIndexes is empty
GlobalSecondaryIndexes: [] and LocalSecondaryIndexes: [] One or more parameter values were invalid: List of LocalSecondaryIndexes is empty
GlobalSecondaryIndexes: [] and the LSI One or more parameter values were invalid: List of GlobalSecondaryIndexes is empty
the GSI and LocalSecondaryIndexes: [] One or more parameter values were invalid: List of LocalSecondaryIndexes is empty
GlobalSecondaryIndexes: [], with pk and sk the only definitions One or more parameter values were invalid: List of GlobalSecondaryIndexes is empty

ExtendDB at origin/main 95425f5e8 answers the first five rows with ValidationException Number of attributes in KeySchema does not exactly match number of attributes defined in AttributeDefinitions: <table>, on SQLite, SQLite in dev mode, PostgreSQL, MongoDB and Cassandra. The DescribeTable after it answers ResourceNotFoundException on both sides. The last row has no ExtendDB measurement. In that request a key uses every definition, and no check in validate_create_table refuses it.

validate_create_table (crates/core/src/validation/mod.rs, line 111) has no check of an empty index list. validate_gsi_key_schemas (line 815) and validate_lsi_key_schemas (line 840) loop over the list, so an empty list passes them. validate_attribute_definitions (line 882) then refuses a definition that no key uses (lines 977 to 985) with the AttrDefNotInKey text of crates/core/src/error/messages.rs (lines 96 to 101).

Proposed change: in validate_create_table, before validate_attribute_definitions, refuse an empty GlobalSecondaryIndexes or LocalSecondaryIndexes list with One or more parameter values were invalid: List of <member> is empty. When both lists are empty, name LocalSecondaryIndexes, as DynamoDB does.

主要语言
Rust
星标
517
派生
60
平均合并
5 天 14 小时
30 天内合并 PR
124

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ExtendDB/extenddb 的其他 Issue

查看 ExtendDB/extenddb 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。