fix: Report per-index consumed capacity for writes (excludes transact/batch APIs for now)#199
fix: Report per-index consumed capacity for writes (excludes transact/batch APIs for now)#199robinnsc wants to merge 2 commits into
Conversation
|
Nice fix — the per-index capacity accounting is correct and the tests are solid. One architectural concern and a few minor items: Main concern: redundant The engine already fetches pub struct IndexInfo {
pub index_name: String,
pub key_schema: Vec<KeySchemaElement>,
pub projection: Projection,
}
pub struct TableKeyInfo {
// ... existing fields ...
pub global_secondary_indexes: Vec<IndexInfo>,
pub local_secondary_indexes: Vec<IndexInfo>,
}Since The current approach is functionally correct, but we do care enough about performance that I think we shoiudl do something here; enriching Minor items (non-blocking):
|
|
Can we rebase this on #128 as the index logic may differ a lot once it lands? |
What
Implementing index consumed capacity accounting for the single item write operations: PutItem, UpdateItem, DeleteItem
Deferred Changes
Support for per index breakdowns for TransactWriteItems and BatchWriteItem not included, as it requires some material further changes in the storage layer with DataEngine traits, will be addressed in a followup. Also, exact byte sizing would still be a broader issue, and will resolved its own item size formula gap fix
Why
Requests with the
ReturnConsumedCapacityparameter set to 'INDEXES' on a table with secondary indexes was returning only the base table number, with no per-index breakdown.TOTALmode also under counted, reporting only the base-table units.ConsumedCapacity was previously hardcoded as none for GSIs/LSIs, so the breakdown was never populated and the aggregate never included index writes.
Testing done
Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
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.