Repository navigation
fix(engine): read an ExecuteStatement Limit from a JSON number - #1144
Conversation
ExecuteStatement read Limit only when the request sent it as a JSON integer. A Limit of 1.0, 1.5 or "2" ran the statement as if the request had no Limit. DynamoDB reads 1.0 and 1.5 as 1 and returns one item on each page. It refuses the string with SerializationException "STRING_VALUE cannot be converted to Integer" before the table lookup (measured in us-east-1 on 2026-11-14). The Limit is now read from any JSON number as saturated_int32 reads it. That function truncates a fraction toward zero and saturates a value outside the int32 range. A Limit of 0.5 or 0.9999 reads as 0 and gets the refusal of a Limit below 1. The reader, int32_member::read, takes any request member that the service reads as an int32. A Limit of another JSON type gets the SerializationException that DynamoDB answers for it (measured in us-east-1 on 2026-11-18). The message is "TRUE_VALUE cannot be converted to Integer" for true and "FALSE_VALUE cannot be converted to Integer" for false. It is "Start of structure or map found where not expected" for an object. A list gets no message. A null Limit still reads as no Limit. Fixes #1027.
| } | ||
| // A float: `as` truncates toward zero and saturates at the int32 bounds. | ||
| #[allow(clippy::cast_possible_truncation)] | ||
| number.as_f64().map_or(0, |value| value as i32) |
There was a problem hiding this comment.
Measured 2026-11-19 against Amazon DynamoDB in us-east-1 and against this PR (f360676, SQLite dev mode). Each request was sent twice to each and answered the same both times. Table: key pk S HASH, sk S RANGE; partition p holds row-1 to row-4. The request body is sent as written with a hand-signed ExecuteStatement call (the SDK writes Limit as an integer).
Body: {"Statement": "SELECT * FROM \"<table>\" WHERE pk = 'p'", "ConsistentRead": true, "Limit": <L>}, then the same with each NextToken.
Limit |
DynamoDB | this PR |
|---|---|---|
0.99999999999999999 |
ValidationException: Value '0' at 'limit' failed to satisfy constraint: Member must have value greater than or equal to 1 |
runs with Limit 1, four pages |
1.99999999999999999 |
one item per page | two items per page (row-1,row-2, row-3,row-4) |
-0.99999999999999999 |
refused, Value '0' |
refused, Value '-1' |
-1.99999999999999999 |
refused, Value '-1' |
refused, Value '-2' |
DynamoDB truncates the decimal as written. as_f64() rounds the decimal to the nearest double first, so a decimal within about 1e-16 of an integer lands on that integer. main ran all four with no Limit, so this is not a regression, but "truncates a fraction toward zero" (PR body and this doc comment) does not hold for these. serde_json is built without arbitrary_precision, so the double is all the reader sees. Either say "nearest double" here and in the body, or read the number's text. Open PR #850 has the same function text, so the fix belongs in both.
There was a problem hiding this comment.
Fixed in 7edbc85. The doc of saturated_int32 no longer says "nearest double", because serde_json without float_roundtrip can parse a decimal to the double next to the nearest one. It now says that the reader gives DynamoDB's value for a number of at most 15 significant digits. It also says that a decimal of 16 or more significant digits can read as the next integer in magnitude, with 0.99999999999999999 and -100.999999999999999 as measured cases. The PR body says the same.
Reading the written digits needs the number's text, so that went to #1203. It holds three of your rows measured again on 20 Nov, your table row, and other magnitudes. #850 still has the old doc. Whichever of the two PRs merges second keeps this one.
| pub conditional_operator: Option<ConditionalOperator>, | ||
| } | ||
|
|
||
| /// The value the service validates and uses for a `Scan` `Limit`, `Segment` |
There was a problem hiding this comment.
The doc comment describes a Scan use. In this PR the only caller is int32_member::read, for PartiQL, and Scan and Query still refuse a fractional Limit. Measured 2026-11-19 in us-east-1 and on this PR: Scan with "Limit": 1.5 returns one item on DynamoDB and invalid type: floating point 1.5, expected i64 on this PR. The facts in the comment are right; the scope sentence is for #850 and misleads here.
There was a problem hiding this comment.
Fixed in 7edbc85. The first sentence of the doc now names an int32 request member written as a JSON number. The facts of 25 and 30 October now say that they were measured on Scan.
| use extenddb_core::types::saturated_int32; | ||
| use serde_json::Value; | ||
|
|
||
| /// Read a request member that the service reads as an int32, from any JSON |
There was a problem hiding this comment.
Measured 2026-11-19 against Amazon DynamoDB in us-east-1 and against this PR (f360676, SQLite dev mode). Each request was sent twice to each and answered the same both times. Table: key pk S HASH, sk S RANGE; partition p holds row-1 to row-4. The request body is sent as written with a hand-signed ExecuteStatement call (the SDK writes Limit as an integer).
"Limit": 1e309 and "Limit": -1e309:
Limit |
DynamoDB | this PR |
|---|---|---|
1e309 |
accepted, all four rows on one page (missing table: ResourceNotFoundException) |
SerializationException: Start of structure or map found where not expected: number out of range at line 1 column 106 |
-1e309 |
refused, Value '-2147483648' |
the same number out of range text |
main answers the same text, because the failure is in the request body parse that every operation shares. So "reads Limit from any JSON number" does not hold for a value beyond the range of a double. Not a merge condition: narrow the sentence, or file it separately.
There was a problem hiding this comment.
Fixed in 7edbc85. The doc of int32_member::read now says "from a JSON number". It adds that a number beyond the range of a double fails the parse of the request body before the reader runs, where DynamoDB accepts 1e309. The test is now a_limit_reads_from_a_json_number_and_another_type_is_refused, and the PR title no longer says "any".
#1203 covers 1e309 and -1e309 with the near-integer decimals. In both cases the number's text is gone before the reader sees it.
| /// | ||
| /// Returns the service's refusal naming every failed constraint. | ||
| pub(super) fn check_execute_statement(body: &Value) -> Result<(), DynamoDbError> { | ||
| let limit = int32_member::read(body.get("Limit"))?; |
There was a problem hiding this comment.
Measured 2026-11-19 against Amazon DynamoDB in us-east-1 and against this PR (f360676, SQLite dev mode). Each request was sent twice to each and answered the same both times. Table: key pk S HASH, sk S RANGE; partition p holds row-1 to row-4. The request body is sent as written with a hand-signed ExecuteStatement call (the SDK writes Limit as an integer).
Members written in the order shown, Statement valid:
| Request members | DynamoDB | this PR |
|---|---|---|
"Limit": "2", "Parameters": [1] |
STRING_VALUE cannot be converted to Integer |
Start of structure or map found where not expected: invalid type: integer 1, expected a DynamoDB AttributeValue ... |
"Limit": true, "Parameters": [{"S": 1}] |
TRUE_VALUE cannot be converted to Integer |
the Parameters text (S value must be a string) |
"NextToken": 5, "Limit": "2" |
NUMBER_VALUE cannot be converted to String |
STRING_VALUE cannot be converted to Integer |
"Limit": "2", "ConsistentRead": "x" |
the Limit text |
the Limit text |
check_request_parameter_types runs on the line before check_execute_statement (partiql/mod.rs:88), so the Parameters type check comes first. The sentence "That check runs before every other check of the request" in the PR body is not true of this build. It is true that the Limit type check runs ahead of every constraint check. DynamoDB reports the first JSON type fault in the order the request writes them (278 cases, each twice), which the body defers to #781. None of these cells is worse than main.
There was a problem hiding this comment.
The body now says that the Limit type check runs before the constraint checks of the request, and that a Parameters member of the wrong JSON type still gets its answer first.
I measured your rows again on 20 Nov, with each pair in both orders and with "NextToken": 5 alone. DynamoDB reports the member written first. It refuses a NextToken number with NUMBER_VALUE cannot be converted to String, where ExtendDB drops the token and runs the statement. #781 does not change this order, so the body now points at #1202, which holds those rows.
|
|
||
| /// Each `Limit` as a request writes it, and the request's answer (measured | ||
| /// 2026-11-14 and 2026-11-18, us-east-1). | ||
| const LIMITS: &[(&str, Answer)] = &[ |
There was a problem hiding this comment.
No test pins the claims below. Each mutation was run on the committed PR tree and reverted.
- Negative values: the PR body says rows for
-0.5,-0,-1.5,-2147483649and-1e20were measured, andLIMITSholds none of them. I measured all five against DynamoDB and this PR in us-east-1 on 2026-11-19: both giveValue '0','0','-1','-2147483648','-2147483648'.-2147483649is a row where the PR changes an answer (main echoedValue '-2147483649'), so it is worth a row. saturated_int32branches: mutating the negative saturation branch, and mutating theis_u64branch, each passcargo test -p extenddb-core --liband-p extenddb-engine --lib. No row is abovei64::MAXand belowu64::MAX(for example9223372036854775808, which the doc comment says was measured), and none is a negative integer pasti32::MIN.- Order: moving the
Limitread incheck_execute_statementafter the other checks passes every test, because the test compares only the final answer and never a request with two faults. A row such as{"Limit": "2"}with noStatementwould pin the claim that theLimittype comes before the missing statement. - Write statements: INSERT, UPDATE and DELETE with
"Limit": "2"or0.5ran on main and are refused now, and DynamoDB refuses them too (measured twice). No test sends aLimiton a write statement, and the PR body does not say that writes change.
There was a problem hiding this comment.
Fixed in 7edbc85. LIMITS has rows for -0.5, -0, -1.5, -2147483649, -1e20, -9223372036854775809 and 9223372036854775808, each measured on DynamoDB on 18 or 20 Nov. A separate assertion sends {"Limit": "2"} with no Statement, and it fails when the Limit type check moves after found.into_result().
saturated_int32 is now the float path alone. The as_i64 and is_u64 branches gave the same value for each of 20,024,022 integers checked, so no row could tell them apart. test_limit_on_a_write_statement sends "2" and 0.5 with an INSERT, an UPDATE and a DELETE, and the body says that ExtendDB now refuses those writes, as DynamoDB does.
| .unwrap_or(false), | ||
| limit: body.get("Limit").and_then(Value::as_i64), | ||
| limit: crate::int32_member::read(body.get("Limit")) | ||
| .unwrap_or_default() |
There was a problem hiding this comment.
.unwrap_or_default() drops the error from int32_member::read. That is safe today: check_execute_statement has already refused the member for ExecuteStatement, and a BatchExecuteStatement or ExecuteTransaction statement object ignores its Limit (measured 2026-11-19 on DynamoDB, 50 cells over the JSON types, all ignored, and this PR answers the same). A one-line comment saying why would keep the next reader from replacing it with ?. Replacing it with ? passes every test now, so a row for a statement object that carries "Limit": "2" would pin it.
There was a problem hiding this comment.
Fixed in 7edbc85. A comment above .unwrap_or_default() gives both reasons. Each row of LIMITS also checks that SingleRequest::from_body accepts the body, so ? there fails the test on the "2" row. On 20 Nov DynamoDB ignored "Limit": "2" and 0.5 in a BatchExecuteStatement and an ExecuteTransaction statement object.
The engine test of the ExecuteStatement Limit adds rows for -0.5, -0,
-1.5, -2147483649, -1e20, 9223372036854775808 and -9223372036854775809.
DynamoDB refuses -0.5 and -0 with Value '0' and -1.5 with Value '-1'. It
refuses the other negative values with Value '-2147483648' and accepts
9223372036854775808 (measured in us-east-1 on 2026-11-18 and 2026-11-20).
For {"Limit": "2"} with no Statement, DynamoDB sends the STRING_VALUE
SerializationException ahead of the refusal of the missing statement. An
assertion pins that order.
DynamoDB ignores the Limit of a BatchExecuteStatement or
ExecuteTransaction statement object, whatever its JSON type (measured
2026-11-20). For each row, the test checks that a statement object with
that Limit reads. A comment on the read in SingleRequest says why it
drops the error.
INSERT, UPDATE and DELETE statements get the same Limit refusals as a
SELECT. A wire test sends a Limit of "2" and of 0.5 with each of them.
saturated_int32 reads every number through a double and drops its
integer branches. Those branches gave the same value for every integer. A
double is exact for every integer in the int32 range, and the cast
saturates every other one at the nearer bound. Its doc says that a
decimal of 16 or more significant digits can read as the next integer in
magnitude. DynamoDB truncates the decimal as written (measured
2026-11-20, #1203).
The doc of int32_member::read says that a number beyond the range of a
double fails the parse of the request body. DynamoDB accepts 1e309.
hitesh96db
left a comment
There was a problem hiding this comment.
Approving at 7edbc85. Each earlier comment is addressed.
Checked on this head:
- The doc and PR body now limit the exact reading to numbers of at most 15 significant digits and name the two cases that read otherwise (#1203). On Amazon DynamoDB in us-east-1 on 2026-11-20,
-100.999999999999999and0.99999999999999999giveValue '-100'andValue '0',1e309is accepted and-1e309givesValue '-2147483648'. Each request was sent twice with the same answer. - The new rows of
LIMITS(-0.5,-0,-1.5,-2147483649,-1e20,-9223372036854775809,9223372036854775808) match DynamoDB on the same dates, on a table that does not exist. test_limit_written_as_any_json_valueandtest_limit_on_a_write_statementpass against Amazon DynamoDB (16 passed) and against this build on SQLite. In CI they ran and passed on SQLite, PostgreSQL, MongoDB and Cassandra.tests/test_partiql_select.py,test_partiql_requests.pyandtest_partiql_limits.pypass 222 tests on SQLite.cargo test -p extenddb-core --libpasses 1146 and-p extenddb-engine --libpasses 871.cargo +1.97.0 fmt --all -- --checkandcargo +1.97.0 check -p extenddb-engine --no-default-features --libare clean.- Seven mutations each fail the engine test
a_limit_reads_from_a_json_number_and_another_type_is_refused:?in place of.unwrap_or_default()(fails on thefrom_bodycheck), theLimittype check moved after the other checks (fails on the body with noStatement),round()in place of truncation,limit < 0in place oflimit < 1, thetrueandfalsetexts swapped, a nullLimitrefused, and the float cast taken throughi64. - Reading every number as a double gives the value the removed
as_i64andis_u64branches gave: an integer below 2^31 in magnitude is exact as a double, and a larger one saturates either way. - The merge with main is clean. The merge with #850 conflicts in two hunks of
query.rs, as the body says.
cargo clippy --all-targets fails locally on macOS in crates/core/tests/data_file_decode_peak.rs:83, a file this PR does not touch. The clippy check in CI passes.
Not run: PostgreSQL, MongoDB and Cassandra outside CI, and cargo test --workspace.
…heck
Measured against the service on 2026-11-12 (demohan's review rows) and on
2026-11-23 at 14:51 and 18:45 UTC. I sent each request twice, as a raw
signed Scan or Query on a table that does not exist:
- In the older form the service puts the Select and ReturnConsumedCapacity
enum clauses in the one message with the range clauses. The order is
select, totalSegments, returnConsumedCapacity, segment, limit. Limit 0.0,
Segment -1, TotalSegments 1000001 beside both enums answers five
clauses. Select BAD and ReturnConsumedCapacity BAD beside an empty entry,
or beside Limit 1.5, answer the two enum clauses. The check returned the
range clauses alone. For the two enum rows it returned the
ReturnConsumedCapacity clause alone, where main answers both.
- A null is a value the service cannot read as one type. Limit 0 beside a
null entry or an L with a null member answers Value '0' at 'limit'. So
does an ExclusiveStartKey value with a null S payload, and a null
KeyConditions list entry on Query. The check answered SerializationException
for these. {"NULL": true}, {"L": []} and a null ExclusiveStartKey member
keep the newer form.
- Query takes the older form for a Limit that is a float or outside int32
without any such value. Limit -2147483649 answers Value '-2147483648' at
'limit', and Limit 0.0 answers Value '0' at 'limit'. Both enums beside
Limit -2147483649 answer select, returnConsumedCapacity, limit. The
check answered the newer form or SerializationException.
- In the older form the aggregate comes ahead of the parameter mix and of
an invalid ExpressionAttributeNames key. A float Limit that satisfies
its constraint beside an N that is not a number answers the wrapped
numeric text.
- Limit, Segment or TotalSegments of another JSON type answers
SerializationException ahead of an invalid Select. The texts are the
service's: STRING_VALUE cannot be converted to Integer, TRUE_VALUE cannot
be converted to Integer, and no message for an array.
The Scan and Query request checks now share one path. int32_member reads
the three members as the service does, with main's saturated_int32
(#1144), finds their range faults, and builds the newer form. The handlers
read the members through it before they deserialize the body. A float or a
value outside int32 so reaches the storage layer truncated or saturated.
unreadable.rs reads ExpressionAttributeValues, ExclusiveStartKey and the
condition lists with the one rule. Its older-path checks take the range
faults beside the enum clauses. The Query Limit block, this branch's
saturated_int32, its Scan field deserializer, its unreadable-value reader
and its hand-built envelope are gone. The envelope is core's
validation_error_envelope.
saturated_int32 reads the number as a double. A long decimal such as
0.99999999999999999 reads as 1 here, where the service truncates the
written text and reads 0 (#1203).
range_tests.rs, unreadable_tests.rs and int32_member/tests.rs have the
measured rows, with the ones demohan listed that no test sent.
Main is 24 commits ahead of the branch, and the merge is clean. One file changed on both sides, crates/engine/src/lib.rs: main adds the int32_member module (#1144), and this branch exports refuse_duplicate_key_condition beside handle_query.
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that carries it: the root Cargo.toml version and its 13 exact pins, the 15 workspace entries in Cargo.lock (no third-party entry changes), packaging/npm/package.json (the version and the five platform pins), the four license-notice files (regenerated with cargo-about 0.9.0), and the sample `extenddb version` and `serve` output in docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md. This is a minor release. Since v1.0.0, main has two features (#468, #1009) and changes that make ExtendDB answer as DynamoDB does, which docs/versioning.md ships in a minor release. It adds no catalog migration (RELEASED_THROUGH stays 12, the last id), no configuration key and no backup format version. Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468 (AT_TIMESTAMP, and the GetShardIterator answers it changes), #503, #544, #567, #765 and #774, #588, #596, #690, #1144, #1173 and #1194, next to the existing entries for #398 and #526. The #526 entry now gives the old TransactWriteItems mismatch message, and the entries are in PR order. Current Status, the General Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no migrate step, and a rollback runs the 1.0.0 binary on the same catalog, with the two limits the manual names (#526 tokens, and 1.0.0's catalog-check --fix). The rollback note of the KEK-file switch says that 1.0.0 serves a switched catalog. docs/manuals/11-deployment-guide.md: a sentence about the release before the one that carries #398 is gone. Signed-off-by: Scott Robinson <robinnsc@amazon.com>
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that carries it: the root Cargo.toml version and its 13 exact pins, the 15 workspace entries in Cargo.lock (no third-party entry changes), packaging/npm/package.json (the version and the five platform pins), the four license-notice files (regenerated with cargo-about 0.9.0), and the sample `extenddb version` and `serve` output in docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md. This is a minor release. Since v1.0.0, main has two features (#468, #1009) and changes that make ExtendDB answer as DynamoDB does, which docs/versioning.md ships in a minor release. It adds no catalog migration (RELEASED_THROUGH stays 12, the last id), no configuration key and no backup format version. Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468 (AT_TIMESTAMP, and the GetShardIterator answers it changes), #486, #503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173, #1194 and #1375, next to the existing entries for #398, #526 and #1166. The #526 entry now gives the old TransactWriteItems mismatch message, and the entries are in PR order. Current Status, the General Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no migrate step, the #1166 checks before a PostgreSQL upgrade, and a rollback runs the 1.0.0 binary on the same catalog, with the two limits the manual names (#526 tokens, and 1.0.0's catalog-check --fix). The rollback note of the KEK-file switch says that 1.0.0 serves a switched catalog. docs/manuals/11-deployment-guide.md: a sentence about the release before the one that carries #398 is gone.
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that carries it: the root Cargo.toml version and its 13 exact pins, the 15 workspace entries in Cargo.lock (no third-party entry changes), packaging/npm/package.json (the version and the five platform pins), the four license-notice files (regenerated with cargo-about 0.9.0), and the sample `extenddb version` and `serve` output in docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md. This is a minor release. Since v1.0.0, main has three features (#468, #1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which docs/versioning.md ships in a minor release. It adds no catalog migration (RELEASED_THROUGH stays 12, the last id), no configuration key and no backup format version. Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468 (AT_TIMESTAMP, and the GetShardIterator answers it changes), #486, #503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173, #1194, #1375 and #1522, next to the existing entries for #398, #526, #1166, #1449 and #1523. The #526 entry now gives the old TransactWriteItems mismatch message, the #1523 heading takes the v1.1.0: prefix, and the entries are in PR order. Current Status, the General Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no migrate step, the #1166 checks before a PostgreSQL upgrade, and a rollback runs the 1.0.0 binary on the same catalog, with the two limits the manual names (#526 tokens, and 1.0.0's catalog-check --fix). The rollback note of the KEK-file switch says that 1.0.0 serves a switched catalog. docs/manuals/11-deployment-guide.md: a sentence about the release before the one that carries #398 is gone.
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that carries it: the root Cargo.toml version and its 13 exact pins, the 15 workspace entries in Cargo.lock (no third-party entry changes), packaging/npm/package.json (the version and the five platform pins), the four license-notice files (regenerated with cargo-about 0.9.0), and the sample `extenddb version` and `serve` output in docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md. This is a minor release. Since v1.0.0, main has three features (#468, #1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which docs/versioning.md ships in a minor release. It adds no catalog migration (RELEASED_THROUGH stays 12, the last id), no configuration key and no backup format version. Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468 (AT_TIMESTAMP, and the GetShardIterator answers it changes), #486, #503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173, #1194, #1375 and #1522, next to the existing entries for #398, #526, #1166, #1449 and #1523. The #526 entry now gives the old TransactWriteItems mismatch message, the #1523 heading takes the v1.1.0: prefix, and the entries are in PR order. Current Status, the General Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no migrate step, the #1166 checks before a PostgreSQL upgrade, and a rollback runs the 1.0.0 binary on the same catalog, with the two limits the manual names (#526 tokens, and 1.0.0's catalog-check --fix). The rollback note of the KEK-file switch says that 1.0.0 serves a switched catalog. docs/manuals/11-deployment-guide.md: a sentence about the release before the one that carries #398 is gone. docs/troubleshooting.md: the bus error entry names 1.0.0 as the release that has the bug, so its line carries a version-literal-ok marker.
* chore(release): bump version to 1.1.0 Moves the workspace version from 1.0.0 to 1.1.0 on every surface that carries it: the root Cargo.toml version and its 13 exact pins, the 15 workspace entries in Cargo.lock (no third-party entry changes), packaging/npm/package.json (the version and the five platform pins), the four license-notice files (regenerated with cargo-about 0.9.0), and the sample `extenddb version` and `serve` output in docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md. This is a minor release. Since v1.0.0, main has three features (#468, #1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which docs/versioning.md ships in a minor release. It adds no catalog migration (RELEASED_THROUGH stays 12, the last id), no configuration key and no backup format version. Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468 (AT_TIMESTAMP, and the GetShardIterator answers it changes), #486, #503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173, #1194, #1375 and #1522, next to the existing entries for #398, #526, #1166, #1449 and #1523. The #526 entry now gives the old TransactWriteItems mismatch message, the #1523 heading takes the v1.1.0: prefix, and the entries are in PR order. Current Status, the General Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no migrate step, the #1166 checks before a PostgreSQL upgrade, and a rollback runs the 1.0.0 binary on the same catalog, with the two limits the manual names (#526 tokens, and 1.0.0's catalog-check --fix). The rollback note of the KEK-file switch says that 1.0.0 serves a switched catalog. docs/manuals/11-deployment-guide.md: a sentence about the release before the one that carries #398 is gone. docs/troubleshooting.md: the bus error entry names 1.0.0 as the release that has the bug, so its line carries a version-literal-ok marker. * docs(upgrade): add the v1.1.0 entry of #1290, put #1349's in order #1290 merged after this branch was rebased. It changes the answer to a request with no Authorization header, so it gets a v1.1.0 entry. The merge of main put the #1349 entry after the #1523 entry. It moves to the place of its number, beside the new #1290 entry. --------- Co-authored-by: Lee Hannigan <29015211+LeeroyHannigan@users.noreply.github.com>
What
ExecuteStatement now reads
Limitfrom a JSON number, as DynamoDB does. The reader reads the number as a double, truncates its fraction toward zero, and saturates a value outside the int32 range. So1.0and1.5read as 1, and0.5reads as 0 and gets the refusal of aLimitbelow 1. ALimitof another JSON type gets theSerializationExceptionthat DynamoDB sends for it. That check runs before the constraint checks of the request. AParametersmember of the wrong JSON type still gets its own answer first (#1202). A nullLimitstill reads as noLimit.The reader serves every statement. INSERT, UPDATE and DELETE with a
Limitof"2"or0.5ran on main. ExtendDB now refuses them, as DynamoDB does.Before this change, ExtendDB read
Limitonly when the request sent it as a JSON integer. It ran a statement with1.0,1.5or"2"as if the request had noLimit.int32_member::readincrates/engine/src/int32_member.rsreads a request member that DynamoDB reads as an int32. It takes the member's value, so other members can use it. Both callers inpartiqlpassbody.get("Limit").SingleRequestdrops the reader's error, becausecheck_execute_statementrefuses thatLimitfirst for ExecuteStatement, and DynamoDB ignores theLimitof a batch or transaction statement object. The number goes throughsaturated_int32, which this PR adds tocrates/core/src/types/query.rs.A number of at most 15 significant digits reads as on DynamoDB. Two kinds of number read otherwise (#1203):
0.99999999999999999reads as 1 and-100.999999999999999as -101, where DynamoDB truncates the written decimal to 0 and -100.1e309, fails the parse of the request body before the reader runs. Main does the same. DynamoDB accepts1e309.Why
These are DynamoDB's answers, measured in us-east-1 on 14, 18 and 20 November 2026. Each request went out twice and got the same answer both times. Each refused request named a table that does not exist.
Limit1.0,1.5"2"SerializationException:STRING_VALUE cannot be converted to Integer, before the table lookuptrue,falseSerializationException:TRUE_VALUE cannot be converted to Integer, and theFALSE_VALUEform{}SerializationException:Start of structure or map found where not expected[1]SerializationExceptionwith no message0.5,0.9999,-0.5,-0ValidationException:1 validation error detected: Value '0' at 'limit' failed to satisfy constraint: Member must have value greater than or equal to 1-1.5Value '-1'-2147483649,-1e20,-9223372036854775809Value '-2147483648'9223372036854775808nullLimitDynamoDB also answers
{"Limit": "2"}with noStatementwith theSTRING_VALUEtext, before the missing statement. INSERT, UPDATE and DELETE statements get the same answers for"2"and0.5as SELECT. A BatchExecuteStatement or ExecuteTransaction statement object with"Limit": "2"or0.5runs, so DynamoDB ignores itsLimit.Closes #1027
Testing done
cargo test -p extenddb-core --lib: 1146 passed.cargo test -p extenddb-engine --lib: 871 passed.cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine --all-targets -- -D warnings,cargo +1.97.0 fmt --all -- --checkandcargo +1.97.0 check -p extenddb-engine --no-default-features --libare clean.tests/test_partiql_select.py,tests/test_partiql_requests.pyandtests/test_partiql_limits.pypassed 222 tests.test_limit_written_as_any_json_valuesends 10 values:1.0,1.5,"2",0.5,true,false,[1],{},nulland2147483648.test_limit_on_a_write_statementsends"2"and0.5with an INSERT, an UPDATE and a DELETE.crates/engine/src/partiql/request_checks/limit_tests.rsholds everyLimitof the table above. It also holds2147483648and 4 other large values whose answers the issue gives. Each row checks the request check and theLimitthe statement then uses. Each row also checks thatSingleRequest::from_body, which reads a batch or transaction statement object, accepts thatLimit. A separate assertion checks the body with noStatement..unwrap_or_default()replaced by?, the engine test fails on its"2"row. With theLimittype check moved after the constraint checks, the assertion on the body with noStatementfails.saturated_int32reads every number as a double. For each of 20,024,022 integers, that gives the value of the integer branches of fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms #850. The bounds of i32, i64 and u64 are among them.Line counts: production +71 -3, tests +171.
Not in this PR, each in an open issue:
message, where DynamoDB sendsMessage#1143: DynamoDB sends theSerializationExceptiontext underMessage, and ExtendDB undermessage.Parametersfault first, and it runs a statement with aNextTokennumber.Other open PRs:
saturated_int32forScan, with the integer branches and a doc for theScanuse. The merge with either one conflicts in two hunks ofquery.rs. The first is the doc and the head of the function, where this side keeps one body for every use. The second isdeserialize_int32_field, which fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms #850 adds after the function. Taking this side in the first hunk and fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms #850's side in the second leaves one copy.RecoveryPeriodInDayswith the same arms and texts asint32_member::read, and repeats the arithmetic ofsaturated_int32. When this PR merges first, #934 can callint32_member::readin place of its copy, about 18 lines. Theallow(dead_code)attribute on the reader can then go too, since #934's backup code calls it in a build without thepartiqlfeature.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).
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.