Repository navigation
fix(tables): provisioned billing gives global indexes capacity, and table steps wait for the one before - #143
Merged
kalaspuff merged 12 commits intoOct 31, 2026
Conversation
…es not declare Writes of loaded instances kept the item's undeclared top-level attributes (ADR 0014), but a document decoded from a map held its declared fields only, so saves by an older version of an application erased keys a newer one added to documents (address.zip_code). A document read from a map now remembers the keys no field declares and writes them back whenever it is encoded; a document the application builds replaces the map (ADR 0020). Refs #99 Co-authored-by: Carl Oscar Aaro <[email protected]>
…validators dynamoxy checked values given outside an instance (key values of lookups, values update() sets) with FieldSpec.validate, which for pydantic models is the codec's type check: normalized keys found nothing, and updates wrote values Field constraints refuse. Pydantic has no public one-field validation, so each field gets a validator built from its schema in the model's core schema (with its definitions and the model's config), without validators that take a ValidationInfo (they may read other fields) and without model validators. Fixes #107 Co-authored-by: Carl Oscar Aaro <[email protected]>
…em, and require it unchanged An instance that was not loaded, used as an update target, had its own values taken for the stored ones when an update rendered derived attributes, and updates by key (or of loaded instances without a version) required no condition that the fields they rendered from were unchanged, so a concurrent write left the derived attribute behind. Such updates now read the item, require the fields they took from it unchanged, and update() plans them again from the item as stored now when another writer changed them. Refs #84 Co-authored-by: Carl Oscar Aaro <[email protected]>
…able steps wait for the one before update_settings(billing=Billing.provisioned(...)) of an on-demand table sent capacity for the table only, although DynamoDB needs it for every global index. ensure_tables(wait=False) added a second index while the first was still being created, also after an earlier call's waiter gave up during a backfill, and create_from(wait=False) enabled Time to Live on a table that was still being created. Each step now waits for the one before it, and Time to Live is enabled before indexes are added. Refs #87 Co-authored-by: Carl Oscar Aaro <[email protected]>
…able steps wait for the one before update_settings(billing=Billing.provisioned(...)) of an on-demand table sent capacity for the table only, although DynamoDB needs it for every global index. ensure_tables(wait=False) added a second index while the first was still being created, also after an earlier call's waiter gave up during a backfill, and create_from(wait=False) enabled Time to Live on a table that was still being created. Each step now waits for the one before it, and Time to Live is enabled before indexes are added. Refs #87 Co-authored-by: Carl Oscar Aaro <[email protected]>
Co-authored-by: Carl Oscar Aaro <[email protected]>
This comment has been minimized.
This comment has been minimized.
…, and wait docs name Time to Live Co-authored-by: Carl Oscar Aaro <[email protected]>
Contributor
Author
|
On the |
This was referenced Oct 31, 2026
Contributor
Author
|
Stack of 7 pull requests, merged in this order with "Squash and merge":
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two ways dynamoxy's table management sent DynamoDB requests it refuses or can't take yet:
table.update_settings(billing=Billing.provisioned(10, 5))of an on-demand table sent capacity for the table only. DynamoDB needs capacity for every global index of a provisioned table, andBilling.provisionedsays its capacity is also used for global indexes without their own. A switch from on-demand to provisioned billing now also sends an index update giving each global index the table's capacity. A switch between provisioned capacities still changes the table only.ensure_tables(wait=False)with two missing indexes added the second while DynamoDB was still creating the first (DynamoDB takes one table update at a time), and so did a rerun after the 300-second waiter gave up during a long backfill.create_tables/ensure_tables(wait=False)with a TTL attribute calledUpdateTimeToLiveon a table that was stillCREATING. Each step now waits for the one before it: a created table is waited for before Time to Live is enabled, an index still being created (by this call or an earlier one) before the next is added, and only the last step is not waited for.ensure_tables()now enables Time to Live before it adds indexes, so that Time to Live does not wait for their backfills.The in-memory backend makes tables and indexes active at once, so the tests record the order of operations and waits (middleware plus a recorded
wait_until_active), and the update the billing switch sends; they failed before the change.uv run pytest, ruff, pyrefly and the consistency checks pass, and the tables guide describes both.This is the Python part of #87. The memory backend still accepts a switch to provisioned billing without index capacity, an index added to a provisioned table without capacity, and keeps index capacity after a switch back to on-demand: DynamoDB's answers to these are not captured anywhere I could check, and the sandbox has no AWS credentials.
Refs #87
Worth confirming
update_settings()works on a table, which does not know its models). Indexes that need other capacity have to be changed afterwards.UpdateTablerequest when it switches billing modes, as the console does; this was not verified against DynamoDB.wait=False,ensure_tables()still waits for each index before adding the next one, which for a large table can take a long time, rather than adding one index per call.fctl session
Note
Medium risk. It changes the requests that table management sends to DynamoDB (billing switches, index creation order, Time to Live timing), which can't be checked against real DynamoDB here, though only for table setup and not for item reads or writes.
What it does. A switch from on-demand to provisioned billing in
Table.update_settingsnow also gives every global index the table's capacity, as DynamoDB requires.ensure_tablesandcreate_tableswithwait=Falsenow wait for the step before: a created table before Time to Live is enabled, and an index still being created (by this call or an earlier one) before the next one is added.ensure_tablesalso enables Time to Live before it adds indexes, so that it doesn't wait for their backfills. The newest commit documents that a table with a TTL attribute is waited for whateverwaitsays, and adds a test for reruns that start from a table or index still being updated.Unverified DynamoDB behavior. That DynamoDB accepts the table's capacity and the index capacity updates in one
UpdateTablerequest was not checked against DynamoDB, and the billing switch overwrites capacity that a model declares for an index.fctl review's first look at
6e3c136· 5 files, +155 −9 · Review agent settings