Repository navigation
feat(streams): AT_TIMESTAMP shard iterator on all four backends - #468
Conversation
f1708df to
7aebd15
Compare
DynamoDB Streams added the AT_TIMESTAMP shard iterator type on 2026-10-15. GetShardIterator takes ShardIteratorType AT_TIMESTAMP with a Timestamp member (epoch seconds, fractional milliseconds allowed) and returns an iterator positioned at the first record created at or after that time. ExtendDB answered SerializationException for the type. Behaviour, measured on the service (us-east-1, 2026-10-23; raw requests and responses recorded in the issue): - The seek compares at millisecond precision. A Timestamp of 14:04:08.5 skips records written at 14:04:08.050 to .071 and starts at the next group, while the integer 14:04:08 includes them. - A timestamp older than the oldest retained record returns everything with no error; one past the newest record positions after it, so GetRecords returns records written from then on. - Validation order: the type enum, then Timestamp presence or absence for the type, then SequenceNumber presence or absence for the type, then the future check, then stream and shard existence. Every parameter message carries the prefix "One or more parameter values were invalid: ". - The future buffer is about one second: now + 1 s was accepted, now + 2 s refused. A Timestamp sent as a JSON string, boolean or object is a SerializationException; null, zero and negative are the "Valid timestamp must be provided" refusal. Implementation: - ShardIteratorType::AtTimestamp and GetShardIteratorInput.timestamp. - The handler refuses a missing or null type with the service's "Member must not be null" text, pre-validates the type enum (the service's member order, rendered without the offending value as the service does), refuses a Timestamp whose JSON type is not a number with the service's deserializer texts, then runs the parameter rules in streams_iterator_params.rs. The same module now owns the AT_SEQUENCE_NUMBER to AFTER conversion. - StreamEngine::first_sequence_number_at_or_after(shard_id, at_ms) on all four backends, each in its own stream_at_timestamp.rs. SQLite, PostgreSQL and MongoDB take MIN(sequence_number) over created_at >= T. Cassandra seeks the clustering key with the HLC millisecond prefix of T as the lower bound and filters created_at within that partition: created_at_ms <= hlc_ms holds for every record since the one-clock-read change, so created_at_ms >= T implies the sequence is at or after the bound and no qualifying record is skipped, and the filter drops a record written under a clamped clock whose prefix clears the bound while its created_at is before T. MongoDB and SQLite gain a (shard_id, created_at) index for the seek; on MongoDB the existing index walked 50,000 documents (84 ms) for a mid-range seek over a 100,000-record shard. - Resolution: a match positions AT that record (the existing n - 1 conversion); no match positions after the newest record. The tip is read before the seek so a write landing between the two reads is not skipped. - TRIM_HORIZON and LATEST with a SequenceNumber now refuse as the service does (#461), since the same check covers them. Tests: tests/test_streams_at_timestamp.py, eleven tests with every expected value from the measurement, including the at-or-after boundary at a record's own millisecond, passing on SQLite, PostgreSQL, MongoDB and Cassandra; nine of the original ten fail against a server built from the base commit. The existing tests/test_streams.py passes on all four. Unit tests cover the millisecond floor, the validation order and texts, the Timestamp JSON-type texts, the future buffer, the Cassandra bound, and the tip-then-seek order against a double that writes during the tip read (the test fails with the reads swapped). A Cassandra direct test inserts a clamped record and asserts the seek does not return it for a T after its created_at. Docs: a Streams section in differences-from-dynamodb.md, the usage guide example, the streams design doc, and EXTENDDB_STREAM_SINCE in samples/stream_consumer.py. Closes #460. Closes #461.
7aebd15 to
a5f4390
Compare
0bc15d3 to
4444bc6
Compare
crates/engine/src/streams.rs keeps the ShardId and SequenceNumber length constraints, the shard_lookup_error answer and the streams_tests.rs module from main. From this branch it keeps the ShardIteratorType checks, the Timestamp rules, the AT_TIMESTAMP resolution and the at_sequence_to_after conversion. The length constraints run before the per-type parameter rules, as the model constraints do in the other handlers. The at_sequence_number_padding test leaves streams_tests.rs, because this branch moved it to streams_iterator_params.rs. crates/storage-postgres/src/lib.rs keeps the snapshot_engine exports from main and the stream_at_timestamp module from this branch. crates/storage-sqlite/src/lib.rs keeps the stream_lifecycle module from main and the stream_at_timestamp module from this branch. crates/storage-sqlite/src/schema.rs and crates/storage-mongodb/src/bootstrapper.rs keep the side from main. Main moved both schemas into numbered migrations. The (shard_id, created_at) index on SQLite and MongoDB therefore waits for a migration follow-up, as it already does for PostgreSQL.
…IMESTAMP to main Main names each stream's shards by stream. On Cassandra it keeps a shard's records in the partition of its index, which every stream of the table shares. The Cassandra seek bound the client's shard id, which no record row carries, so every AT_TIMESTAMP iterator started after the newest record. The seek now reads the shard's partition and sequence range through shard_range, as latest_sequence_number does. Its lower bound is the higher of the shard's start (exclusive) and the time bound (inclusive), because CQL takes one start bound per clustering column. The direct test seeks with the stream's shard id. A new test checks that a closed shard and the next stream's shard each answer only their own records. The missing ShardIteratorType sentence now comes from the constraint helper that main added for the streams constraint sentences. On PostgreSQL the seek numbers the shard's committed writes first, as the LATEST read does, so it sees every write that committed before it. The Shards row in docs/differences-from-dynamodb.md now says four shards per stream that close when a disable closes the stream, which is what main does. The AT_TIMESTAMP usage example takes a <shard-id> placeholder, because main refuses a shard id under 28 characters.
demohan
left a comment
There was a problem hiding this comment.
Three items block merge and five more need changes; each is inline with its measurement. The first is the AT_TIMESTAMP rounding. The second and third are answers that main gives as the service does and this branch changes. The Cassandra item comes from main moving under the branch (#945). Once the inline items are done, it merges.
Two further items are separate issues, not conditions. First, GetRecords returns a NextShardIterator on a closed shard read to its end, which the service omits. Second, the non-Timestamp member type texts differ from the service on main as well.
| /// Saturates at the `i64` edge; the caller has already refused values that | ||
| /// are not positive and finite. | ||
| pub(crate) fn timestamp_to_millis(secs: f64) -> i64 { | ||
| let ms = (secs * 1000.0).floor(); |
There was a problem hiding this comment.
The service rounds Timestamp to the nearest millisecond. For a record whose last including millisecond was 1795127326672, 1795127326.6724900 returned the record and 1795127326.6725100 did not, in two rounds on us-east-1. This floor returns the record for both. The same rounding explains the small values: the service refuses 0.0001 and 0.0004 with "Valid timestamp must be provided when the iterator type is AT_TIMESTAMP", and accepts 0.0005 and 0.0009. This code accepts all four. The test at line 168 and its comment at line 185 encode the floor.
There was a problem hiding this comment.
Confirmed on us-east-1 on 2026-11-20: for a record at millisecond ...389, 1795171973.3894900 returns it and 1795171973.3895000 does not. The service refuses 0.0004 and accepts 0.0005. The conversion now rounds half up and refuses a result under one millisecond, in 944ebe6. The unit test table carries those literals, and the floor fails it.
| ShardIteratorType::AtSequenceNumber | ShardIteratorType::AfterSequenceNumber | ||
| ); | ||
|
|
||
| // Timestamp presence or absence for the type comes first. |
There was a problem hiding this comment.
For AT_SEQUENCE_NUMBER and AFTER_SEQUENCE_NUMBER, the service checks a missing SequenceNumber before the Timestamp rule. {"ShardIteratorType": "AT_SEQUENCE_NUMBER", "Timestamp": <past>} with no SequenceNumber returns "One or more parameter values were invalid: SequenceNumber cannot be null" on the service and on main, in two rounds. This branch returns "Timestamp should not be passed for this iterator type". With a SequenceNumber present, the service checks Timestamp first, as here.
There was a problem hiding this comment.
Measured the same on 2026-11-20 for AT_SEQUENCE_NUMBER and AFTER_SEQUENCE_NUMBER. A Timestamp with no SequenceNumber gets "SequenceNumber cannot be null", and with a SequenceNumber it gets the Timestamp refusal. The two types now check the SequenceNumber first, in 944ebe6, with the rows in the unit test table and in the wire matrix.
| ))); | ||
| } | ||
|
|
||
| let at_timestamp_ms = iterator_params::validate_iterator_parameters(&input)?; |
There was a problem hiding this comment.
For TRIM_HORIZON and LATEST, the service checks the shard before it refuses a SequenceNumber. On shardId-00000000000000000000-ffffffff, with SequenceNumber: "1500001062930352702901", the service and main return "ResourceNotFoundException: Requested resource not found: Shard does not exist" in two rounds. This branch returns "SequenceNumber should not be passed for this iterator type". For AT_TIMESTAMP, the service refuses the SequenceNumber before the shard check, so only the TRIM_HORIZON and LATEST refusal moves after validate_shard.
There was a problem hiding this comment.
Measured on 2026-11-20: TRIM_HORIZON and LATEST with a SequenceNumber on shardId-00000000000000000000-ffffffff get "Shard does not exist". On a stream that does not exist they get "Stream does not exist". A Timestamp on those types is still refused before the lookup, and AT_TIMESTAMP refuses its SequenceNumber before the lookup. In 944ebe6 the SequenceNumber refusal for TRIM_HORIZON and LATEST runs after the shard lookup, and the wire test covers the missing-shard rows.
| }; | ||
| let result = self | ||
| .session | ||
| .query_with_values(&query, values) |
There was a problem hiding this comment.
Main now routes every Cassandra statement through PolicySession::run (#945). With this branch merged onto deed346, cargo test -p extenddb-storage-cassandra --test consistency_policy fails with "src/stream_at_timestamp.rs:77: .query_with_values(; use PolicySession::run". Stmt::Read, as last_sequence_in uses, also gives the seek the LOCAL_QUORUM level of the tip read.
There was a problem hiding this comment.
Merged main and reproduced the consistency_policy failure at that line. The seek now goes through query_rows, the Stmt::Read path last_sequence_in uses, in 73d45e8. The direct stream tests pass on a local Cassandra 4.1 node.
| // offending value (measured 2026-10-23): a missing member is "Member must | ||
| // not be null", a bad member lists the set in this order. | ||
| let type_value = body.get("ShardIteratorType"); | ||
| if type_value.is_none_or(serde_json::Value::is_null) { |
There was a problem hiding this comment.
The service reports a missing ShardIteratorType together with the other constraint violations. {"StreamArn": "<arn>", "ShardId": "shardId-short"} returns "2 validation errors detected: Value at 'shardIteratorType' failed to satisfy constraint: Member must not be null; Value at 'shardId' failed to satisfy constraint: Member must have length greater than or equal to 28". This returns one error. The enum violation combines the same way.
There was a problem hiding this comment.
Measured on 2026-11-20, and a short SequenceNumber joins too. No type, a short ShardId and SequenceNumber "0" give "3 validation errors detected" in the order sequenceNumber, shardIteratorType, shardId. The handler now collects the three constraints into one message, in 944ebe6, and the wire test has the two-error and three-error rows.
There was a problem hiding this comment.
Measured again on 2026-11-23: a missing or null ShardId joins the same message. {"StreamArn": "<arn>", "SequenceNumber": "0"} returns "3 validation errors detected". Its clauses are the sequenceNumber length, the shardIteratorType null and "Value at 'shardId' failed to satisfy constraint: Member must not be null", in that order. {"StreamArn": "<arn>", "ShardIteratorType": "TRIM_HORIZON"} returns the shardId null clause alone. An absent, null or empty StreamArn is "Invalid StreamArn" on its own, before any clause: {"ShardId": "shardId-short"} gets that text and no clause. The handler does both in fc87678, and the unit table and the wire test have the rows.
| "not be null", | ||
| ))); | ||
| } | ||
| crate::validate_enum_fields( |
There was a problem hiding this comment.
The service answers a member JSON-type error before the enum check. ShardIteratorType: "BOGUS" with Timestamp: "1792764248" returns "SerializationException: STRING_VALUE cannot be converted to Date", and with SequenceNumber: 5 it returns "NUMBER_VALUE cannot be converted to String". This returns the enum ValidationException. The Timestamp shape check at line 141 also runs before the SequenceNumber type error, which the service reports first.
There was a problem hiding this comment.
Measured on 2026-11-20, and the service reports the first ill-typed member in body order. "SequenceNumber": 5 before "Timestamp": "x" gives the String text, the other way round gives the Date text. The parsed body keeps no order, so 944ebe6 reads the members in the model order, SequenceNumber then Timestamp, which is the order the SDKs send. The type check now runs before the enum and null checks and before the length constraints, as measured.
| Value::String(_) => "STRING_VALUE cannot be converted to Date", | ||
| Value::Bool(true) => "TRUE_VALUE cannot be converted to Date", | ||
| Value::Bool(false) => "FALSE_VALUE cannot be converted to Date", | ||
| Value::Array(_) | Value::Object(_) => "Start of structure or map found where not expected", |
There was a problem hiding this comment.
For Timestamp: [], the service returns {"__type":"com.amazon.coral.service#SerializationException"} with no message, in two rounds. An object returns "Start of structure or map found where not expected", as here. The assertion at line 307 expects the object text for an array.
There was a problem hiding this comment.
Confirmed on 2026-11-20 for [] and [1]: a SerializationException with no message member. An array now maps to an empty message, which the error response omits, in 944ebe6. The unit row and the wire row expect "".
| for r in recs: | ||
| assert r["dynamodb"]["ApproximateCreationDateTime"].microsecond == 0 | ||
|
|
||
| def test_boundary_is_at_or_after_the_record_millisecond(self, dynamodb_client, streams_client, stream_table): |
There was a problem hiding this comment.
This test and the one at line 173 still pass when the seek's >= becomes > on SQLite, PostgreSQL or MongoDB, and when PostgreSQL stores created_at truncated to the second. The bisect asserts only that some millisecond includes the record and the next excludes it. Asserting that the bisected millisecond lies inside the write's wall-clock window, and seeking a fraction inside a mid-second write, pins both.
There was a problem hiding this comment.
Agreed that the bisect alone pins nothing. In 716aa4e the test writes mid-second and keeps the write's wall-clock window. It checks that the bisected millisecond lies inside that window. A seek at a fraction before the window returns the record, and one after it does not. That catches a store that keeps whole seconds. The strict comparison moves the boundary by one millisecond inside the same window, and the wire carries creation time in whole seconds. So no wire assertion separates the two on every run. The SQLite stream tests now seek over records with known created_at values. The record's own millisecond returns it and the next does not, and the strict comparison fails that row.
There was a problem hiding this comment.
PostgreSQL and MongoDB now have the storage-level test SQLite had, in 527d811. It writes records with known created_at values. The record's own millisecond returns it and the next one does not. PostgreSQL runs it in tests/stream_at_timestamp.rs on a scratch database, and MongoDB as a records_live test beside the page tests. With > in place of >= in the backend's seek, each test fails at the record's own millisecond (sequence 6 in place of 5). The other shard's record in all three tests now has the lowest sequence number inside the table's range. A seek without the shard filter fails the first five rows.
| "created_at {created_at_ms} and ApproximateCreationDateTime {approx} disagree" | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
This file grows from 779 to 971 lines. The two AT_TIMESTAMP tests can move to their own module unchanged.
There was a problem hiding this comment.
Moved both tests unchanged to tests/direct/stream_at_timestamp.rs in 73d45e8. streams.rs is back at 779 lines.
…vice's order Timestamp is now rounded half up to the millisecond, as the service does. Measured on us-east-1, 2026-11-20, against a record created at millisecond ...389: a Timestamp of ...389.4900 returns the record and ...389.5000 does not. The service refuses 0.0004 with "Valid timestamp must be provided when the iterator type is AT_TIMESTAMP" and accepts 0.0005. So the rounded value must be at least one millisecond. The checks run in the order the service runs them: - A member of the wrong JSON type is a SerializationException before any other check. The check reads SequenceNumber before Timestamp, the model order. An array has no message, as on the service. - The constraints on SequenceNumber length, ShardIteratorType and ShardId length join one "N validation errors detected" message, in that order. - AT_SEQUENCE_NUMBER and AFTER_SEQUENCE_NUMBER refuse a missing SequenceNumber before they refuse a Timestamp. - TRIM_HORIZON and LATEST refuse a SequenceNumber after the shard check. On a shard that does not exist the answer is "Shard does not exist". The envelope of the combined message moves into validation_errors_detected in lib.rs, which validate_enum_fields now calls too.
…session Main now sends every Cassandra statement through PolicySession::run (#945), and tests/consistency_policy.rs fails on the seek's query_with_values call. The seek now calls query_rows, as last_sequence_in does, so it reads at LOCAL_QUORUM like the tip read. The two AT_TIMESTAMP tests move from tests/direct/streams.rs to tests/direct/stream_at_timestamp.rs unchanged. streams.rs is back at its length on main.
This merge adds main at b3c54f6, through the merges 6d74de7 and 330d685 on the two branches below this one. Two files conflicted: crates/core/src/error/messages.rs and mod.rs. Main's #468 added validation_errors_detected, with the same body as this branch's validation_error_envelope. The merge keeps main's function and removes this branch's copy. The one caller, newer_form in crates/engine/src/int32_member.rs, now calls validation_errors_detected.
The AT_TIMESTAMP shard iterator (ExtendDB#468) reads std::time::SystemTime::now to refuse a timestamp in the future, which panics on wasm32. The engine reads its other clocks through web_time, which is std::time natively; this call now does too. The wasm clippy step refused it.
…nvelope require_members built the "N validation errors detected: " text with its own helper, validation_failure. Main now has the same envelope as extenddb_core::error::validation_errors_detected (#468), which validate_enum_fields calls after the merge of main. require_members calls it too, and validation_failure goes.
Main is at 6aef346, 2 commits after the last merge (#432 and #468). No file has a conflict. Three files changed on both sides, and git merged each of them with no overlap: docs/differences-from-dynamodb.md, crates/storage/src/lib.rs and crates/storage-cassandra/tests/direct_integration.rs. #468 adds a Streams section to the differences page, a method to the StreamEngine trait and a test module to the Cassandra direct tests. This branch changes the index key validation row, the transact exports and the token test module.
Main is at 018715e, seven commits after the last merge (#432, #468, #503, #526, #690, #765 and #774). One file conflicted: crates/storage-postgres/src/data/mod.rs. #690 adds STORAGE_RELATION_PREFIX where this branch imports from_catalog_json and to_catalog_json. The merge keeps both. Main changed seven other files this branch changes, and git merged them with no overlap. The PostgreSQL query and query_scan modules keep this branch's import of parse_sk and pk_to_text from data::key_text. So the LSI index walk of #432 refuses a key that holds U+0000 as the other reads do. The AT_TIMESTAMP seek of #468 reads sequence numbers only, so the record escape does not apply to it. Main adds no catalog migration, so migration 13 keeps its number.
Main added four reads since this branch's merge base, each without the ReadOptions parameter this branch adds: the PostgreSQL catalog check's GetItem on the items it wrote, its LSI query plan page, its multi-range GSI page, and the SQLite WebAssembly shim test's scan over the items it wrote. The reads that assert items written before them ask for a consistent read; the GSI page passes false, the only value the engine sends for a global secondary index read. #468 added first_sequence_number_at_or_after to StreamEngine; the recording double of the read-options tests gets the method, unreached like its other stubs.
The base branch now holds the fix rounds of #491 and #523, and main up to 9e457a3. Six files conflicted. Each keeps the base's text, with this branch's punctuation and status edits on the same lines. - docs/design/02-high-level-design.md: main's paragraph on the crate dependencies (#1009) and the read replica proposal (#584), with this branch's semicolons and colons in place of the dashes. - docs/design/03-component-core.md: main's sentence on the crypto module (#1009), with a colon for the dash. - docs/design/04-component-storage.md: main's IdempotentMismatch line (#526) in the list this branch writes with colons, and main's read replica paragraph (#584), which has no dash. - docs/design/13-storage-mongodb.md: main's AT_TIMESTAMP iterator line (#468), and colons after the two engine names. - docs/manuals/03-usage-guide.md: the section stays a pointer to the Feature Status table. The Global Tables cell that #491 fixed moves to that table on the differences page. - docs/storage-backends.md: the base's Markdown links, Cassandra image and container link, with this branch's experimental label and Cassandra version. The MongoDB bullet is the base's. The Cassandra bullet keeps the facts of both sides. The one-instance sentence names three backends, as on this branch, with the base's link.
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.
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>
The new head of fix/1326-cross-region-restore holds main and the new
heads of the three branches below it.
Conflicts:
- crates/core/src/error/mod.rs: the pub use messages::{...} line. This
branch adds MEMBER_NOT_NULL. On main, #468 added INVALID_STREAM_ARN
and validation_errors_detected to it. The merge keeps every name.
- backup_requests/pitr.rs: the doc of check_restore_table_name.
fix/1224-restore-target-name added an Errors section, and this branch
added the later clauses. The merge keeps both.
In messages.rs, main moved the envelope of validation_errors to
validation_errors_detected. The merge keeps the null value of this
branch for a clause of MEMBER_NOT_NULL in validation_errors.
Changes since the last review
Six commits on top of 65fd853, after a merge of main (34279f4, main at 44cd436):
StreamArnisInvalid StreamArnbefore the constraint clauses. A missing or nullShardIdadds theshardIdnull clause to the joined message. Both measured 2026-11-23. The text isextenddb_core::error::INVALID_STREAM_ARN, which the server's shape gate reads too.sequence_lower_boundare private, and the clamp test asserts its first record by equality.AT_TIMESTAMPin the design guide, REQ-STREAM-003 and the MongoDB design doc.EXTENDDB_STREAM_SINCEin the sample's docstring and walkthrough.What
ShardIteratorType::AtTimestampandGetShardIteratorInput.timestampare new.handle_get_shard_iteratorchecks the JSON types ofSequenceNumberandTimestampwith the service's deserializer texts. Then it refuses an absent, null or emptyStreamArnwithInvalid StreamArn. Then it joins the constraint violations into one message:SequenceNumberlength,ShardIteratorTypenull or enum,ShardIdnull or length. Then it runs the parameter rules in the newstreams_iterator_params.rs, which also owns theAT_SEQUENCE_NUMBERtoAFTERconversion.TRIM_HORIZONandLATESTwith aSequenceNumbernow refuse as the service does (GetShardIterator accepts SequenceNumber with TRIM_HORIZON and LATEST #461), after the shard check. TheN validation errors detectedenvelope lives inextenddb_core::error::validation_errors_detected, which the enum check shares. The type check reads a table of the two members,TYPED_MEMBERS. It is a copy, for this operation, of the mechanism A request member of the wrong JSON type gets serde_json's error text, where the service sends its own #1012 asks for indeserialize_error, and it goes when that fix lands.ShardIteratorTypemembership check repeats the testvalidate_enum_fieldsruns. It cannot call that helper. The helper renders a one-clause message of its own, and this clause sits between theSequenceNumberandShardIdclauses of one joined message.AFTER_SEQUENCE_NUMBERwithout aSequenceNumberwasSequenceNumber is required for AFTER_SEQUENCE_NUMBER iterator type. It is nowOne or more parameter values were invalid: SequenceNumber cannot be null, the service's text (measured 2026-11-20 and 2026-11-23). AGetShardIteratorbody that serde refuses now carries the prefixStart of structure or map found where not expected:before serde's text, as the other handlers do. The A request member of the wrong JSON type gets serde_json's error text, where the service sends its own #1012 comment of 2026-11-20 says this handler answers with serde's text alone. That stops holding when this merges.StreamEngine::first_sequence_number_at_or_after(shard_id, at_ms)on all four backends, each in its ownstream_at_timestamp.rs. SQLite, PostgreSQL and MongoDB takeMIN(sequence_number)overcreated_at >= T, and PostgreSQL numbers the shard's committed writes first, as itsLATESTread does.latest_sequence_numberdoes. The Cassandra seek runs through the policy session atLOCAL_QUORUM, as the tip read does. It seeks the clustering key with the HLC millisecond prefix ofTas the lower bound and filterscreated_atwithin that range.created_at_ms <= hlc_msholds for every record after fix(streams): one clock read per stream record on all four backends #463, socreated_at_ms >= Timplies the sequence is at or after the bound and the seek skips no qualifying record. The filter drops a record written under a clamped clock whose prefix clears the bound while itscreated_atis beforeT.(shard_id, sequence_number)index, so a seek near the tip filters most of the shard. PostgreSQL: index for the AT_TIMESTAMP stream seek needs a data migration #467 measured PostgreSQL on 2026-10-23 with the planner's row counts. The shard held 100,000 records withcreated_atspread over 24 hours. A seek near the tip removed 99,899 rows by filter in 19 ms. MongoDB has the same shape. A(shard_id, created_at)index needs a numbered catalog migration on SQLite, PostgreSQL and MongoDB, since main moved those schemas into the migration framework. PostgreSQL: index for the AT_TIMESTAMP stream seek needs a data migration #467 tracks it.Docs
The docs changes are a Streams section in
docs/differences-from-dynamodb.md, the usage guide example, the streams design doc, andEXTENDDB_STREAM_SINCEonsamples/stream_consumer.py. The Streams section covers four shards per stream and theAT_TIMESTAMPcontract, including the one-second future buffer. The iterator type lists in the design guide, REQ-STREAM-003 and the MongoDB design doc nameAT_TIMESTAMP. The sample's docstring and its walkthrough describeEXTENDDB_STREAM_SINCE.Why
DynamoDB Streams added the
AT_TIMESTAMPshard iterator type on 2026-10-15.GetShardIteratortakesShardIteratorType: AT_TIMESTAMPwith aTimestampmember (epoch seconds, fractional milliseconds allowed) and returns an iterator positioned at the first record created at or after that time. ExtendDB answeredSerializationExceptionfor the type.Closes #460. Closes #461.
Not changed here
DescribeStream.ShardFilter:CHILD_SHARDSis public and ExtendDB has noShardFiltersupport. The service's timestamp filter onDescribeStreamis not in the public API.(shard_id, created_at)index needs a numbered catalog migration and anextenddb migratestep on existing deployments. It is PostgreSQL: index for the AT_TIMESTAMP stream seek needs a data migration #467 rather than part of this change.GetShardIterator(ShardIdat least 28 characters,SequenceNumberat least 21). Measured 2026-11-20: the service answers them, joined, before the parameter rules. ASequenceNumberof"0"withAT_TIMESTAMPand a futureTimestamp, or withTRIM_HORIZON, gets the 21-character constraint sentence.Overlap with other PRs
validation_error_envelope), fix(scan): check AttributesToGet, ScanFilter, ExclusiveStartKey and ExpressionAttributeValues in the service's order #854 (the same helper) and fix(engine): answer a missing TableName, Key or Item as DynamoDB does #1262 (validation_failure) add the envelope thatvalidation_errors_detectedrenders. This PR added it first (944ebe6 and 984ab05, 2026-11-20). Whichever merges second drops its copy and calls the one on main.git merge-tree, 2026-11-24), one line each with the files:crates/engine/src/streams.rs, the MongoDB, PostgreSQL and SQLite stream engines andcrates/storage/src/lib.rs(both changeStreamEngine).crates/engine/src/streams.rs.crates/engine/src/streams_tests.rs.crates/core/src/error/messages.rsandmod.rs.crates/core/src/error/mod.rs.crates/engine/src/lib.rs.crates/storage-sqlite/src/lib.rs.crates/storage-postgres/src/lib.rs.docs/design/13-storage-mongodb.md.tests/direct_integration.rs.crates/storage/src/lib.rs, mostly on old bases.Testing done
Behaviour, measured on the service
us-east-1, 2026-10-23, 2026-11-20 and 2026-11-23, raw requests and responses recorded per probe.
Timestampto the nearest millisecond, half up. For a record at millisecond...389,...389.4900returns it and...389.5000does not. ATimestampof14:04:08.5skips records written at14:04:08.050to.071and starts at the next group. The integer14:04:08includes them. The service refuses0.0004, which rounds to zero, and accepts0.0005.GetRecordsreturns records written from then on.SerializationException, for the first such member in body order. An absent, null or emptyStreamArnisInvalid StreamArn, alone. Then the model's constraints join one message underN validation errors detected:SequenceNumberlength, theShardIteratorTypeenum or null,ShardIdnull or length. Then the parameter rules run per type, then the stream and shard lookup.AT_TIMESTAMPchecks theTimestamp, then refuses aSequenceNumber, then checks the future.AT_SEQUENCE_NUMBERandAFTER_SEQUENCE_NUMBERrefuse a missingSequenceNumberbefore aTimestamp.TRIM_HORIZONandLATESTrefuse aTimestampbefore the lookup and aSequenceNumberafter it, so a shard that does not exist answersShard does not exist.One or more parameter values were invalid:. The enum violation names no value:Value at 'shardIteratorType' failed to satisfy constraint: Member must satisfy enum value set: [AFTER_SEQUENCE_NUMBER, LATEST, AT_TIMESTAMP, AT_SEQUENCE_NUMBER, TRIM_HORIZON]. A missing type isMember must not be null, and so is a missingShardId, at'shardId'.Timestampsent as a JSON string isSerializationException: STRING_VALUE cannot be converted to Date. A boolean isTRUE_VALUE cannot be converted to Date. An object isStart of structure or map found where not expected. An array is aSerializationExceptionwith no message. ASequenceNumbersent as a number isNUMBER_VALUE cannot be converted to String. Null, zero and negative are theValid timestamp must be provided when the iterator type is AT_TIMESTAMPrefusal.Tests
tests/test_streams_at_timestamp.py: twelve dual-target wire tests with every expected value from the measurements. They cover the at-or-after boundary at a record's own millisecond, found by bisecting through the API and checked against the write's wall-clock window. They also cover the tip-plus-one case and the full validation matrix with the missing-shard rows. The joined constraint violations, theInvalid StreamArnrows, the enum and missing-type texts, the member JSON-type texts and the future buffer have their rows too. 12 of 12 pass against a SQLite server built from the branch (2026-11-24). The existingtests/test_streams.pypasses beside them on that server (16 passed and the earliertest_expired_iteratorxfail). Against the service and a PostgreSQL server the file last ran at 65fd853, 12 of 12. The rows added since then are the bodies measured on 2026-11-23, and CI runs the file on every backend. The raw requests keep their own signer, becausetests/raw_signed_request.py::signed_postsigns only theDynamoDB_20120810target and turns certificate checks off for every https endpoint, the service's included.StreamArnandShardIdrows, the future buffer, the Cassandra bound, and the tip-then-seek order. The order test runs against aStreamEnginedouble that writes during the tip read, and fails with the two reads swapped.stream_tests.rs, PostgreSQL intests/stream_at_timestamp.rson a scratch database, MongoDB as arecords_livetest instream_records_live_tests.rs. The PostgreSQL storage tests job and the MongoDB rust job run the last two. Each writes records with knowncreated_atvalues. A record's own millisecond returns it and the next one does not. Another shard's record with a lower sequence number inside the range does not count. With>in place of>=in a backend's seek, its test fails at the record's own millisecond. With the shard filter removed from the SQLite seek, the SQLite test fails on its first five rows.tests/direct/stream_at_timestamp.rsholds the two direct seek tests. The first writes a record under a clamped clock: its sequence prefix is 8 s after the real record, and itscreated_at8 s before it. The seek does not return it for aTafter itscreated_at. It returns the real record for aTbetween the twocreated_atvalues, and the real record, the first by sequence, for aTbefore both. The seek names the stream's shard id. The second test disables and enables the stream. The closed shard then answers its own record and nothing for aTafter the close. The new stream's shard answers its own record and not the old one.Gates ran on the final tree, after the merge of main, on core, engine, server, storage-sqlite, storage-postgres, storage-mongodb and storage-cassandra.
cargo +1.97.0 fmt --all -- --checkpasses, and so do the two clippy commands ofclippy.ymlwith-D warnings.cargo +1.91.1 check --locked --all-targetspasses on the same crates. 1.91.1 is main'srust-version. Unit tests: core 1146, engine 878, storage-postgres 84, storage-mongodb 190 (84 ignored), storage-cassandra 181 and--test consistency_policy10 pass. storage-sqlite: 317 pass, and the twobackup_catalog::write_lock_testsfail only on the host where these ran, as before. server: 513 pass. Fivebackup_storetests fail on that host because another user owns its/local/home, which the spool privacy check refuses.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: none. Breaking changes below describe the new required
StreamEnginemethod.Breaking changes
StreamEnginegains a required method with no default body:first_sequence_number_at_or_after(&self, shard_id: &str, at_ms: i64) -> BoxFuture<'_, Result<Option<String>, StorageError>>. It returns the sequence number of the shard's first record whose storedcreated_atis at or afterat_ms, orNone. The four backends in this repository implement it in this PR. A backend outside the repository that implementsStreamEnginestops compiling until it adds the method. CONTRIBUTING.md lists changes to the backend storage traits among the changes that take an RFC first. RFC-0002 says theStoragetrait is still evolving. It keeps every supported backend in this repository so that trait changes land across all of them in one change. It also says a backend that implements the optional Streams trait must pass all of its conformance tests. No RFC covers this method, so the box above stays unticked.A client that matched the text
SequenceNumber is required for AFTER_SEQUENCE_NUMBER iterator typenow receives the service'sOne or more parameter values were invalid: SequenceNumber cannot be null.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.