Repository navigation
Conversation
…nistic OCC timestamps and fenced streams
|
@LeeroyHannigan this is the implementation PR you asked for in #186. CI has not run yet. Every workflow run on this PR and on #186 is in What changed since the tree you built in pass 4. Besides the rebase onto
The RFC text in #186 was updated for these in Still to come on this PR. The description lists what was run locally and what was not.
|
LeeroyHannigan
left a comment
There was a problem hiding this comment.
Thanks for the "Not run" list in the description. It made clear where to start.
I built this head and ran it against Google's Bigtable emulator, with the server and the emulator on 127.0.0.1:
- The workspace build,
cargo fmt --check, bothclippy.ymlcommands and clippy on the--features bigtablebinary are clean. The default binary doesn't contain the crate. - The unit tests (57), the bin test (1) and the emulator suite (20, with the emulator connected) pass.
- I ran 1,388 wire tests from 58 of our pytest files against a Bigtable server and a SQLite server, both built from this head. 139 fail on Bigtable and pass on SQLite. Items 1, 2, 3, 7, 19, 28 and 29 account for all 139.
cargo package --workspaceanddevtools/check-crate-packagespass, and the 34 new crates in Cargo.lock are all Apache-2.0 or MIT. The catalog stores secrets as #1003 requires.- Where an item gives a result on the emulator or DynamoDB's answer, I measured it. The other items come from reading the code at 44f067f.
CI hasn't run at this head yet.
Before it merges:
Items, keys and indexes
-
TransactWriteItems doesn't check the type of a member's table key (
engine.rs:3843-3887). On the emulator, a Put ofpk={"N":"123"}on an S key answers OK and stores the item. After that, no GetItem or DeleteItem can reach it. Index key faults on a member also come back as a top-level ValidationException instead of a cancellation reason. 27 wire tests fail in this area, two of them on the message prefix of item 30. Please check the table and index keys of each member, and pass the reasons throughCancellationReason::resolve_key_faultsas the PostgreSQL backend does. -
A GSI with more than one HASH or RANGE attribute keys its rows on the first of each (
gsi.rs:116-145). On the emulator, a Query on such an index ignores the condition on the second RANGE attribute. The index also holds an item that lacks one of the key attributes. All 64 tests oftest_gsi_multi_range_query.pyfail in their fixture, and one test oftest_multipart_gsi.pyfails. Please build the shadow key from every key attribute in key-schema order, and skip an item that lacks any of them. If that's out of scope, refuse the extra conditions with the first-range-only message of the MongoDB and Cassandra backends. -
UpdateItem and the transacted Update don't check the item size after the update (
item_ops.rs:1169-1186). On the emulator, an update that grows a 405,005-byte item by 8,000 bytes is stored, where SQLite refuses it. 41 tests oftest_item_size_at_limit.pyfail. Please callvalidate_update_item_sizeon the new item, as the SQLite and PostgreSQL backends do. -
A base-table Query uses an S or B sort-key bound as a prefix (
query_scan.rs:342-346and:369). With sort keys a, ab, b, ba and c in one partition:Query DynamoDB This backend sk = aa a, ab sk <= ba, ab, b a, ab, b, ba sk > bba, c c sk BETWEEN a AND ba, ab, b a, ab, b, ba The sort key is the last segment of the row key, so these bounds can be exact. Please keep the 0xFF trailer for
begins_withand the partition bound only. No wire test caught this, so please add the five-item case to the emulator suite. -
A GSI shadow row key can exceed Bigtable's 4,096-byte limit with valid keys (
gsi.rs:116-180). With a 2,048-byte partition key and a 2,048-byte GSI key, DynamoDB answers 200 and its index finds the item. On the emulator, PutItem answers 400encoded GSI shadow row key size (4106 bytes) exceeds Bigtable maximum limit of 4096 bytesbut stores the item. The index never gets it, and DeleteItem fails with the same 400. With all four keys at their limits, the shadow key reaches 6,158 bytes. A fixed-length digest of the two partition keys would bound it, since the full values are in the row's cells. Please also compute the shadow keys beforeput_cas, so a key failure can't follow the commit. -
A GSI whose key schema is the table's key schema is read with base-table bounds, but its rows use the shadow layout (
query_scan.rs:320-321,:430-431,:865-866). DynamoDB accepts such a GSI. WithpkS andskN, DynamoDB returns the item forpk = a AND sk = 5on the index, and this backend returns nothing. Please pass from the engine whether the read is on an index. The engine knows it fromindex_name. -
A failed write to a GSI shadow table is only logged, and the write succeeds (
engine.rs:963-970,:976-987,:1024-1028). On the emulator, one of three runs oftest_gsi_online_backfill.pyleft an extra index entry after aResourceExhaustedon the shadow delete. Please return the error or retry it, so the client gets a transient failure instead of a stale index entry. -
TTL never deletes an item written before TTL was enabled. On the emulator, with the TTL worker every 2 s, an expired item written after UpdateTimeToLive was gone in 2 s. An expired item written before it was still there 60 s later.
create_ttl_indexwrites nothing (engine.rs:4685-4692), and the worker finds items only through the TTL index. A write on another node within 5 s of the enable has the same gap. Please index the existing items when TTL is enabled, and report ENABLING until that scan ends, as the PostgreSQL and Cassandra backends do. Entries that come due while TTL is off are deleted too (ttl_worker.rs:206-214), so a later enable misses those items.
Transactions and streams
- An error after the commit point reaches the client (
engine.rs:1514, andmaintain_ttl_index(...).await?at:3130,:3240and:3369). The write is durable by then, and the next writer or the sweeper finishes it. A transient error answers 503, the SDK retries, and the retry applies the write a second time. SoADD #n :oneadds two. Please log these errors and return the write's result once the commit point has passed. - A roll-forward that fails on every attempt leaves the transaction's intents in place (
engine.rs:1588-1738), and every later write to those rows fails. One case: a TransactWriteItems over tables A and B, a node stop after the commit point, then DeleteTable B within 60 s. The row in A then stays unwritable. I haven't run this case. Please treat a participant whose table is gone as done, and clear the intents once every base participant is applied or gone. - A stream record written before its shard row exists gets a clock-based sequence number (
streams.rs:482-512). UpdateTable publishes the new stream label before it inserts the four shard rows (engine.rs:2695-2697,:2759-2823). A write in that window takes theNonearm, and its record sorts after every later record of the shard. A reader past it, or a LATEST iterator, then gets nothing more from that shard. If an insert fails, nothing creates the missing shard rows. Please insert the shard rows before the label, as CreateTable does, and delete theNonearm. - A record can land in a closed shard after its EndingSequenceNumber (
streams.rs:461-535).write_record_ordereddoesn't readending_sequence_number, and a write that read the description before a disable still appends. Please drop the record when the shard has an ending number. Before the close takes that number, please roll forward the table's committed transactions. - A new GSI can go ACTIVE without some writes (
engine.rs:2827-2894). A node whose cached description (5 s) predates the index writes no shadow row. If the backfill already passed that key, the index misses the item until the next reconciler pass, up to 300 s later. The PostgreSQL backend waits a grace period, takes a write barrier and re-checks slow writes (crates/storage-postgres/src/data/gsi_build.rs). Please close the window before the index goes ACTIVE.
Catalog, security and operations
extenddb destroydeletes every table in the instance whose name starts withtand has 17 or more characters (bootstrapper.rs:401-404,:421). That matches tables of other applications, such astransactions_2024.destroyshows the tables the catalog lists, and then deletes by the pattern. Please delete the tables the catalog names, or at most match^t[0-9a-f]{16}(_g[0-9a-f]{8})?$.dev_modegives allow-all to any user named__dev_admin__, in a production build (catalog_store.rs:2650-2656). The name passes our IAM name check, so a caller who can create users can give themselves every permission. The setting comes from the TOML, the environment or the connection string. The config thatinitwrites calls it "Bypass authentication for local testing".dev_auth.rsis dead code, because nothing constructsDevAuthProvider. The project allows dev mode only as a compile-time feature of the SQLite build (crates/bin/src/main.rs:50-62). Please deletedev_auth.rs, thedev_modesetting and its two branches incatalog_store.rs. The emulator tests don't need them.- Long-term access keys lack the
AKIAEXTENDDBandextenddbprefixes (catalog_store.rs:61-86,:2158-2161). The emulator server issuedAKIASJREOZOTNPCFCUPN. Every other backend issuesAKIAEXTENDDBand 8 characters, so people and secret scanners can tell our keys from AWS keys. Four of our documents describe that shape. Please use the generator incrates/server/src/management/crypto.rs, or move it intoextenddb_storage, instead of a new copy. servereads no catalog status and takes no serving registration (lib.rs:111-187). A server therefore starts on an uninitialized, behind, changed or incompatible catalog, andmigrate --yescan run beside it. ADR-0023 decisions 5 to 7 require both, and the MongoDB factory shows the shape (register_and_check_as). Please readRunner::statusbefore the engine starts, refuse the statuses the ADR names, and add aserving_registrar.- The 120 s migration lease is never renewed, and a run continues after it lapses (
migrations.rs:459-530). A secondmigrate --yescan then take the lock while the first still writes. On a fresh catalog,locktakes no lock row, so twoinitruns both apply migration 1. Please renew the lease and check it before each ledger write, as the Cassandra and MongoDB backends do. Please also create the catalog table before the lock. - Under load on the emulator, the gRPC client drops its connection after a
GoAwaywithENHANCE_YOUR_CALM, 23 times in one run.test_concurrency.py::TestParallelInserts::test_parallel_insertsfailed in 3 of 3 runs, with ServiceUnavailable on a Scan. On catalog paths the same fault became InternalServerError 10 times, becausemap_catalog_errmatches strings that tonic doesn't print (client.rs:149-166). Please carry the gRPC status through the catalog layer and classify it as the data path does. Please also reconnect and retry a read whose connection got aGoAway. - No document describes the backend: no README tier row, crate README, setup guide or row in
docs/differences-from-dynamodb.md. That document's point-in-time recovery row (line 133) tells users to use CreateBackup, which this backend refuses too. Please add the tier row as Experimental with its known limits, a setup guide with the app profile and IAM roles, and the differences rows. - No CI job builds the backend or runs a test against it. You've said a job with
cbtemulatoris coming. Please run the pytest suites in it,test_concurrency.pyincluded, and add the--features bigtableclippy command toclippy.yml.
Reads that grow with the data
- LSI Query and Scan read the whole item collection on each storage call (
query_scan.rs:556-855). The engine reads a page in chunks of up to 1,024 items. So one 1 MB page of 100-byte items over a partition of 1,000,000 items reads about 9,000,000 rows. Please store each LSI as an ordered shadow table, as for the GSIs, or refuse LSIs on this backend and document that. - GetRecords, LATEST iterators and the retention sweep read every record of the shard, or of every stream, on each call (
engine.rs:4858-4877,:4972-5021,streams.rs:606-629). At 50 writes per second to one shard, the shard holds about 4.3 million records after 24 hours, and each GetRecords reads all of them. Please read from the iterator's sequence number with a row limit, and page the sweep. - Each deleted item, and each moved or deleted GSI entry, leaves a version-only row that nothing deletes (
item_ops.rs:673-705,transact.rs:610-625). Queries skip these rows, but Bigtable still reads them. With TTL, a partition of expiring readings keeps every expired key ahead of the live ones. Please delete a version-only row once no delayed writer can arrive. - The GSI reconciler compares every GSI with its table in full every 300 s, under a 600 s lease that nothing renews (
gsi_worker.rs:30-322). A table of 100 million items with 3 GSIs means about 600 million row reads per pass. Once a pass outlasts the lease, other nodes start their own. Please run it only for indexes left CREATING, fix failed shadow writes where they happen (item 7), and renew the lease.
Code size
- The crate repeats a check and helpers that already exist. The engine refuses two operations on one item (
crates/engine/src/transact_write_items.rs:117-121), andengine.rs:3890-3898repeats it.transact.rs:962-972copies the cancellation-reason constructors ofcrates/core/src/types/transaction.rs:278-318. The copy also puts backend text in the TransactionConflict message, where core carries the service's "Transaction is ongoing for the item". Please delete both copies and log the backend detail.
Smaller items, which I'd also like in this PR:
- The emulator tests return early and report
okwhenBIGTABLE_EMULATOR_HOSTis unset (tests/emulator_integration.rs:84-87). You've said a required variable is coming. Please set it in the CI job. - DescribeTable of a provisioned table includes
BillingModeSummary(engine.rs:1978). 3 tests oftest_table_throughput_mode.pyfail. SQLite sets it only for PAY_PER_REQUEST. - DeleteAccount on an account with tables answers "Account still owns DynamoDB tables" (
catalog_store.rs:961). The other four backends use "Cannot delete account with existing tables. Delete all tables first.", and one test fails on the difference. - A failed update action's message gains an
update expression evaluation:prefix (item_ops.rs:1183), and a failed condition gainscondition evaluation:(item_ops.rs:1203-1205). The service message should reach the client unchanged. - ListBackups, DescribeBackup, DeleteBackup and RestoreTableFromBackup answer ValidationException (
backup_stubs.rs:72-111,:230-248). For a table with no backups, DynamoDB answers ListBackups with an empty list and DescribeBackup with BackupNotFoundException. Please refuse CreateBackup only, and answer the rest as for a missing backup. - Credential lookup errors reach unauthenticated callers with internal text, such as the catalog table path and the gRPC status (
catalog_store.rs:2921-3033). The lookup runs before the signature check. Please log the detail and answer "Internal error during authentication", as the SQLite and PostgreSQL stores do. - With
BIGTABLE_EMULATOR_HOSTset, a server configured for a GCP project connects to that host in plaintext and without credentials (client.rs:185-200). No log line says so. Please read the variable in one place, and log the endpoint at startup. - The comment on
app_profile_idsays "or multi-cluster routing with single-row transactions enabled" (config.rs:30-36). The API allows single-row transactions only on single-cluster routing, and the sample config doesn't name that switch (extenddb.sample.toml:112-114). Nothing checks the profile at startup. Please fix the text and check the profile when the server starts. - With
data_instance_idset, migration 1 creates the transaction log and the TTL index on the catalog instance (m0001_baseline.rs:46-51). The engine uses copies on the data instance, whichinitand each start create outside the migration runner. The data instance also has no ledger. - Bigtable INVALID_ARGUMENT, OUT_OF_RANGE and UNIMPLEMENTED reach the client as ValidationException with the gRPC text (
client.rs:108-111). They come from a request the backend built, so please map them toInternal. - Each attribute is a cell, and a
CheckAndMutateRowtakes at most 100,000 mutations. A shadow put for a GSI that projects ALL takes two per attribute. So an item of about 50,000 small attributes, which DynamoDB accepts, can't reach such an index. The client also keeps tonic's 4 MiB receive limit, which a large transaction's coordinator row can exceed. I haven't measured these on Cloud Bigtable. begins_withon a B sort key misses keys that continue with 17 or more 0xFF bytes (query_scan.rs:373-397).binary_prefix_upper_boundin the SQLite backend builds this bound.- Stream
SizeBytesis the JSON length of the keys and the new image (streams.rs:250-254). The other backends reportitem_size_bytesof the item. - After a node stop between the commit point and the end of
roll_forward, GetItem returns the old value. That lasts until the next write or the sweeper, 60 to 90 s by default. TransactGetItems returns the new one in that time. DynamoDB documents serializable isolation between transactions and GetItem. A read throughread_row_resolving_committed_intentsinget_itemwould return the new value. - Only the building process knows that a GSI is in a build (
engine.rs:425-438). Another node's reconciler can build it again and promote it to ACTIVE. If the first build then fails, its UpdateTable deletes an index that DescribeTable already showed as ACTIVE. refresh_table_sizedoes nothing, so DescribeTable reports ItemCount and TableSizeBytes as 0 for every table (engine.rs:4713-4719). Please count them under the lease, or list the gap in the differences document and delete the worker.- The startup log says CreateBackup writes in-catalog backups, but the backend refuses it.
- The
extenddbcrate's README and description don't list the Bigtable build (crates/bin/README.md:17-20,crates/bin/Cargo.toml:9). The release that first ships this crate needs the new-crate steps of ADR-0029. - This PR carries a copy of the RFC. Please delete it here, and reference the RFC by number once #186 merges. The RFC text items are in my review of #186.
- Other copies of code that already exists: the write loop of
put_item,delete_itemandupdate_item(engine.rs:3098-3402), and the shadow CAS builders (item_ops.rs:901-1097). Also the lease loop of the six workers,self_service_policy(the fifth copy of that document),coerce_u64besidestring_coerce,extract_keysbesideextract_key, andDEFAULT_ACCOUNT_SETTINGtwice. impl Default for BigtableStorageConfigpoints at the emulator (config.rs:118-137).version:catalogwritesapplied_atinDisplayform, where the ledger rows use RFC 3339 (migrations.rs:390).
…nd clean labels - Gate test-only fault-injection and cutoff-override helpers behind a Cargo test-hooks feature (test-hooks = ["extenddb-storage/test-hooks"]) and register extenddb-storage-bigtable/test-hooks in .github/workflows/clippy.yml. - Split commit_fenced_single_item_write from execute_fenced_single_item_write so production write paths carry no test-only branching, and remove unused helper code per RFC-0003 section 6.2. - Fail emulator_integration when EXTENDDB_TEST_BIGTABLE_REQUIRED is set (non-empty and != "0") and BIGTABLE_EMULATOR_HOST is unset or unreachable. - Replace internal verification labels and model invariant names across crates/storage-bigtable with descriptive protocol comments and test names.
…ection, TWI precedence, and DDL defaults - Replace 17-byte 0xFF sort-key upper trailers with exact binary_prefix_upper_bound, next_valid_row_key_after, and 4 KiB range clamping so base-table =, <=, >, BETWEEN, and begins_with queries never bleed across prefix-related sort keys (e.g. "A" vs "AB" or "A\0") or exceed Bigtable's 4096-byte row-key limit. - Support multi-attribute GSI shadow keys (1..=4 HASH attributes in a 0x4D length-framed envelope and 0..=4 FoundationDB-escaped RANGE attributes), free-order aliased KeyConditionExpression clauses, exact half-open [0x00, 0x01] GSI range bounds, and strict base/GSI ExclusiveStartKey schema, scalar-type, and partition-boundary validation. - Apply LSI Projection (ALL, KEYS_ONLY, INCLUDE) filtering on Query and Scan after extracting LastEvaluatedKey. - Enforce max_item_size_bytes on UpdateItem and TransactWriteItems Update, and apply upfront and post-update secondary-index key checks with CancellationReason::resolve_key_faults precedence. - Default CreateTable BillingMode to PROVISIONED (omitting BillingModeSummary when PROVISIONED while retaining zeroed GSI ProvisionedThroughput on PAY_PER_REQUEST), honor control_plane_delay_seconds on WarmThroughput transitions, and allow AttributeDefinitions redeclaration on UpdateTable. - Emit 20-char AKIAEXTENDDB access keys and 40-char extenddb secret keys, persist catalog_version in SettingsStore, expose setting defaults in BigtableOperationsEngine, align account-deletion HasDependents message, and keep emulator connection setup silent on CLI stdout.
… CI workflow - Accept --backend bigtable in devtools/run-tests and export EXTENDDB_TEST_BACKEND=bigtable. - Add executable devtools/run-bigtable-tests harness starting cbtemulator (host binary or Docker), initializing/serving extenddb, and delegating to devtools/run-tests --extenddb --backend bigtable. - Add .github/workflows/integration-bigtable.yml running Bigtable unit tests, emulator integration tests (both production feature set and --features test-hooks with EXTENDDB_TEST_BIGTABLE_REQUIRED=1), sharded pytest/comprehensive/terraform suites, rust integration suite, production feature graph check, and shard coverage verification with SHA-pinned actions.
…artup notice, and drop duplicate RFC - Share AKIAEXTENDDB/ASIAEXTENDDB key generators, self_service_policy, and string_coerce::u64 in extenddb-storage across all backends and crates/server. - Report CreateBackup unsupported in startup logs and banner when built with the bigtable backend while keeping ListBackups/DescribeBackup/DeleteBackup/RestoreTableFromBackup empty-catalog semantics. - Document bigtable feature in crates/bin while preserving default = ["postgres"]. - Remove duplicate docs/rfcs/0000-bigtable-backend.md from implementation branch so RFC PR ExtendDB#186 is the sole owner.
…PC, streams, TTL, and migrations - Replace bigtable_rs single-frame decoder with stateful multi-frame ReadRowsAssembler, attach x-goog-request-params routing headers, remove unused bigtable_rs/axum dependencies, add HTTP/2 GoAway pool replacement and Internal vs Transient gRPC status mapping, and validate single-cluster transactional app profiles at serve startup. - Enforce pre-commit SHA-256 digest-bounded GSI/LSI shadow keys, multi-attribute GSI keys, ordered <data_table>_l<8hex> LSI shadow tables, exact base sort-key query bounds, explicit is_index routing, UpdateItem/TransactWriteItems item-size checks, and key-fault cancellation precedence. - Emit single SetCell per retained shadow attribute, chunk >90,000-mutation writes across base/shadow/2PC RPCs, retry and log durable post-* side-effect recovery records, reclaim due version-only m:v tombstones safely via tomb: GC entries, and treat deleted tables as done during multi-table 2PC roll_forward. - Pre-create stream shards via stream_lineage before publishing table_meta, roll forward committed writes before closing shards, suppress post-close appends, add GetItem read-through on committed intents, and bound stream/idempotency range scans. - Backfill pre-existing items during TTL ENABLING -> ENABLED transitions, preserve due index entries while TTL is disabled, remove table_size_refresh full-scan worker, scope drop_databases strictly to ExtendDB-owned tables, remove dev_auth bypass, redact auth failures, renew catalog migration/serving leases, and split M0001 baseline across catalog and data_instance_id.
…, and differences rows - Document Google Cloud Bigtable in Experimental tier in README.md and extenddb.sample.toml. - Add docs/bigtable-setup.md and crates/storage-bigtable/README.md for crates.io packaging. - Document Bigtable backup refusal, live-scan ExportTableToPointInTime, zero ItemCount/TableSizeBytes, and 60 s tombstone grace window in docs/differences-from-dynamodb.md.
…ckup tests - Add cargo clippy -p extenddb --no-default-features --features bigtable --all-targets check to .github/workflows/clippy.yml. - Narrow devtools/run-tests Bigtable backup exclusions to CreateBackup tests so empty-catalog ListBackups/DescribeBackup/DeleteBackup/RestoreTableFromBackup validation tests run.
44f067f to
01efd8a
Compare
|
Thanks for running the emulator and wire suites and for the detailed review, @LeeroyHannigan! All 47 items are addressed on the updated branch ( Items, keys, and indexes (
|
…s, and harden recovery
- Attach bigtable-features: CAE= (FeatureFlags { reverse_scans: true }) on data-plane gRPC requests so server-side reverse ReadRows scans succeed on Cloud Bigtable.
- Attach URL-encoded x-goog-request-params routing metadata across all AdminClient RPCs, run ensure_families strictly when CreateTable returns AlreadyExists (inspecting GetTable SchemaView first so zero ModifyColumnFamilies calls run when all families exist), and document bigtable.tables.update in docs/bigtable-setup.md.
- Flatten all CheckAndMutateRow predicates across item_ops.rs and transact.rs to zero nested Filter::Condition nodes, route multi-chunk single-item PutItem and UpdateItem writes above MAX_MUTATIONS_PER_RPC through the sgl-* coordinator fence, and execute progressive stage-fenced CheckAndMutateRow batches across apply_fenced_mutation, put_cas, and monotonic (m:v, m:chunk) apply_shadow_version_cas.
- Bound inline post-commit side-effect execution below the tombstone grace horizon, anchor post-* recovery records to (data_table, row_key, base_version) (t:base_guard) so stale shadow/TTL puts skip superseded base rows while still cleaning prior index keys, gate sweep_due_tombstones on clean sweep_txn_log completion, and enforce now_millis() > expected_version before physical tombstone reclamation.
- Harden repair_slow_write_schema_drift against self-deleting unchanged index keys, synthesizing wall-clock versions on absent rows, transient repair RPC errors, and pre-fence base-row mutations.
- Serialize close_shards_by_id under shard_local_mutex, persist stream_dedup before CAS-verifying ShardMeta remains open in write_record_ordered, and clamp get_stream_records at ending_sequence_number.
- Add unit and cbtemulator concurrency and fault-injection regression tests covering all paths above.
… keys, and pedantic lints - Resolve committed 2PC and chunked single-item (`sgl-*`) intents on `Query` and `Scan` (including standalone `QueryScan` callers), skip pure `m:v` tombstones server-side without consuming `rows_limit`, bound continuation pages to exact remaining limits, and flush buffered side-effect recoveries plus roll forward committed coordinator entries (via single-`Condition` state filters) before LSI reads. - Restrict non-disambiguated `CheckAndMutateRow` retries (`put_cas`, `delete_cas`, `apply_shadow_version_cas`) to pre-execution transport rejections while disambiguating `TxnCoordinator::open_with_token` retries via `t:open_nonce`; retry `post-*` coordinator persistence with exponential backoff and queue unpersisted recoveries in memory for `sweeper` replay without returning post-commit errors. - Create `__extenddb_catalog__` before acquiring `lock:catalog_migrations` on `init`, flag populated uninitialized catalogs as `NeedsAttention` via raw row-key sampling, guard `renew_lock` with `TimestampRangeFilter` and local lease deadlines, wrap `LockedStores::management()` under the active migration lease, advance per-row catalog `put`/`put_if_present` timestamps monotonically (`compare_and_swap_raw_after`), and add `devtools/check-bigtable-catalog-lock`. - Replace `O(data)` `index_info_by_table_id` scans with `O(1)` cached `table_id_index:` lookups, switch `read_secret_page` to `O(page_size)` `scan_str_range`, bound >4 KiB composite TTL index row keys via `[0x44][SHA-256:32]` + `tv1:` payload cells, preserve multi-attribute GSI key validation on writes, and avoid starving `b"tomb:"` tombstone GC on unrelated fresh transactions while still guarding unsettled `(table, row)` pairs. - Add stateful multi-frame `ReadRowsAssembler`, per-message streaming deadlines, `AdminClient` connect/request timeouts + typed `tonic::Code` mapping, IPv6 `[::1]` endpoint parsing in `operations.rs` and `devtools/run-bigtable-tests` (with HTTP/2 `SETTINGS` readiness), `EffectiveStore::Configured` `create_backup_unsupported` banner reporting, fixture/case-level `CreateBackup` skips in authz/metrics pytest suites, docs updates, and zero-warning `clippy::pedantic` compliance across `extenddb-storage-bigtable`.
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.
Resolve the Cargo.toml and Cargo.lock merge conflicts with main (v1.1.0) and adapt the Cloud Bigtable storage backend to upstream changes: - Align workspace Cargo.toml and Cargo.lock with ExtendDB v1.1.0 (ExtendDB#1514), MSRV 1.94.0 and sqlx 0.9.1 (ExtendDB#1166), and extenddb-server default-features = false (ExtendDB#1449), bumping extenddb-storage-bigtable to =1.1.0. - Adapt AuthorizationStore::fetch_session_data (ExtendDB#1523) to look up role session policy, tags, and RFC 3339 created_at in O(1) by access_key_id via iam_session_ak:<access_key_id> -> iam_session:<session_token> without re-checking session expiry, with symmetric 4 KiB row-key and non-empty token guards across fetch_session_data and lookup_credential. - Decide StreamSpecification transitions in BigtableEngine::update_table ahead of companion table fields and GSI updates (ExtendDB#963) so a refused disable/enable writes no other table member while still closing any open shards left behind by a prior disable. - Update docs/bigtable-setup.md for Rust 1.94.0 and the exact v1.1.0 extenddb version output. - Add unit and live cbtemulator integration tests covering session_data_conformance::run, expired/deleted/oversized session-data and credential lookups, write_bootstrap_rows admin environment-variable combinations and idempotent re-runs (ExtendDB#1349), ClientRequestToken NUL/backslash/ UTF-8 escaped stored tokens (ExtendDB#1375), and refused stream disable/enable preceding companion edits (ExtendDB#963).
LeeroyHannigan
left a comment
There was a problem hiding this comment.
I built this head (523548f) and ran it against Google's Bigtable emulator, with the server and the emulator on 127.0.0.1. I also read every change since 44f067f.
- fmt, the workspace build, the three
clippy.ymlcommands and the MSRV check on 1.94.0 are clean. The new workflow's release check of the Bigtable binary passes too. The default binary doesn't contain the crate. - The unit tests (83), the bin test (1) and the emulator suite (36, and 46 with
test-hooks) pass, run as the new workflow runs them. WithEXTENDDB_TEST_BIGTABLE_REQUIRED=1and no emulator, 35 of the 36 fail. devtools/check-bigtable-catalog-lockpasses 27 of its 29 checks on a debug build. The two backup store checks fail because of a directory owner on my host.- I ran 1,462 wire tests from 61 pytest files against a Bigtable server and a SQLite server, both built from this head. Of the 139 Bigtable-only failures of my first review, 137 now pass, 1 is skipped on both servers, and
test_parallel_insertsstill fails (item 19). No test that passed on Bigtable then fails now. - The license notices of the PostgreSQL, MongoDB and Cassandra builds are unchanged byte for byte. I generated them offline with cargo-about 0.9.0.
You fixed 42 of the 47 items of my first review. These are open:
- Item 19 isn't fixed. My comment on line 478 of
client.rshas the runs, and a change that stopped the GoAway closes under the same load. - Items 11, 12 and 13 are partly fixed. My comments on lines 4235, 6834 and 913 of
engine.rssay what is left. - Item 10: the deleted-table case is fixed, and the new emulator test covers it.
roll_forwardstill clears the intents only after every shadow, TTL and stream step succeeds. I found no step at this head that fails on every attempt, so I'm fine with it as it is.
Item 7 is fixed by another route than the one I asked for. The write retries, then leaves a recovery record that the sweeper applies, and a test fails without the record. One case is left, in my comment on line 1696 of engine.rs.
The other inline comments hold the new items on lines of the diff: 1 Blocking, 7 Major, 6 Minor and 1 Nit. One new item is not on a line of the diff:
- Nit: two counts in the description and your reply don't match the tree. Cargo.lock adds 20 third-party packages, and the description says 18.
googleapis-tonic-google-api,-rpcand-typeeach come in at two versions, one set throughgoogleapis-tonic-google-bigtable-v20.36 and one through-admin-v20.44. Only the Bigtable crate usesDEFAULT_ACCOUNT_SETTINGandstring_coerce::u64, and Cassandra and MongoDB still use thedefault_account_idliteral. Please fix the two statements.
These were already there at my last review, so they aren't conditions, but please fix them in the same change:
extenddb.sample.toml:123gives the default ofcatalog_pool_sizeas 8. With the key unset, the catalog pool usespool_size, which defaults to 20.crates/storage-bigtable/Cargo.tomldeclaresanyhow,prost-types,hyper,hyper-utilandbcrypt, and nothing insrc/ortests/uses them.table_key_infoinengine.rsandbuild_reconciler_base_key_infoingsi_worker.rsare two copies of the mapping from a TableDescription to a TableKeyInfo.abort_cleanlyandrollback_pending_txninengine.rsignore the result oftry_abort_pending, and then clear the intents and delete the coordinator. When the commit CAS was applied but its answer was lost, the coordinator is COMMITTED. A reader can roll the transaction forward in that window. The write then stays applied, the client gets 503, and the SDK retry applies the write a second time.
This branch conflicts with main in README.md and docs/differences-from-dynamodb.md, where #1403 changed three TTL rows that this PR also changes. #546 conflicts with it in crates/storage/src/config.rs, where both add a string_coerce helper after u16. I found no other open PR that adds a Bigtable backend or moves the key generators.
CI hasn't run at this head yet.
The PR adds 42,422 lines and deletes 232, in 64 files. crates/storage-bigtable/src has 25,481 production lines and 2,748 lines of test modules (18,398 and 1,269 at my first review), and tests/emulator_integration.rs has 12,144 lines (5,869).
| /// Returns `true` when a non-idempotent `CheckAndMutateRow` failed strictly | ||
| /// before Bigtable applied any mutation (`ResourceExhausted` or `Aborted`). | ||
| #[must_use] | ||
| fn is_pre_execution_rejection(err: &BigtableError) -> bool { |
There was a problem hiding this comment.
Blocking: this treats every RESOURCE_EXHAUSTED as a request that Bigtable never applied, and check_and_mutate_row retries it. tonic 0.14.6 also returns RESOURCE_EXHAUSTED when the HTTP/2 connection closes with ENHANCE_YOUR_CALM. The h2 client in the lock file, 0.4.16, closes the connection that way itself when too many small response frames wait unread. That is the GoAway of item 19. Those responses belong to requests that the server already ran. If the first attempt was applied, the retry finds the new version, and put_cas returns OccMismatch. execute_single_item_write then applies the update a second time, so ADD #n :one adds 2 and the client gets 200. A Put with attribute_not_exists(pk) answers ConditionalCheckFailedException for an item that it stored.
I measured it on the emulator. 32 clients each sent 500 SET n = if_not_exists(n, :z) + :one on their own key, with SDK retries off, beside test_parallel_inserts and four Scan loops. The server logged 163 of these closes. 19 of the 32 counters ended above the number of requests that could have applied, 40 applications more than the requests sent. Two more runs gave 28 of 32. Please return false here when is_status_goaway_or_transport is true. The catalog's CAS writes in catalog/mod.rs use the same retry rule.
| .timeout(RPC_TIMEOUT) | ||
| .connect_timeout(Duration::from_secs(10)) | ||
| .tcp_nodelay(true) | ||
| .http2_adaptive_window(true); |
There was a problem hiding this comment.
Major, item 19: under load on the emulator, the h2 0.4.16 client still closes its connections with GoAway too_many_data_frames. One run of 32 writers and 4 Scan loops logged 163 closes. test_parallel_inserts failed in 2 of 3 runs with ServiceUnavailable on its Scan, and the sweeper's tombstone read failed on 19 passes in a row. The retry after the reconnect hits the same limit. I then built the server with h2 0.4.20 in Cargo.lock. I also replaced the adaptive window on this endpoint with fixed windows: initial_connection_window_size of 16 MiB and initial_stream_window_size of 4 MiB. Under the same load, that server logged 0 closes and 0 failed Scans. h2 0.4.20 alone still gave 202 closes. The GCP endpoint below also uses the adaptive window, and I couldn't measure it on Cloud Bigtable.
| set.insert(data_table.to_owned()); | ||
| } | ||
|
|
||
| async fn ensure_lsi_read_after_write(&self, data_table: &str) { |
There was a problem hiding this comment.
Major: LSI Query and Scan call this before each storage read. It calls roll_forward_committed_txns_for_table, which reads every txn: row of the transaction log, for all tables and accounts. Each COMMITTED row comes back with its post-images. The engine calls storage once per chunk of up to 1,024 items. A 1 MB page of small items therefore reads the log about nine times. The cost of an LSI read then grows with the transactions in progress on other tables. deferred_index_tables is written and cleared but never read. Please run the roll-forward only when this table has deferred work, or key the log rows by table so that the read covers one table.
| /// Any byte sequence `k` starting with `prefix` satisfies `prefix <= k < upper`, | ||
| /// and any byte sequence not starting with `prefix` lies outside `[prefix, upper)`. | ||
| #[must_use] | ||
| pub fn binary_prefix_upper_bound(prefix: &[u8]) -> Option<Vec<u8>> { |
There was a problem hiding this comment.
Major: this is the third copy of the function. crates/storage-sqlite/src/data/query.rs has binary_prefix_upper_bound, crates/core/src/partiql/plan/ranges.rs has next_prefix, and all three return the same bytes. Please move one into extenddb_core or extenddb_storage and call it from the three places.
|
|
||
| if let Some(esk) = exclusive_start_key { | ||
| let resume = encode_exclusive_start_key(esk, key_info, is_index, false)?; | ||
| if pk_prefix_slice(&resume)? != query_pk_prefix.as_slice() { |
There was a problem hiding this comment.
Major: the engine already refuses a start key outside the queried partition, with these two messages, before storage runs (validate_query_start_key_bounds, called from crates/engine/src/query.rs). No other backend repeats the check. This copy also reads extra_sk_conditions when it picks the message, and the engine reads sk_condition only. Please delete it.
|
|
||
| ExtendDB authenticates using `credentials_path` (a service-account JSON key file) when set, or Application Default Credentials (ADC) otherwise. Grant the service account permissions on the target instance(s) covering: | ||
|
|
||
| - **Data plane**: `bigtable.tables.readRows`, `bigtable.tables.mutateRows`, `bigtable.tables.checkAndMutateRow` |
There was a problem hiding this comment.
Minor: bigtable.tables.checkAndMutateRow is not a Bigtable permission. Google's access control page (https://docs.cloud.google.com/bigtable/docs/access-control) says that CheckAndMutateRow needs bigtable.tables.readRows and bigtable.tables.mutateRows. The page lists no checkAndMutateRow permission, so a custom role built from this line fails to create. Please drop it and say that conditional writes need those two permissions.
| | Stream disable and enable | `UpdateTable StreamEnabled=false` answers `UPDATING`; the stream reports `DISABLED` a few seconds later with every shard closed, and every write acknowledged before that lands in the closed stream. `StreamEnabled=true` afterwards creates a new stream with a later label; both streams stay listed, and a disabled stream stays describable after its table is deleted | The shards close inside the `UpdateTable` call and the response says `ACTIVE`. A write that reaches storage after the close is acknowledged and recorded in no stream (on MongoDB it is recorded past the shard's `EndingSequenceNumber` instead); the window is one write wide. A disabled stream is removed with its table. A stream created by a release before this one loses its ARN once the table is disabled and re-enabled (its label lived only in the table row) | | ||
| | `DescribeTable` `ItemCount` and `TableSizeBytes` (Bigtable backend only) | Updated roughly every six hours | Always reported as `0` and `0` on the Bigtable backend; Cloud Bigtable exposes no per-table row count or logical item-byte total without scanning every row | |
There was a problem hiding this comment.
Nit: index ItemCount and IndexSizeBytes are also always 0 on this backend. engine.rs writes 0 for every GSI and LSI, and nothing updates them. Please add them to this row.
| | Concurrent same-key writes on a TTL-enabled table | Unaffected by TTL | Serialized through a base-row claim. Contention is retried internally against a re-read image, so writes stay last-writer-wins; only sustained contention surfaces `TransactionConflictException`. | | ||
| | TTL-enabled write cost | Unaffected by TTL | A claim LWT, with the base write becoming a logged batch (measured: roughly 2× put latency on a single-node bench). The TTL configuration is served from a 5-second cache, the remaining catalog read is overlapped with the index read, and the release is folded into the batch with an exact conditional release off the request path. Non-TTL tables keep the existing fast paths. | | ||
| | TTL on a table with an asynchronously propagated GSI (Cassandra backend only) | Supported | `UpdateTimeToLive` enabling TTL on such a table is a `ValidationException` naming the table, the first asynchronous GSI and its propagation delay. Before, it was an `InternalServerError`, which SDKs retry. A GSI is asynchronous unless its delay, or `index_propagation_delay_ms` when it sets none, is 0. Checked against Cassandra with a storage-level test and on a served build at the default delay (`.review` logs cited in the PR); the wire suite runs Cassandra at delay 0, where TTL is enabled | | ||
| | Cassandra TTL with asynchronous GSIs | Supported | Not currently supported. The Cassandra backend rejects TTL enable when any GSI has a nonzero effective propagation delay, and rejects creating such a GSI on a TTL-enabled table; base tables, LSIs, and synchronous GSIs are supported. See [ADR-0010](adr/0010-cassandra-ttl-expiration-queue.md). | | ||
| | Enabling Cassandra TTL on a live table | No application write quiescence required | Writes that began while TTL was disabled must be quiesced until enable and synchronous backfill complete. Prefer enabling TTL before opening a new table to traffic. Once enabled, writes use the durable exact-claim path. | | ||
| | TTL expiration throughput | Managed by the service | Cassandra: about 1,000 items per table per minute — the sweep processes its batch concurrently across the queue's shard partitions under one per-table lease. Other backends: about 100 per table per minute (a serial 100-item batch per 60-second cycle, with unleased hosts contending for the same rows). A table expiring faster than its backend's rate accumulates backlog. | | ||
| | TTL expiration throughput | Managed by the service | Google Cloud Bigtable: up to 1,600 items per cycle (`100` items per shard across `16` shards under one `lock:ttl_worker` lease). Cassandra: about 1,000 items per table per minute — the sweep processes its batch concurrently across the queue's shard partitions under one per-table lease. Other backends: about 100 per table per minute (a serial 100-item batch per 60-second cycle, with unleased hosts contending for the same rows). A table expiring faster than its backend's rate accumulates backlog. | |
There was a problem hiding this comment.
Major: the worker has no per-cycle limit. limit = 100 in crates/storage-bigtable/src/ttl_worker.rs is the page size, and sweep_shard reads the next page while a page is full, so one pass deletes every due item of each shard. Please describe what the code does, or add the limit.
| | Multi-part base table keys | Not supported | Preview extension (opt-in via the `limits.allow_multipart_table_keys` setting). Standard single/composite keys work identically. | | ||
| | GSI throughput on a `PROVISIONED` table | Every GSI needs `ProvisionedThroughput` of at least 1 read and 1 write unit | A GSI `ProvisionedThroughput` below 1 (including 0/0) is `ValidationException` on `CreateTable` of a `PROVISIONED` table and on `UpdateTable`'s GSI `Create` ("ReadCapacityUnits and WriteCapacityUnits must both be greater than or equal to 1 for index: <name>"; the service's text was not captured). A GSI with no `ProvisionedThroughput` is still accepted on a `PROVISIONED` table, and `UpdateTable` to `PROVISIONED` leaves an on-demand table's GSIs without one; see the `BillingModeOverride` row under Backup and Restore for how a backup of such a table restores | | ||
| | Projected attributes across all indexes | At most 100 | Enforced on `CreateTable` (and so on `RestoreTableFromBackup`, which validates its target the same way) and on `UpdateTable`'s GSI `Create`: every `NonKeyAttributes` entry of every GSI and LSI is counted, so an attribute projected into two indexes counts twice. Over 100 is `ValidationException` ("Number of projected attributes in all indexes exceeds limit of 100, projected: <n>"; the service's text was not captured) | | ||
| | Index key validation on `UpdateItem` and transaction writes | A secondary-index key attribute must carry its declared scalar type and may not be empty. On `UpdateItem` a literal operand of the wrong type (`SET k = :v`, `ADD`, `DELETE`, `list_append` of literals) is refused on the statement, ahead of the `ConditionExpression`, naming the attribute and the index; a value computed from the item (an attribute reference, the fallback of `if_not_exists`) is refused after the condition passes with the message "The update expression attempted to update the secondary index key to unsupported type"; a key left empty is refused after the condition passes with the update-expression wording. In `TransactWriteItems` a wrong-typed key (table or index) on any member cancels the transaction with the first such member's `ValidationError` in position and `None` elsewhere; otherwise an empty index key on any member is a top-level `ValidationException`; otherwise members report their own conditions. On a `Put` member both checks come ahead of the member's condition. (Measured on the service.) | Matches on every backend. Two known shared differences: an empty index key supplied through the legacy `AttributeUpdates` parameter is reported with the update-expression wording where the service uses the `PutItem` wording naming the index; and a request whose own value exceeds 400 KB is refused for size by the service before any index-key check, where ExtendDB reports the index-key fault first. | | ||
| | `Query` on a GSI with several RANGE attributes (MongoDB and Cassandra backends) | Orders results over every RANGE attribute in key-schema order and serves a key condition on each of them (equality on every one before the last, any operator on the last) | SQLite and PostgreSQL match the service. The MongoDB and Cassandra backends filter the first RANGE attribute of such an index only: a key condition on a later RANGE attribute is refused with `ValidationException` naming the attribute and the backend. MongoDB orders results by the first RANGE attribute then the base table key. Cassandra orders a page over every RANGE attribute then the base table key, and refuses a `Query` that carries an `ExclusiveStartKey` on such an index with `ValidationException` (the cursor compares the first RANGE attribute only). Every refusal the service gives for the condition's shape (one condition per key, condition count, missing HASH attribute, RANGE gap, non-key attribute, value type) is the same on every backend. | | ||
| | `Query` on a GSI with several RANGE attributes (MongoDB, Cassandra and Bigtable backends) | Orders results over every RANGE attribute in key-schema order and serves a key condition on each of them (equality on every one before the last, any operator on the last) | SQLite and PostgreSQL match the service. Google Cloud Bigtable also orders and filters across all `1..=4` HASH and `0..=4` RANGE attributes in key-schema order, subject to Cloud Bigtable's `4,096`-byte physical row-key ceiling: single-RANGE GSIs and LSIs always fit within `3,276` bytes, whereas on a `2..=4`-RANGE GSI an item whose combined escape-encoded RANGE values exceed `4,096` bytes is refused before the base write commits with `ValidationException`. The MongoDB and Cassandra backends filter the first RANGE attribute of such an index only: a key condition on a later RANGE attribute is refused with `ValidationException` naming the attribute and the backend. MongoDB orders results by the first RANGE attribute then the base table key. Cassandra orders a page over every RANGE attribute then the base table key, and refuses a `Query` that carries an `ExclusiveStartKey` on such an index with `ValidationException` (the cursor compares the first RANGE attribute only). Every refusal the service gives for the condition's shape (one condition per key, condition count, missing HASH attribute, RANGE gap, non-key attribute, value type) is the same on every backend. | |
There was a problem hiding this comment.
Major: the 4,096-byte check in crates/storage-bigtable/src/gsi.rs applies to the whole index row key. That key also holds a 37-byte header, 3 bytes per RANGE attribute, part of the base partition key and all of the base sort key. I made a table with a 1,024-byte sort key and a GSI with three RANGE attributes. The backend refuses an item whose three RANGE values are 1,000 bytes each. Its answer is "encoded index shadow row key size (4108 bytes) exceeds Bigtable maximum limit of 4096 bytes". SQLite stores the item. Please state the limit as gsi.rs computes it, here and on line 150 of docs/bigtable-setup.md.
| backup_id = backup_arn.split("/backup/", 1)[1] | ||
| except ClientError as exc: | ||
| err = exc.response["Error"] | ||
| if err.get("Code") == "ValidationException" and "CreateBackup is not supported" in err.get("Message", ""): |
There was a problem hiding this comment.
Minor: this fallback runs on any backend whose CreateBackup answers this ValidationException. On PostgreSQL or SQLite, a regression to that answer would turn these tests into skips instead of failures. The same pattern is in tests/test_authz_resource_arn.py:163 and tests/test_metrics_table_names.py:207. configured_backend() in tests/conftest.py already reads EXTENDDB_TEST_BACKEND, which devtools/run-tests exports. Could you take the fallback only when it returns bigtable, and let the call raise on every other backend?
What
Adds the Experimental Google Cloud Bigtable storage backend (
crates/storage-bigtable) and opt-in binary feature (--no-default-features --features bigtable) per #186 (default = ["postgres"]preserved).CheckAndMutateRowon single-cluster transactional app profiles, retrying strictly pre-execution transport rejections on non-disambiguated CAS calls and disambiguating coordinator opens viat:open_nonce) with deterministicm:v * 1_000cell timestamps (MaxNumVersions(1)GC), incarnation-fenced lock-then-read 2PCTransactWriteItemswith sorted participant locking, upfront/post-update key-fault resolution (CancellationReason::resolve_key_faults), ABA-fenced Phase 2 apply,GetItem/Query/Scancommitted-intent read-through (read-committed across rows onQuery/Scan, with server-side version-only tombstone skipping and coordinator-fenced multi-chunk writes), andTransactGetItemsdouble-read snapshot validation.Nkeys; multi-attribute (1..=4HASH,0..=4RANGE) digest-bounded (<= 4 KiB) + FDB escape-encoded GSI (t<16hex>_g<8hex>) and LSI (t<16hex>_l<8hex>) shadow tables with version-fenced inline writes, pre-readensure_lsi_read_after_writeflush + roll-forward,O(1)table_id_index:lookups, transient retries + backoff-journaled/bufferedpost-*recovery, and lease-fenced onlineUpdateTableGSI builds; 16-shard TTL index (<= 4 KiB[0x44][SHA-256:32]digest +tv1:payload fallback for long composite keys) withENABLING -> ENABLEDbase-table backfill,O(1)generation-fenced disable, and per-row non-starvingb"tomb:"version-only tombstone GC; and write-ahead fenced DynamoDB Streams (4 CRC32 shards, pre-createdShardMeta, pre-companionStreamSpecificationrefusal checks, contiguous slot append +stream_lineage, single-clock-read millisecondAT_TIMESTAMPseeks viafirst_sequence_number_at_or_after, millisecond retention cutoffs, unifiedending_sequence_numbercursor fencing, and boundedscan_str_rangereads).tonicbalance_channelgRPC pool (64 MiBmessage limit, per-message streaming deadlines,GoAwayreconnect/retry, multi-frameReadRowsAssembler), typedAdminClientstatus mapping with connect/request timeouts, startupGetAppProfilesingle-cluster validation, per-row CAS-after monotonic catalog overwrites (compare_and_swap_raw_after),SecretKeysKEK/DEK key ring withO(page_size)read_secret_pagepagination, CAS-guarded IAM/metrics/rate-limit stores (sharingextenddb-storagekey/policy/config/bootstrap helpers andO(1)access-key-indexedfetch_session_data),ADR-0023renewed-leaseCatalogMigrations(M0001CatalogBaseline+M0001DataBaselineoneffective_data_instance_id,2..=12NotApplicable, raw row-key foreign-catalog check, leasedLockedStores::management(),TimestampRangeFilter-guardedrenew_lock) +ServingRegistration, 5 lease-guarded runtime workers (ItemCount = 0/TableSizeBytes = 0documented), andCreateBackuprefusal (StorageError::Unsupported) with empty-catalog responses onListBackups/DescribeBackup/DeleteBackup/RestoreTableFromBackup. Vector search is not implemented (the defaultas_vector_search()is kept).docs/bigtable-setup.md,crates/storage-bigtable/README.md,docs/differences-from-dynamodb.mdentries,README.mdExperimental tier row,devtools/run-bigtable-tests(HTTP/2SETTINGSreadiness probe + IPv6[::1]support),devtools/check-bigtable-catalog-lock,devtools/run-tests --backend bigtable,.github/workflows/integration-bigtable.yml, and--features bigtableinclippy.yml.Reading order: (1)
config,data/{client,admin},data/encoding/*-> (2)catalog/*,catalog_store,bootstrapper,migrations,m0001_baseline-> (3)data/{item_ops,query_scan},transact,streams,gsi,backup_stubs-> (4)engine& workers -> (5)crates/{storage,server,app,bin}, docs &tests/emulator_integration.rs.Why
Lets DynamoDB workloads evaluate Google Cloud Bigtable as a storage backend without application or SDK changes. Written against RFC-0002 and RFC-0003 at the Experimental tier (
README.md).Closes #185
Testing done
Run locally on
523548f(merged withmainv1.1.0at222d80a) withrustc 1.96.1(clippy 0.1.96). CI uses 1.97.0 for clippy/rustfmt and tests on stable and MSRV 1.94.0; I have not run those toolchains locally.--locked --offline):cargo fetch --locked,cargo fmt --all -- --check,python3 devtools/check-released-through,python3 devtools/check-actions-pinned(29workflows,3actions),python3 -m unittest discover -s devtools -p '*_test.py'(163tests),node --test .github/scripts/*.test.js(51tests),doc_version_literals(extenddb-storage-postgres), and clean-treecargo package --workspace --no-verify --locked --offline+python3 devtools/check-crate-packages(16/16crates at1.1.0) all pass.cargo clippy --locked -p extenddb-storage-bigtable --lib --no-deps -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used(both default and--features test-hooks): 0 warnings.cargo clippy --locked -p extenddb-storage-bigtable -p extenddb-storage -p extenddb-engine -p extenddb-server -p extenddb-app -p extenddb-wasm-adapter --all-targets --features extenddb-storage-bigtable/test-hooks -- -D warningsandcargo clippy --locked -p extenddb --no-default-features --features bigtable --all-targets -- -D warnings(plus compiled-outsearch-inequality-filters): 0 warnings.cargo test --locked -p extenddb-storage-bigtable --lib: 83 passed;cargo test --locked -p extenddb --no-default-features --features bigtable --bins: 1 passed.cbtemulatorintegration & catalog-lock checks:EXTENDDB_TEST_BIGTABLE_REQUIRED=1 cargo test --locked -p extenddb-storage-bigtable --test emulator_integration -- --nocapture --test-threads=1: 36 passed (default features) and 46 passed (--features test-hooks),0skipped lines (includingsession_data_conformance::run#1523,write_bootstrap_rowsenv combinations#1349, escapedClientRequestToken#1375, pre-companionStreamSpecificationrefusals#963, millisecond-precisionAT_TIMESTAMPseeks/fencing/retention#468/#503, andU+10FFFFbegins_with+BETWEENacross base tables, GSIs, and LSIs#588); verified that running without an emulator underEXTENDDB_TEST_BIGTABLE_REQUIRED=1fails loudly as expected.devtools/check-bigtable-catalog-lock: verifiedinit,migrate(--list,--reconverge,--forget),verify,serve,backup,SIGKILLlease expiry (<= 45 s), andSIGSTOPregistration-loss shutdown (503within 40 s, exit1, PID cleanup).devtools/run-bigtable-testsagainstcbtemulator+extenddb 1.1.0 (bigtable)binary):v1.1.0suites on523548f:--pytest128 passed, 0 failed acrosstest_session_name_reuse(#1523),test_idempotency_account_scope(#1375),test_auth_integration(#1290),test_streams_at_timestamp(#468/#503), andtest_query_begins_with_max_character(#588);--comprehensive23 passed, 2 xfailed, 0 failed acrosstest_stream_disable_fold.py(#963).54c10ba):--comprehensive666 passed, 4 xfailed, 1 deselected, 0 failed;--rust-integration560 passed, 0 failed (10CreateBackupcells filtered);--pytest71 passed, 2 skipped, 0 failed over IPv6[::1]acrosstest_authz_cross_account,test_metrics_table_names,test_authz_resource_arn, andtest_backup_restore_fidelity; 289 passed, 1 skipped, 1 xfailed, 0 failed on the 12-suite parallel sweep; and 5,787 passed, 25 skipped, 0 failed across the 4-shard sweep.https://bigtable.googleapis.com:443over TLS + ADC on a shared single-cluster dev instance, run on2d3429a):GetAppProfilerejection against a liveallow_transactional_writes = falseapp profile (#34), liveinit(M0001CatalogBaseline+M0001DataBaselinemigrations),serve, anddestroy(#14, leaving all 9 pre-existing non-ExtendDB tables on the shared instance untouched).381wire tests (includingtest_query_reverse_orderand all 10tests/rustquery::*cases incl.query_scan_index_forward_falsewithbigtable-features: CAE=) across CRUD, transactions, multi-attribute GSIs, LSIs, Streams, TTL, throughput modes, IAM/authz, and backup validation: 374 passed, 3 skipped, 1 xfailed, and the remaining 3 (test_transact_get_snapshot.py+ 2 intest_transact_write_conflict.py) passed every correctness assertion (0 torn reads, 0 deadlocks, 0 HTTP 5xx, exactTransactionConflict/Nonecancellation shapes) while hitting only their localhost throughput/time-budget bounds (7vs>102PC writes in 5 s and36–40vs100contended 2PC attempts in 20 s) over ~55 ms cross-region WAN RTT per gRPC round-trip.Not run:
licenses.yml(cargo-about) andwasm.yml(wasm32-unknown-unknowntarget build/clippy/Node steps). Note: relative tomain(222d80a),Cargo.lockadds onlyextenddb-storage-bigtable1.1.0and the 18 Bigtable/GCP third-party crate entries (allApache-2.0/MIT, with zero changes to any upstream crate pin).devtools/run-tests --terraform(configured to run on shard1/3in.github/workflows/integration-bigtable.yml, not run locally) and--external.Checklist
cargo test --workspace/devtools/run-bigtable-tests) — see "Testing done"cargo fmt --check)cargo clippy -- -W clippy::pedantic) — 0 warnings under-D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used(both default and--features test-hooks)README.md,crates/storage-bigtable/README.md,docs/bigtable-setup.md,docs/differences-from-dynamodb.md,crates/bin/README.md, andextenddb.sample.tomlbigtableis opt-in; default binary stayspostgres)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: #186 (duplicate
docs/rfcs/0000-bigtable-backend.mdremoved from this PR so #186 is the sole owner until numbered on merge)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.