Skip to content

docs: correct the throttle bucket key and the LSI plan limits - #1485

Merged
LeeroyHannigan merged 4 commits into
mainfrom
docs/throttle-key-and-lsi-limit
Dec 4, 2026
Merged

LeeroyHannigan merged 4 commits into
mainfrom
docs/throttle-key-and-lsi-limit

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the last review

  • 0c918e4 merges main at c8e66fb, without conflicts. Main has fix(core): read the latency segment clock through web_time #1482, so the WebAssembly workflow runs with that fix.
  • 1e07815: docs/design/06-component-server.md gives the two figures as "about 475 bytes" and "about 810 bytes", as the guide does.
  • 1e07815: the throttle text of the guide names the three parts of the bucket key. They are the account, the TableName string as the request sends it, and the text of the first value. So a table ARN and the bare name of one table key two pairs, and {"N": "5"} and {"S": "5"} share one. An S of "" keys on the empty string, as a map, a list, a set, a BOOL or a NULL does. The throttle manager adds a pair before dispatch, so a request that the engine then refuses still adds one. Memory grows with the accounts, table names and values. The throttle text is now two paragraphs of its own.

What

Corrections to the documentation from demohan's review of #398 and #428 and navareamol's review of this PR. Both earlier PRs merged before the corrections went in.

  • docs/manuals/11-deployment-guide.md, the throttle buckets for each partition: the throttle manager keeps a read and a write bucket for each account, table name and first value. On a PutItem, the first value is that of the first attribute of the whole Item. So it can be any attribute of the item, including one outside the key. The table name is the TableName string as sent, and the value loses its type. A first value that is a map, a list, a set, a BOOL or a NULL keys its buckets on the empty string. A request the engine refuses still adds a pair.
  • The same guide, the memory of an operation's two buckets: "475 bytes" and "810 bytes" now read "about 475 bytes" and "about 810 bytes".
  • docs/design/06-component-server.md, the same two figures: "about 475 bytes" and "about 810 bytes".
  • docs/design/04-component-storage.md, the LSI query plans: "Limit 10" counted the Query Limit, and "Limit 101" counted the SQL LIMIT that a Query Limit of 100 sends. Both now name the Query Limit: Query Limit 10 and Query Limit 100. The plans stay as measured.

Why

The text on main does not match the code or the measurements. The key of a pair of buckets is PartitionKey { account_id, table_name, partition_value } in crates/core/src/throttle.rs. handle_request (crates/server/src/handler.rs) takes table_name from extract_table_name, the TableName string of the request, and calls check_capacity_with_partition before dispatch. On a PutItem, extract_partition_value (crates/server/src/throttle_helpers.rs) takes the first entry of the Item map. It keeps the string inside the type wrapper and reads a value that is not a JSON string as the empty string. demohan measured that a bucket keyed on an attribute outside the key grows resident memory (review thread on line 420 of the guide in #398). In the same review, demohan measured 793.5 to 814.5 bytes for one operation and 463.3 to 482.8 bytes for two operations. The figures of the guide and of 06-component-server.md are within 2.5 percent of these.

Refs #398, #428

Testing done

  • Documentation only: 23 lines added and 13 removed, in three files.
  • The bucket key, the table name, the empty string and the call before dispatch are read from the code at c8e66fb.
  • cargo test -p extenddb-storage-postgres --test doc_version_literals: 3 passed at 1e07815.
  • At 1e07815, the clippy step of .github/workflows/wasm.yml passes, and cargo test -p extenddb-wasm-adapter --lib --test parity passes (4 tests). The Rust files of the branch equal those of main at c8e66fb.
  • A dry merge of this branch with each of the 24 open PRs that change one of the three files adds no conflict.

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

Breaking changes

None.


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.

…costs

The deployment guide said that the first attribute of the Key or Item,
which keys a throttle bucket, can be the sort key. On a PutItem it is the
first attribute of the whole Item, so it can be any attribute of the item.
A first value that is a map, a list, a set, a BOOL or a NULL keys its
buckets on the empty string.

The pair costs of 475 and 810 bytes now read "about 475" and "about 810".
One operation costs 793.5 to 814.5 bytes per pair, and two operations
cost 463.3 to 482.8.
The sentence named "Limit 10", a Query Limit, and "Limit 101", the SQL
LIMIT that a Query Limit of 100 sends. Both now name the Query Limit:
Query Limit 10 and Query Limit 100. The plans are as measured.

@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.

docs/design/06-component-server.md lines 367 and 368 still say "It is 475 bytes with 2 operations. It is 810 bytes when its account sends only that operation". These are the same two figures, from the same run, that this PR rounds in the guide. I think they need the same "about" so the two documents agree.

The guide now says the throttle manager keeps a read and a write bucket "for each distinct value of the first attribute". In crates/core/src/throttle.rs the map key is PartitionKey { account_id, table_name, partition_value }, and table_name is the TableName string as the request sent it (extract_table_name in crates/server/src/request_helpers.rs). So the same value under two accounts or on two tables is two pairs, and a table ARN and the bare name of the same table are two keys. The pair is made in check_capacity_with_partition, which runs before dispatch, so a request the engine then refuses still adds one. Could the paragraph say one pair per account, table name and value, and that memory grows with all three? That is the number an operator sizes for.

Optional: the value loses its type, so {"N": "5"} and {"S": "5"} share a pair, and an S of "" keys on the empty string as well.

The wasm check failed on this head with E0308 (web_time::Instant against std::time::Instant in crates/core/src/metrics/segments.rs). It failed the same way on the base 80490c6, and #1482 fixed it on main, where it passes at 92155f3. The branch is 24 commits behind main and merges with no conflict, so merging main should turn it green.

I will approve once the 06 figures carry "about", the bucket paragraph names the account and table in the key, and main is merged so wasm runs green.

The throttle manager keys each pair of buckets on three parts. They are the
account, the TableName string as the request sends it, and the text of the
first value. The guide
now says so. A table ARN and the bare name of one table key two pairs, and
{"N": "5"} and {"S": "5"} share one. An S of "" keys on the empty string, as
a map, a list, a set, a BOOL or a NULL does. The manager adds a pair before
dispatch, so a request that the engine then refuses still adds one. The
throttle text is now two paragraphs of its own. In
docs/design/06-component-server.md the 475 and 810 byte figures read "about
475 bytes" and "about 810 bytes", as in the guide.
@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

@navareamol

  • 1e07815 gives the two figures in docs/design/06-component-server.md as "about 475 bytes" and "about 810 bytes", as the guide does.
  • 1e07815 rewrites the bucket text of the guide. It now says that the throttle manager keeps a pair for each account, table name and first value. The table name is the one the request sends. So a table ARN and the bare name of one table key two pairs, and memory grows with all three. It also says that the manager adds a pair before dispatch, so a request that the engine then refuses still adds one.
  • The optional point is in the same text. The pair keeps the text of the value and drops its type, so {"N": "5"} and {"S": "5"} share a pair. An S of "" keys on the empty string too.
  • 0c918e4 merges main at c8e66fb, without a conflict. On the merged branch, the clippy step of .github/workflows/wasm.yml passes.

@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.

Two optional wording points in the new bucket paragraph of docs/manuals/11-deployment-guide.md.

The paragraph says the manager keeps a read bucket and a write bucket for each account, table name and first value, and then calls them "the pair" and "a pair" several times. The word pair is never tied to the read bucket plus the write bucket. I think "a pair of buckets, one for reads and one for writes" in the first sentence would make the later sentences clear.

The last sentence says the manager "never drops a bucket". It does drop a table's own buckets on DeleteTable (remove_table in crates/core/src/throttle.rs). It never drops the pairs that this paragraph is about. I think "never drops a pair" says what you mean.

Everything else in the text matches the code. The key is the account id, the TableName string as the request sent it, and the value text (PartitionKey in crates/core/src/throttle.rs). A table ARN and the bare name are two keys. The pair is made in check_capacity_with_partition before dispatch, so a request the engine then refuses still adds one. N and S share a pair, and a map, a list, a set, a BOOL, a NULL and an S of "" all key on the empty string. The 06 figures now read "about 475 bytes" and "about 810 bytes" like the guide, main is merged, and the wasm check is green on this head.

I approve this PR.

@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 1a04dba Dec 4, 2026
64 of 65 checks passed
@LeeroyHannigan
LeeroyHannigan deleted the docs/throttle-key-and-lsi-limit branch December 4, 2026 03:53
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
…-time

The merge takes f583547, the last head of #1093 before main merged
it as 1e2ebdd. The last merge took b8f73c4. Since then, #1093
merged main at 1174651, eight PRs past db8a90d: #1466, #1087,
#768, #1296, #1485, #1228, #1325 and #1443. Git merged without a
conflict. Two files of this branch have changes on both sides:

- crates/storage/src/util/mod.rs: #1087 declares and exports
  scan_segment, and this branch declares and exports throughput.
- docs/differences-from-dynamodb.md: #1443 changes the
  control_plane_delay_seconds default to 0.25 in two rows, and this
  branch adds the LastIncreaseDateTime row to the Control Plane table.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 1e2ebdd, ten commits past db8a90d: #1466, #1087,
#768, #1296, #1485, #1228, #1325, #1443, #1269 and the squash commit
of #1093.

One file conflicted: docs/manuals/07-upgrade-manual.md. #1093 adds its
v1.2.0 entry at the top of "Behavior Changes by Release", where this
branch has its entry. The merge keeps both entries without change. The
entry of this branch stays first. The entry of #1093 comes next, above
the other v1.2.0 entries of main. #1087 adds its entry after the other
v1.2.0 entries of main, and git merged it with no conflict.

Git merged four other files with no conflict:

- crates/core/src/validation/mod.rs: #1228 adds the pattern clause for
  an empty value in validate_name_member. This branch declares the
  table_name_length module near the top of the file.
- crates/server/src/table_name_gate.rs: #1296 adds has_no_table_member
  and an arm of check_table_name_chars for the six operations that have
  no table member. This branch checks none of those operations.
- crates/wasm-adapter/parity/corpus.json: #1087 adds a Scan case, and
  #1228 changes the text of a ListBackups case. This branch changes
  other cases.
- docs/manuals/10-security-model.md: #1325 adds the
  Content-Security-Policy line of the console. This branch changes the
  line on the requests that get an answer before the IAM decision.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 1e2ebdd, six commits past 44a7b79: #1485, #1228,
#1325, #1443, #1269 and the squash commit of #1093.

One file conflicted:
crates/storage-mongodb/src/data_engine_live_tests.rs. #1093 declares
the update_window module after delete_table, where this branch
declares put_race and contention. The merge keeps all three
declarations: update_window first, then the two of this branch.

Git merged five other files with no conflict:

- crates/storage-mongodb/src/snapshot_engine.rs: #1093 checks that a
  table serves with TableStatus::serves, and its tests set a table to
  CREATING instead of UPDATING. This branch builds a test engine with
  MongoEngine::for_test, at other lines.
- crates/storage/src/error.rs: #1093 adds a sentence to the doc comment
  of IndexesInUse. This branch changes the doc comment of Transient.
- crates/storage/src/lib.rs: #1093 declares update_window_conformance,
  and this branch declares request_clock.
- docs/differences-from-dynamodb.md: #1443 changes the default delay
  to 0.25 s, and #1093 changes the row on stream disable and the row of
  the delay setting. This branch changes two rows near the top and adds
  the row on sustained contention.
- docs/manuals/07-upgrade-manual.md: #1093 adds its v1.2.0 entry at the
  top of "Behavior Changes by Release". The entry of this branch stays
  after the v1.2.0 entries of main.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 1e2ebdd, six commits past 44a7b79: #1485, #1228,
#1325, #1443, #1269 and the squash commit of #1093.

One file conflicted:
crates/storage-mongodb/src/data_engine_live_tests.rs. #1093 declares
the update_window module after delete_table, where this branch
declares the token module. The merge keeps both declarations:
update_window first, then token.

Git merged five other files with no conflict:

- crates/core/src/validation/mod.rs: #1228 adds the pattern clause for
  an empty value in validate_name_member. This branch changes the index
  key checks, at other lines.
- crates/storage/src/error.rs: #1093 adds a sentence to the doc comment
  of IndexesInUse, and this branch adds TransactionInProgress.
- crates/storage/src/lib.rs: #1093 declares update_window_conformance,
  and this branch adds names to the transact exports.
- docs/differences-from-dynamodb.md: #1443 changes the default delay
  to 0.25 s, and #1093 changes the row on stream disable and the row of
  the delay setting. This branch changes the row on index key
  validation.
- docs/manuals/07-upgrade-manual.md: #1093 adds its v1.2.0 entry at the
  top of "Behavior Changes by Release". The entry of this branch stays
  after the v1.2.0 entries of main.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 1e2ebdd, eight commits past 5826e1b: #768, #1296,
#1485, #1228, #1325, #1443, #1269 and the squash commit of #1093.

Three files conflicted, in four hunks. In each hunk the UpdateTable
window of #1093 meets the answer of this branch for a DELETING table:

- crates/storage-postgres/src/update_table.rs and
  crates/storage-sqlite/src/update_table.rs have one hunk each. #1093
  reads three more columns of the table row: the stored throughput, the
  table class and the window (in_window on PostgreSQL,
  stored_transition_at on SQLite). This branch answers a DELETING table
  with TableBeingDeleted right after UpdateTable reads the row. The
  merge keeps the wider read of #1093, then the DELETING check of this
  branch, then the check for a status other than ACTIVE. The window
  checks of #1093 come after that check, as on main.
- crates/storage-mongodb/src/table_engine.rs has two hunks, both in
  require_active_table. #1093 makes the function return the catalog
  document of the table, and UpdateTable reads the window from it. This
  branch answers DELETING with TableBeingDeleted in a match on the
  status. The merge keeps that match, and its ACTIVE arm returns the
  document. The doc comment names the document and the three answers.

A table has one stored status. #1093 reports UPDATING only for a
stored ACTIVE table whose status_transition_at is later than now
(reported_status in crates/storage/src/util/mod.rs). So no table is
UPDATING and DELETING at the same time, and the merge does not choose
between the two answers.

Git merged six other files of this branch with no conflict:

- crates/engine/src/update_table.rs: #1093 changes the doc comment of
  handle_update_table and declares the status_tests module. This branch
  maps TableBeingDeleted in update_table_err_to_dynamo.
- crates/storage-cassandra/src/update_table.rs: #1093 reads
  status_transition_at and adds the window. This branch adds the same
  DELETING check before the check for a status other than ACTIVE.
- crates/storage-postgres/tests/table_snapshot.rs: #1093 writes
  CREATING instead of UPDATING in two fixtures. This branch changes
  other tests.
- crates/storage/src/error.rs: #1093 adds a sentence to the doc comment
  of IndexesInUse, and this branch adds TableBeingDeleted.
- docs/differences-from-dynamodb.md: #1443 changes the default delay
  to 0.25 s, and #1093 changes the row on stream disable and the row of
  the delay setting. This branch adds the row on requests during a
  DELETING window.
- docs/manuals/07-upgrade-manual.md: #1093 adds its v1.2.0 entry at the
  top of "Behavior Changes by Release". The entry of this branch stays
  after the v1.2.0 entries of main. The change of this branch to the
  entry of #1411 stays too.
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.

2 participants