Skip to content

fix(core): refuse an empty index list in CreateTable - #1134

Open
LeeroyHannigan wants to merge 1 commit into
mainfrom
fix/1023-empty-index-list
Open

LeeroyHannigan wants to merge 1 commit into
mainfrom
fix/1023-empty-index-list

Conversation

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

What

CreateTable now refuses an empty GlobalSecondaryIndexes or LocalSecondaryIndexes list with One or more parameter values were invalid: List of <member> is empty, as DynamoDB does, and creates no table. With both lists empty, it names LocalSecondaryIndexes. An absent member still passes. Before this change ExtendDB accepted such a request, or refused it with the attribute definition count text when no key used a definition.

The refusal comes after the key schema check, the table throughput check and the check that each key attribute has a definition. It comes ahead of the check that a key uses each definition. DynamoDB answers them in this order.

ErrorMessageKey::IndexListEmpty writes the text. validate_index_lists_not_empty runs inside validate_attribute_definitions, between its two definition loops. It calls validate_provisioned_throughput before it refuses, because origin/main runs the definition checks before the throughput check. Open PR #595 moves the throughput check above the definition checks. When #595 merges, that call can go.

RestoreTableFromBackup turns an empty override list into an absent one before it runs the CreateTable checks, so a restore keeps its answer.

Why

These are DynamoDB's answers, measured in us-east-1. The issue's rows date from 14 November 2026. On 18 November 2026, more requests went to DynamoDB, and each one went out twice with the same answer both times. DynamoDB answers each of these faults ahead of an empty GlobalSecondaryIndexes or LocalSecondaryIndexes list:

  • A PROVISIONED table has no ProvisionedThroughput.
  • The KeySchema has two HASH keys.
  • A key attribute has no definition.
  • SSESpecification has SSEType AES256.
  • TableClass is "BOGUS".

Closes #1023

Testing done

The last change moved the check after the key attribute definition loop and added two rows for it. After it, cargo test -p extenddb-core --lib passed 1147 with 1 ignored, and clippy on the core and fmt are clean. The other runs below are on the first form of the commit.

  • cargo test -p extenddb-engine --lib: 870 passed.
  • cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine --all-targets -- -D warnings and cargo fmt --all -- --check are clean.
  • The core test an_empty_index_list_gets_the_answer_dynamodb_gives holds the issue's rows and the order rows. An order row expects the answer of the same request without the empty list, so it holds whatever text ExtendDB gives the other fault. With the change reverted, the test fails.
  • Against ExtendDB on SQLite, tests/test_table_operations.py, tests/test_multipart_gsi.py, tests/test_gsi_attribute_definitions.py, tests/python/test_gsi.py and the override tests of tests/test_backup_restore_fidelity.py passed 63 tests and skipped 1. The skipped test needs a table to stay DELETING, which SQLite never does. The restore with GlobalSecondaryIndexOverride=[] and LocalSecondaryIndexOverride=[] is among them.

Line counts: production +38, tests +202.

Not in this PR, each in an open issue or PR:

Other open PRs:

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

ADR / RFC: n/a


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

DynamoDB refuses a CreateTable whose GlobalSecondaryIndexes or
LocalSecondaryIndexes member is an empty list. It answers
ValidationException "One or more parameter values were invalid: List of
<member> is empty" and creates no table. ExtendDB accepted the request,
or refused it with the attribute definition count text when a definition
was unused.

CreateTable now refuses an empty list with the same text. With both
lists empty, it names LocalSecondaryIndexes, as DynamoDB does. The
refusal comes after the key schema check, the table throughput check
and the check that each key attribute has a definition. It comes ahead
of the check that each definition is used. An absent member still
passes.

The six requests of the issue were measured in us-east-1 on 2026-11-14.
The order against a PROVISIONED table with no ProvisionedThroughput,
two HASH keys and a key attribute with no definition was measured on
2026-11-18.

Fixes #1023.

@navareamol navareamol left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. validate_index_lists_not_empty calls validate_provisioned_throughput, which refuses three things: PROVISIONED with no throughput (measured), PAY_PER_REQUEST with ProvisionedThroughput, and capacity units below 1. With GlobalSecondaryIndexes: [] ExtendDB now answers "Neither ReadCapacityUnits nor WriteCapacityUnits can be specified when BillingMode is PAY_PER_REQUEST" and "ReadCapacityUnits and WriteCapacityUnits must both be greater than or equal to 1 for table" ahead of the empty-list text. Has anyone sent these two requests to DynamoDB? If DynamoDB answers the empty list first, the call could check only the missing throughput. Either way a row for each in an_empty_index_list_gets_the_answer_dynamodb_gives would pin it. Today only the missing-throughput row holds the call in place: removing the call fails that row and nothing else.

  2. The empty-list refusal now comes ahead of every check after validate_attribute_definitions and ahead of check_sse_specification. Two requests change answer against main on SQLite:

    • hash-only table, one LSI, GlobalSecondaryIndexes: []: main gives the LSI range key refusal, this branch gives "List of GlobalSecondaryIndexes is empty".
    • six LSIs and GlobalSecondaryIndexes: []: main gives the five LSI limit text, this branch gives the empty-list text.
      Does DynamoDB answer the empty list ahead of these? The measured rows show only that it comes ahead of a definition no key uses. Could you measure these two and add them as rows?

I will approve once the two throughput shapes and the two LSI shapes are measured and either pinned as rows or the check moved to match.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants