Skip to content

fix(query): bound begins_with on a string sort key by the next prefix - #588

Merged
LeeroyHannigan merged 7 commits into
mainfrom
fix/cassandra-begins-with-bound
Nov 25, 2026
Merged

LeeroyHannigan merged 7 commits into
mainfrom
fix/cassandra-begins-with-bound

Conversation

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

Part of #489 (the Cassandra begins_with row). Stacked on #483, which moves the Cassandra sort key range into sk_range.rs.

A Query with begins_with(sk, :p) on a string sort key left out every key that starts with the prefix followed by U+10FFFF, on Cassandra, SQLite and PostgreSQL. It now returns them, as DynamoDB does. The #489 row says SQLite and PostgreSQL return the item; on the base of this branch both excluded it as Cassandra did, so all three change.

What happened

The three backends read begins_with(sk, p) as the range sk >= p AND sk < p + U+10FFFF. A key such as p + U+10FFFF or p + U+10FFFF + "b" starts with p and sorts at or above that bound, so it was not returned:

  • Cassandra: string_upper_bound in crates/storage-cassandra/src/data/query.rs appended \u{10FFFF}.
  • SQLite: the fragment was sk < (? || char(1114111)).
  • PostgreSQL: the fragment was sk COLLATE "C" < ($p || chr(1114111)).

MongoDB already computes the next prefix in next_string_prefix and is not changed.

What the service answers

Measured on 2026-10-25 at 22:31, 22:35 and 23:20 UTC in us-east-1, each request sent twice with the same answer. On sort keys a, ab, a + U+D7FF, a + U+E000, a + U+FFFF, a + U+10000, a + U+10FFFF, a + U+10FFFF + b, a + U+10FFFF + U+10FFFF, b, U+10FFFF, U+10FFFF + x, U+10FFFF + U+10FFFF and z, begins_with with the prefixes a, a + U+10FFFF, a + U+10FFFF + U+10FFFF, U+10FFFF, U+10FFFF + U+10FFFF, a + U+D7FF and a + U+FFFF returns exactly the keys that start with the prefix, in UTF-8 byte order, forward and reverse. Limit 1 pages over the prefixes a, a + U+10FFFF and U+10FFFF return the same keys in the same order. BETWEEN with a bound next to U+10FFFF includes both bounds. A GSI and an LSI with a string sort key answer the same way, including keys written twice.

The change

extenddb_storage::util::string_prefix_upper_bound returns the prefix with its last character replaced by the next scalar value. Trailing U+10FFFF characters are dropped first, and U+D7FF is followed by U+E000. When the prefix is empty or all U+10FFFF there is no upper bound, and the backends read from the prefix up. Cassandra and SQLite already did that for an all-0xFF binary prefix; PostgreSQL's binary bound is unchanged.

  • Cassandra: SkRange::from_condition uses it; the old string_upper_bound is removed from query.rs.
  • SQLite: build_sk_sql_and_binds binds the bound as a second value, or emits the lower bound alone.
  • PostgreSQL: the bound is a bound parameter. build_sk_sql now takes the expression maps, so it knows whether the upper bound placeholder exists, and returns a Result; bind_sk_condition binds the bound computed by the same function. A numeric prefix on a numeric sort key would pass parse_sk and bind one value for two placeholders, so build_sk_sql refuses it before building any SQL. That request answered InternalServerError on the base and still does; the service refuses it with a ValidationException, which is fix(query): classify and order key conditions on a multi-attribute GSI the way the service does #429's area.

Tests

  • crates/storage/src/util/prefix.rs: the bound for ten prefixes, and a check that the range holds every one of the measured keys that starts with the prefix and no other.
  • crates/storage-cassandra/src/data/sk_range.rs: the same check through SkRange::contains, and fix(query): refuse a Query ExclusiveStartKey the key condition cannot reach #483's pinned begins_with bound updated to ab < ac plus the unbounded U+10FFFF prefix.
  • crates/storage-postgres/src/data/query.rs: the fragment and placeholder count for a bounded and an unbounded string prefix, and the refusal of a numeric prefix on a numeric column.
  • tests/test_query_begins_with_max_character.py: 19 dual-target wire tests from the measurements.

Each of these altered versions of string_prefix_upper_bound fails tests in both crates: appending U+10FFFF again, treating a trailing U+10FFFF as unbounded, and mapping U+D7FF to U+10FFFF. Dropping the numeric refusal fails the PostgreSQL unit test, and a SQLite build that binds a second value for an unbounded prefix fails test_begins_with_pages_through_keys_after_the_prefix[max], which stops after 15 pages instead of looping.

Run locally on 2026-10-25:

Backend Head Base (#483 at ec0aab6)
Cassandra 4.1 the new file 19 passed the new file 7 of the first 17 failed
SQLite the new file 19 passed; the new file with tests/test_query_scan.py and tests/test_fgac_leading_keys.py, 162 passed at the first revision of the new file the new file 9 failed, 10 passed
PostgreSQL 16 the new file with tests/test_query_scan.py and tests/test_fgac_leading_keys.py, 164 passed the new file 7 of the first 17 failed

On SQLite the 9 that fail on the base are begins_with with a, a + U+10FFFF and U+10FFFF in both directions and the Limit 1 walks over those three prefixes; each prefix matches a key that continues with U+10FFFF. The 10 that pass are the other four prefixes in both directions, each matching only the key equal to the prefix, and the two BETWEEN tests.

On Cassandra, 16 GSI pagination tests in tests/test_query_scan.py and one LeadingKeys test failed locally at the head and on the base alike. devtools/run-tests applies index_propagation_delay_ms = 0 and two other test settings only when ./target/release/extenddb exists, and these runs used binaries from another path; with those settings applied all of them pass at the head.

Also run: cargo +1.97.0 fmt --all -- --check, cargo +1.97.0 clippy --all-targets -- -D warnings, and cargo test --workspace --exclude extenddb-storage-cassandra on stable and on 1.88.0 (1,808 passed each), plus cargo test -p extenddb-storage-cassandra --lib (71 passed) and cargo test -p extenddb-storage-postgres --lib (55 passed). The Cassandra integration tests were not run locally; their helper connects to 127.0.0.1:9042. CI runs the new file in run-integration, run-integration-sqlite, mongodb-pytest and cassandra-pytest.

Files

crates/storage-postgres/src/data/query_scan.rs was 761 lines and grows by five, because rustfmt splits the build_sk_sql call over several lines once it takes four arguments. No other file over 600 lines grows; crates/storage-cassandra/src/data/query.rs loses six.

Merging

This is based on #483's branch. After #483 merges, retarget it to main.

git merge-tree --write-tree against the open PRs that touch these files adds five conflicts. #429 calls build_sk_sql with three arguments, so whichever lands second passes maps and adds ?. The other four are adjacent lines in crates/storage/src/util/mod.rs (#401, #474, #543) and the use line in crates/storage-postgres/src/data/query.rs (#368); keep both sides.

… reach

Closes #440.

A Query ExclusiveStartKey from another partition, or outside the sort key
condition, was accepted and answered an empty page. The service refuses
it, with a sentence chosen by where the key falls. Measured on 2026-10-23
and 2026-10-24, every row repeated with identical answers, page-end rows
ten times each.

After the shape check, the service first asks whether a later key in the
scan direction can still satisfy the sort key condition, for either
partition:

- On a base table a later key must differ from the start key's sort
  value: ">" and "<" at the bound are refused, ">=" at the bound is
  accepted, "<=" at the bound refused, BETWEEN at the upper bound refused
  and at the lower bound accepted, begins_with with a key that does not
  carry the prefix refused; the reverse direction mirrors each.
- On an LSI or GSI a repeat of the start key's sort value counts as a
  later key, because index keys repeat: "<=", BETWEEN at either bound,
  ">=" in reverse, begins_with in reverse at the prefix and "=" with the
  key itself are all accepted; ">" and "<" at the bound are refused.
- The sentence is "The provided starting key does not match the range
  key predicate", with two base-table exceptions in the same partition:
  "=" with the key's own value: "The provided exclusive start key is
  invalid"; begins_with in reverse with the key exactly the prefix: "The
  provided starting key is outside query boundaries based on provided
  conditions".

Then the partition, when the key's partition differs from the condition's
(table, LSI, GSI, legacy KeyConditions, either direction):

- no sort key condition: "The provided starting key is outside query
  boundaries based on provided conditions";
- any sort key condition: "The query can return at most one row and
  cannot be restarted".

A hash-only base table refuses every ExclusiveStartKey with "The provided
exclusive start key is invalid", the queried partition included, and its
pages never carry a key. Partition values compare by value for numbers
(1, 1.0, 1e0, 01, +1 are equal); strings by UTF-8 byte order; binary by
byte order.

Page end: when a base table page ends on the last key that can satisfy
the sort key condition in the scan direction, the service returns no
LastEvaluatedKey (ten of ten for "=", BETWEEN at the upper bound, "<=" at
the bound, reverse ">=" at the bound). ExtendDB now drops the key there,
so a client that feeds every returned key back is never refused. Index
pages are unchanged.

Ordering, measured: filter and projection faults, unused names and
values, ConsistentRead on a GSI, Limit, a missing table or index, the
key size check and the start key shape check (missing or extra
attributes, wrong types) are reported first; the Select checks after.

The checks live in crates/engine/src/start_key.rs, called from
handle_query after the shape check. The sort key predicate is evaluated
with the expression evaluator on the start key's sort value, so every
operator and type follows the same comparison as the condition itself.

Tests: engine unit tests in start_key_tests.rs and start_key_range_tests.rs;
tests/python/test_query_start_key_partition.py, test_query_start_key_range.py
and test_query_start_key_index.py (162 rows, the hash-only page row
ExtendDB only) pass against the service and on SQLite and PostgreSQL, with
test_read_paging.py and the Query wire files. Pagination walks with Limit
1 to 3 in both directions feed every returned key back without a refusal.

Pre-existing, measured, not changed here: a sort key bound of another
type than the sort key answers InternalServerError (the type check in
#429); the service omits the trailing key when the next row exists but
fails the condition ("sk < z" with Limit equal to the matches), which
needs a storage look-ahead and is filed separately.
…y sentence matches the other backends

(cherry picked from commit 0294106)
…key bound

A Query with a sort key condition and an ExclusiveStartKey on the same
partition produced two restrictions on the same side of the clustering
column (`sk_s >= ? AND sk_s > ?`), which Cassandra refuses with "More than
one restriction was found for the start bound on sk_s" (end bound in
reverse; "cannot be restricted by both an equality and an inequality
relation" on the index same-sort-value sub-query). The server answered
InternalServerError. The defect exists on main for every such request.

The Cassandra Query path now builds the sort key range as at most one lower
and one upper bound (SkRange), replaces the bound on the near side of the
scan direction with a strict bound at the start key when the start key is
at or past it, and renders the range once per CQL statement. The index
two-query path runs its same-sort-value sub-query only when the start key's
sort value lies inside the condition's range, and renders the merged range
for the advance sub-query. Binds follow the rendered clauses in order.

Unit tests pin the merge for a lower bound, a bound equal to the start key,
a start key short of the bound, BETWEEN in both directions, equality,
begins_with in reverse, strict and inclusive containment, and numeric
ordering. The three Query start key wire files pass on Cassandra (162
rows), as do test_query_scan, test_composite_keys, test_gsi,
test_scan_edge_cases and the storage direct_integration suite.
…roduces

Equality renders as one clause, BETWEEN as two inclusive bounds, and
begins_with as an inclusive prefix with an exclusive upper bound: the
prefix plus U+10FFFF for strings, the incremented last byte below 0xFF
for binary, and no upper bound for an all-0xFF prefix.
@LeeroyHannigan
LeeroyHannigan force-pushed the fix/440-start-key-partition branch from ec0aab6 to dd5c7ed Compare October 29, 2026 23:54
Query with begins_with(sk, :p) on a string sort key read the range
sk >= p AND sk < p + U+10FFFF on Cassandra, SQLite and PostgreSQL. A key that
starts with p followed by U+10FFFF (p + U+10FFFF, p + U+10FFFF + "b") sorts
at or above that bound and was left out. Amazon DynamoDB returns those keys
on base tables, GSIs and LSIs (measured 2026-10-25 at 22:31, 22:35 and 23:20
UTC, each request twice), ordered by their UTF-8 bytes, which is how the
three backends compare string sort keys.

The new extenddb_storage::util::string_prefix_upper_bound returns the prefix
with its last character replaced by the next scalar value: trailing U+10FFFF
characters are dropped first, and U+D7FF is followed by U+E000. A prefix that
is empty or all U+10FFFF has no upper bound, and the three backends then read
from the prefix up. MongoDB already computed the same bound in its own
next_string_prefix and is unchanged.

On PostgreSQL the bound is now a bound parameter instead of `$p || chr(1114111)`,
so build_sk_sql takes the expression maps to know whether the placeholder
exists, and bind_sk_condition binds the bound it computes from the same
function. A numeric prefix on a numeric sort key is refused in build_sk_sql
before any SQL is built, so the placeholder and bind counts cannot disagree;
it answered InternalServerError before and still does. On Cassandra the old
string_upper_bound leaves query.rs.
Dual-target wire tests from measurements on 2026-10-25 at 22:31 and 22:35
UTC: begins_with with prefixes ending in a, U+10FFFF, U+D7FF and U+FFFF,
forward and reverse; Limit 1 pages over the prefixes a, a + U+10FFFF and
U+10FFFF; and two BETWEEN ranges whose bounds sit next to U+10FFFF. The
service returns every key that starts with the prefix, in UTF-8 byte order.
@LeeroyHannigan
LeeroyHannigan force-pushed the fix/cassandra-begins-with-bound branch from 38d70bf to ab43c05 Compare October 30, 2026 10:04
Base automatically changed from fix/440-start-key-partition to main November 3, 2026 09:40
crates/storage-cassandra/src/data/query.rs: main carries the
string_upper_bound helper from the start key change (#483), which
appends U+10FFFF to a begins_with prefix. This branch removes the helper
because the bound is now the next prefix from
extenddb_storage::util::string_prefix_upper_bound. The merged file has
no string_upper_bound; nothing else in the tree calls it.

crates/storage-cassandra/src/data/sk_range.rs: main added this file
with #483, using string_upper_bound for the begins_with upper bound and
pinning that bound in two tests. This branch rewrote the same places to
use string_prefix_upper_bound, with no bound for a prefix of only
U+10FFFF, and added the test that checks the range against the keys
measured on the service. The merged file keeps this branch's version of
every conflicting region; main's structure outside them is unchanged.

crates/storage-postgres/src/data/query_scan.rs: main (#429) selects the
sort key column with sk_column_n(pos, sk_type) from the RANGE attribute
the condition names and keeps the bound type in sk_cond_type. This
branch passes the expression maps to build_sk_sql and propagates its
Result. The merged call is build_sk_sql(sk_cond, &sk_column_n(pos,
sk_type), maps, &mut param_idx)? with main's surrounding code.
@LeeroyHannigan LeeroyHannigan added the v1 Needed for the 1.0 release label Nov 6, 2026
@demohan demohan self-assigned this Nov 24, 2026

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

The bound is right on every backend. The next-prefix function puts a key in the range exactly when it starts with the prefix, across 73,639,580 prefix and key pairs over 13 edge characters, and gives the right bound with each of the 1,112,064 code points as the prefix's last character: U+D7FF becomes U+E000, a trailing U+10FFFF is dropped, and only an empty or all-U+10FFFF prefix has no upper bound. 735 request shapes, run twice each on the service in us-east-1 and on SQLite, PostgreSQL 16 and Cassandra 4.1 builds of this head and of main 89fc971, compared items in order, Count, ScannedCount, LastEvaluatedKey, ConsumedCapacity and errors. They covered U+10FFFF, U+FFFF, the surrogate gap, multi-byte and whole-key prefixes and all-U+10FFFF prefixes up to 1024 bytes, on the base table, an LSI and a GSI, both directions, Limit 1 and 4 walked to the end, and 13 start keys placed around the bound. 151 that main answered wrongly now match, the three backends answer alike, and no request that matched on main differs. MongoDB, which this PR leaves alone, matches on 144 of 144 shapes. With 3000-byte items, prefix a costs 3.0 and 1.5 as on the service, where main charged 1.0 and 0.5. SQLite and PostgreSQL still use the index with the same plans as main (PostgreSQL (sk_s >= $2) AND (sk_s < $3) under custom and generic plans), and the placeholder count always matches the bound values.

fmt, clippy and the 1.88 MSRV check are clean, 3,151 workspace tests pass, the new file passes 19 of 19 on all four backends and on the service and fails 9 on main, CI is green on all four backends, and nine negative controls are each caught.

Approving. The items below are small and can land in this PR or a follow-up.

) -> Result<bool, StorageError> {
match resolve_expr_to_av(prefix, maps)? {
AttributeValue::S(s) => Ok(string_prefix_upper_bound(&s).is_some()),
AttributeValue::N(_) if sk_col.ends_with("_n") => Err(StorageError::Internal(

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.

Since #429, refuse_begins_with_on_number (engine/src/query.rs:677) refuses a numeric prefix on a numeric sort key with the service's ValidationException ... operator or function: begins_with, operand type: N before storage runs, on the base table, a GSI and KeyConditions. So the body's "answered InternalServerError on the base and still does" no longer holds, and this arm is reached only by a direct storage caller. It returns Internal where SQLite (query.rs:116) and Cassandra (sk_range.rs:75) return Validation; returning Validation would make the three alike.

@@ -0,0 +1,140 @@
# Copyright 2026 ExtendDB contributors

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.

No test queries an index, and the fix changes index queries. On an LSI and a GSI string sort key, 56 shapes give 0 mismatches against the service on all four backends here, and 24 on SQLite, PostgreSQL and Cassandra without the fix. The bound is built in one place per backend, so a row on each index type would hold it.

*param_idx += 2;
Ok(SkSqlInfo { fragment: frag })
} else {
// A prefix of only U+10FFFF has no upper bound.

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.

An empty prefix takes this branch too and reaches storage, so "a prefix of only U+10FFFF" can say "an empty prefix or one of only U+10FFFF". The same comment is in storage-sqlite/src/data/query.rs:108.

@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Nov 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 24, 2026
@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 80490c6 Nov 25, 2026
39 checks passed
@LeeroyHannigan
LeeroyHannigan deleted the fix/cassandra-begins-with-bound branch November 25, 2026 11:31
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 80490c6, eight commits after the last merge (#596, #1173,
#398, #428, #544, #567, #584 and #588). One file conflicted:
crates/engine/src/query.rs.

#544 moves the Limit check and the parameter mix check of Query into
validate_query_request_body, which reads the raw body before
deserialization. This branch moves the same two checks to the start of
the handler, after deserialization. The merge keeps the checks of #544
and drops the copies of this branch, which no request can reach. It
keeps has_cond_op for the ConditionalOperator check.

The conflict hunks in handle_query:

- At the old Limit check, both sides remove the check. The merge keeps
  the comment of #544.
- Next, this branch keeps the variables of the mix check, and main
  keeps the index key schema. The merge keeps the key schema where this
  branch has it. It drops the mix check variables, which nothing reads
  now, and keeps the comment of #544 and has_cond_op.
- Before the ExclusiveStartKey check, this branch removes the filter
  operand checks, because its semantic pass runs them at parse time.
  #544 adds validate_key_condition_types there. The merge keeps the
  type check and drops the filter checks.

#544 refuses a begins_with value that is not an S or a B ahead of an
unused value (rows q5 and p4 of tests/test_query_key_value_types.py,
measured 2026-11-06). This branch checks unused values before the
table lookup, so the merged code gave the unused value message for
those two rows. The merge calls refuse_begins_with_on_number after the
key condition parse and removes the later call. The values of legacy
KeyConditions pass validate_legacy_conditions before that point.

Git merged four other files that both sides change, with no overlap:
crates/core/src/expression/key_condition.rs, crates/engine/src/lib.rs,
crates/storage-cassandra/tests/common/mod.rs and
docs/differences-from-dynamodb.md.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 80490c6, six commits after the last merge (#398, #428,
#544, #567, #584 and #588). Two files conflicted.

crates/engine/src/lib.rs: this branch adds query_key_size_tests and
#544 adds query_key_values to the module list. The merge keeps both in
name order.

crates/engine/src/query.rs, two hunks in handle_query:

- This branch moves validate_query_select_index_support after the start
  key checks, and #544 replaces the Limit check with a comment. The
  merge removes the early Select check and keeps the comment of #544.
- Before the ExclusiveStartKey check, this branch adds
  validate_query_key_sizes and #544 adds validate_key_condition_types.
  The merge runs the type check first, because the key size comment
  records a wrong-typed key value ahead of the size (measured
  2026-10-23). On a single-attribute key schema #544 checks the type
  there and not in resolve_key_schema_with, so the key size comment now
  says "checked above".
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 80490c6, six commits after the last merge (#398, #428,
#544, #567, #584 and #588). One file conflicted:
crates/engine/src/query.rs.

This branch moves the table lookup, the index lookup and the index key
schema below the request-stage checks. #544 moves the Limit check and
the parameter mix check into validate_query_request_body, which reads
the raw body before deserialization. Three conflict hunks in
handle_query follow from this:

- After deserialization, this branch keeps the Limit check and main
  keeps the table lookup. The merge keeps the lookup where this branch
  has it and puts the comment of #544 in place of the Limit check.
- Next, this branch keeps the variables of the mix check and main keeps
  the index key schema. The merge keeps the key schema where this
  branch has it. It drops the mix check variables, which nothing reads
  now, and keeps the comment of #544 and has_cond_op.
- Before the ExclusiveStartKey check, this branch removes the filter
  operand checks, because its semantic pass runs them at parse time.
  #544 adds validate_key_condition_types there. The merge keeps the
  type check and drops the filter checks.

#544 refuses a begins_with value that is not an S or a B ahead of an
unused value (rows q5 and p4 of tests/test_query_key_value_types.py,
measured 2026-11-06). This branch checks unused values before the
table lookup, so the merged code gave the unused value message for
those two rows. The merge calls refuse_begins_with_on_number after the
key condition parse and removes the later call. The values of legacy
KeyConditions pass validate_key_conditions before that point.

Git merged four other files that both sides change, with no overlap:
crates/core/src/expression/key_condition.rs, crates/engine/src/lib.rs,
docs/differences-from-dynamodb.md and crates/engine/src/decimal_digits.rs,
which both sides add with the same content.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 80490c6, 43 commits after the base of this branch. One
file conflicted: crates/storage/src/util/mod.rs. #588 adds mod prefix
and pub use prefix::string_prefix_upper_bound, and this branch adds mod
scan_segment and pub use scan_segment::scan_segment. The merge keeps
all four lines, each list in name order.

Git merged eight other files that both sides change, with no overlap:
Cargo.lock, crates/storage-sqlite/src/data/query_scan.rs,
crates/storage-sqlite/src/lib.rs,
crates/storage-sqlite/src/sqlite_util.rs,
crates/storage-sqlite/src/store.rs, crates/storage/Cargo.toml,
crates/storage/src/lib.rs and tests/conftest.py.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 14ade59 (#864), ten commits after the last merge. Two files
conflicted:

- docs/manuals/07-upgrade-manual.md: #398 and this branch each add a
  v1.1.0 entry at the top of "Behavior Changes by Release". The merge
  keeps both entries whole, the #398 entry first and this branch's U+0000
  entry after it.
- crates/storage-postgres/src/data/query.rs: #588 adds
  string_prefix_upper_bound to the extenddb_storage::util import, and
  this branch imports parse_sk and pk_to_text from super::key_text. The
  merge imports sk_info and string_prefix_upper_bound from util and keeps
  the key_text import. bind_sk_condition computes the begins_with bound
  of #588 from the value that key_text::parse_sk returns. So a prefix
  that holds U+0000 still gets the ValidationException of this branch
  before the statement runs.

The other files that both sides change merged without a conflict. In
each one the two sides change different lines:

- crates/storage-postgres/src/data/query_scan.rs: #588 passes the
  expression maps to build_sk_sql, and this branch imports from key_text.
- crates/storage/src/util/mod.rs: the prefix module of #588 and the
  control_chars module of this branch.
- crates/storage-cassandra/src/migrations/mod.rs and
  crates/storage-sqlite/src/migrations/mod.rs: #1173 and #1009 change
  imports and module declarations, and this branch adds the
  EscapeControlChars arm.
- crates/storage/src/backup_catalog.rs: #1009 adds clippy allows, and
  this branch changes a doc comment.
- CONTRIBUTING.md, docs/design/04-component-storage.md and
  docs/differences-from-dynamodb.md: each side changes its own sections.

Main adds no catalog migration, so migration 13 keeps its number.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 14ade59. This branch last had main at 018715e, through
fix/query-key-value-types. Since then, these eleven commits merged
into main: #1280, #1009, #596, #1173, #398, #428, #544, #567, #584,
#588 and #864.

#544 is the squash of fix/query-key-value-types, which was the base
branch of this PR. This branch already holds the last head of that
branch, 31c5f3d. Main has the same version of each conflicted file as
31c5f3d. So each conflict hunk has the lines of #544 on one side.
The other side has the change of this branch to the same lines. The
merge keeps the version of this branch in each file:

- crates/engine/src/query_key_values.rs: this branch makes two
  constants and four functions pub(crate) for the Scan checks, and
  re-exports three functions of unreadable.rs. It reads a number in
  Segment and TotalSegments as it reads one in Limit, with the dates
  in the doc comment of shape_fault_first. It passes
  validate_no_parameter_mix to unreadable_value_checks.
- crates/engine/src/query_key_values/unreadable.rs: this branch makes
  three functions pub(crate). unreadable_value_checks takes the
  parameter mix check as a parameter, so this branch deletes the
  import of validate_no_parameter_mix.
- crates/server/src/request_helpers.rs: this branch runs the Scan
  request checks before the IAM decision, as main does for Query.
- tests/test_query_leading_keys_values.py: this branch moves the setup
  of TestLeadingKeysWithAnInvalidKeyValue to the base class
  ManagementPrincipals, which
  tests/test_scan_checks_before_authorization.py imports.

Git merged crates/engine/src/lib.rs with no conflict. Main compiles
three modules only off wasm32 (backup, import_export_io and
private_fs), and adds the modules backup_requests and pre_dispatch.
This branch adds the module scan_request and changes the doc comment
of validate_enum_fields.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 14ade59. This branch last had main at 018715e, through
fix/query-key-value-types. Since then, these eleven commits merged
into main: #1280, #1009, #596, #1173, #398, #428, #544, #567, #584,
#588 and #864.

#544 is the squash of fix/query-key-value-types, which was the base
branch of this PR. This branch already holds the last head of that
branch, 31c5f3d. Main has the same version of each conflicted file as
31c5f3d. So each conflict hunk has the lines of #544 on one side.
The other side has the change of this branch to the same lines. The
merge keeps the version of this branch in each file:

- crates/engine/src/query_key_values.rs: the dates and the order in
  the module and function doc comments, the call of
  validate_condition_value_numbers, and the two functions
  validate_condition_value_numbers and refuse_first_fault.
- crates/engine/src/query_key_values/request_order_tests.rs: the
  import of Value and the test
  legacy_condition_values_get_the_number_check.
- tests/test_query_key_value_types.py: the dates in the docstring, the
  nn_table fixture and the helpers eq, N1, KC_ABC and QF_BOB. The merge
  also keeps the rows k1 to k16, and nn_table in the tables fixture and
  the control test.

Git merged crates/engine/src/lib.rs with no conflict. This branch
changes that file only through the commits of #544, so the merged file
is the file of main.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 14ade59. This branch last had main at 018715e, through
fix/query-key-value-types. Since then, these eleven commits merged
into main: #1280, #1009, #596, #1173, #398, #428, #544, #567, #584,
#588 and #864.

#544 is the squash of fix/query-key-value-types, which was the base
branch of this PR. This branch already holds the last head of that
branch, 31c5f3d. Main has the same version of each conflicted file as
31c5f3d. So each conflict hunk has the lines of #544 on one side.
The other side has the change of this branch to the same lines. The
merge keeps the version of this branch in each file:

- crates/core/src/partiql/params.rs: this branch deletes the two
  base64 imports, because decode_base64 replaces check_base64.
- crates/core/src/types/attribute_value.rs: this branch adds
  BASE64_TEXTS, decode_base64 and is_base64_refusal after the two
  constants that #544 makes public.
- crates/core/src/types/mod.rs: this branch adds decode_base64 and
  is_base64_refusal to the names that #544 re-exports.
- tests/test_query_leading_keys_values.py and
  tests/test_query_value_shapes.py: this branch moves _raw_query to
  tests/raw_signed_request.py as client_post, and calls client_post in
  its place. No other test file on main calls _raw_query.

Git merged crates/engine/src/lib.rs with no conflict. Main compiles
three modules only off wasm32 (backup, import_export_io and
private_fs), and adds the modules backup_requests and pre_dispatch.
This branch adds serialization_exception and calls it from
deserialize_error.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
The base merges main at 14ade59. That brings #544 as a squash and
ten other commits: #1280, #1009, #596, #1173, #398, #428, #567, #584,
#588 and #864. The merge has no conflict. No file has changes on both
sides.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
The base merges main at 14ade59. That brings #544 as a squash and
ten other commits: #1280, #1009, #596, #1173, #398, #428, #567, #584,
#588 and #864. The merge has no conflict. No file has changes on both
sides.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
The base merges main at 14ade59. That brings #544 as a squash and
ten other commits: #1280, #1009, #596, #1173, #398, #428, #567, #584,
#588 and #864.

One file conflicted: crates/engine/src/import_export.rs. #1009 moves
the body of handle_import_table to import_table in the new file
crates/engine/src/import_export/files.rs. The wasm32 build replaces
that file with a stand-in that refuses the operation.
handle_import_table keeps the enabled check and calls
files::import_table.

This branch changes the body that #1009 moves. When read_items finds a
line that it cannot read, the import keeps the items before that line.
It counts the line as one error and reads no more of the file.

The merge keeps the code of main in import_export.rs, with the doc
comment of this branch on handle_import_table. It makes the three
changes of this branch to the body in files.rs:

- The variable read holds the result of read_items: the items and the
  line that the reader cannot read.
- The loop takes the items, then that line. At that line it logs the
  line number and the fault, counts one error and ends the import.
- The comment over the FAILED status adds the date 2026-11-22, for the
  lines that the import cannot read.

The body of import_table in files.rs is now the same as the body of
handle_import_table at the head of this branch.

Git merged docs/manuals/07-upgrade-manual.md with no conflict. #398
adds its v1.1.0 entry at the top of "Behavior Changes by Release".
This branch adds its v1.1.0 entry at the end of that section.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
The base merges main at 14ade59. That brings #544 as a squash and
ten other commits: #1280, #1009, #596, #1173, #398, #428, #567, #584,
#588 and #864. The merge has no conflict.

Git merged crates/engine/src/lib.rs, the one file with changes on both
sides. Main compiles three modules only off wasm32 (backup,
import_export_io and private_fs), and adds the modules backup_requests
and pre_dispatch. This branch adds single_write_refusal after
deserialize_error.
annguy3n added a commit to annguy3n/extenddb that referenced this pull request Nov 25, 2026
Resolve the Cargo.lock merge conflict with main and adapt the Cloud Bigtable
storage backend to upstream changes:

- Implement StreamEngine::first_sequence_number_at_or_after for AT_TIMESTAMP
  shard iterators (ExtendDB#468): capture (epoch_secs, epoch_millis) from a single UTC
  clock read (current_stream_clock / build_record_with_timestamp), persist
  created_at_ms on TxnStreamRecord and stream_record:* rows (falling back to
  ApproximateCreationDateTime * 1_000 for legacy rows and direct writes via
  decode_stored_record), align stream retention cleanup cutoffs to milliseconds
  (ExtendDB#503), and fence first_sequence_number_at_or_after, latest_sequence_for_shard,
  and ensure_shard_past_record against advancing or exposing records past
  ShardMeta.ending_sequence_number.
- Add unit and live cbtemulator integration tests covering AT_TIMESTAMP
  millisecond boundaries, cross-shard isolation, backward clock steps, legacy
  row fallback, multi-page seeks, closed-shard fencing, millisecond retention
  pruning, and begins_with / BETWEEN near U+10FFFF and binary 0xFF across base
  tables, GSIs, and LSIs (ExtendDB#588).
- Update docs/differences-from-dynamodb.md AT_TIMESTAMP row for all five
  backends.
@robinnsc robinnsc mentioned this pull request Nov 25, 2026
6 of 8 tasks
robinnsc added a commit that referenced this pull request Nov 26, 2026
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>
robinnsc added a commit that referenced this pull request Nov 26, 2026
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.
robinnsc added a commit that referenced this pull request Nov 27, 2026
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.
robinnsc added a commit that referenced this pull request Nov 27, 2026
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.
LeeroyHannigan added a commit that referenced this pull request Nov 27, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 Needed for the 1.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants