Skip to content

feat(bigtable): add Google Cloud Bigtable storage backend - #1154

Open
annguy3n wants to merge 13 commits into
ExtendDB:mainfrom
annguy3n:feat/bigtable-backend
Open

annguy3n wants to merge 13 commits into
ExtendDB:mainfrom
annguy3n:feat/bigtable-backend

Conversation

@annguy3n

@annguy3n annguy3n commented Nov 19, 2026 •

Copy link
Copy Markdown

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).

  • Data & transactions: OCC single-row CAS (CheckAndMutateRow on single-cluster transactional app profiles, retrying strictly pre-execution transport rejections on non-disambiguated CAS calls and disambiguating coordinator opens via t:open_nonce) with deterministic m:v * 1_000 cell timestamps (MaxNumVersions(1) GC), incarnation-fenced lock-then-read 2PC TransactWriteItems with sorted participant locking, upfront/post-update key-fault resolution (CancellationReason::resolve_key_faults), ABA-fenced Phase 2 apply, GetItem/Query/Scan committed-intent read-through (read-committed across rows on Query/Scan, with server-side version-only tombstone skipping and coordinator-fenced multi-chunk writes), and TransactGetItems double-read snapshot validation.
  • Indexes, TTL & Streams: 38-digit decimal N keys; multi-attribute (1..=4 HASH, 0..=4 RANGE) 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-read ensure_lsi_read_after_write flush + roll-forward, O(1) table_id_index: lookups, transient retries + backoff-journaled/buffered post-* recovery, and lease-fenced online UpdateTable GSI builds; 16-shard TTL index (<= 4 KiB [0x44][SHA-256:32] digest + tv1: payload fallback for long composite keys) with ENABLING -> ENABLED base-table backfill, O(1) generation-fenced disable, and per-row non-starving b"tomb:" version-only tombstone GC; and write-ahead fenced DynamoDB Streams (4 CRC32 shards, pre-created ShardMeta, pre-companion StreamSpecification refusal checks, contiguous slot append + stream_lineage, single-clock-read millisecond AT_TIMESTAMP seeks via first_sequence_number_at_or_after, millisecond retention cutoffs, unified ending_sequence_number cursor fencing, and bounded scan_str_range reads).
  • Catalog, security & ops: Direct tonic balance_channel gRPC pool (64 MiB message limit, per-message streaming deadlines, GoAway reconnect/retry, multi-frame ReadRowsAssembler), typed AdminClient status mapping with connect/request timeouts, startup GetAppProfile single-cluster validation, per-row CAS-after monotonic catalog overwrites (compare_and_swap_raw_after), SecretKeys KEK/DEK key ring with O(page_size) read_secret_page pagination, CAS-guarded IAM/metrics/rate-limit stores (sharing extenddb-storage key/policy/config/bootstrap helpers and O(1) access-key-indexed fetch_session_data), ADR-0023 renewed-lease CatalogMigrations (M0001CatalogBaseline + M0001DataBaseline on effective_data_instance_id, 2..=12 NotApplicable, raw row-key foreign-catalog check, leased LockedStores::management(), TimestampRangeFilter-guarded renew_lock) + ServingRegistration, 5 lease-guarded runtime workers (ItemCount = 0 / TableSizeBytes = 0 documented), and CreateBackup refusal (StorageError::Unsupported) with empty-catalog responses on ListBackups/DescribeBackup/DeleteBackup/RestoreTableFromBackup. Vector search is not implemented (the default as_vector_search() is kept).
  • Docs, harness & CI: docs/bigtable-setup.md, crates/storage-bigtable/README.md, docs/differences-from-dynamodb.md entries, README.md Experimental tier row, devtools/run-bigtable-tests (HTTP/2 SETTINGS readiness probe + IPv6 [::1] support), devtools/check-bigtable-catalog-lock, devtools/run-tests --backend bigtable, .github/workflows/integration-bigtable.yml, and --features bigtable in clippy.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 with main v1.1.0 at 222d80a) with rustc 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.

  • Formatting, governance & packaging (--locked --offline): cargo fetch --locked, cargo fmt --all -- --check, python3 devtools/check-released-through, python3 devtools/check-actions-pinned (29 workflows, 3 actions), python3 -m unittest discover -s devtools -p '*_test.py' (163 tests), node --test .github/scripts/*.test.js (51 tests), doc_version_literals (extenddb-storage-postgres), and clean-tree cargo package --workspace --no-verify --locked --offline + python3 devtools/check-crate-packages (16/16 crates at 1.1.0) all pass.
  • Clippy:
    • 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 warnings and cargo clippy --locked -p extenddb --no-default-features --features bigtable --all-targets -- -D warnings (plus compiled-out search-inequality-filters): 0 warnings.
  • Unit tests: cargo test --locked -p extenddb-storage-bigtable --lib: 83 passed; cargo test --locked -p extenddb --no-default-features --features bigtable --bins: 1 passed.
  • Direct cbtemulator integration & 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), 0 skipped lines (including session_data_conformance::run #1523, write_bootstrap_rows env combinations #1349, escaped ClientRequestToken #1375, pre-companion StreamSpecification refusals #963, millisecond-precision AT_TIMESTAMP seeks/fencing/retention #468/#503, and U+10FFFF begins_with + BETWEEN across base tables, GSIs, and LSIs #588); verified that running without an emulator under EXTENDDB_TEST_BIGTABLE_REQUIRED=1 fails loudly as expected.
    • devtools/check-bigtable-catalog-lock: verified init, migrate (--list, --reconverge, --forget), verify, serve, backup, SIGKILL lease expiry (<= 45 s), and SIGSTOP registration-loss shutdown (503 within 40 s, exit 1, PID cleanup).
  • Wire-level conformance suites (devtools/run-bigtable-tests against cbtemulator + extenddb 1.1.0 (bigtable) binary):
    • Merged v1.1.0 suites on 523548f: --pytest 128 passed, 0 failed across test_session_name_reuse (#1523), test_idempotency_account_scope (#1375), test_auth_integration (#1290), test_streams_at_timestamp (#468/#503), and test_query_begins_with_max_character (#588); --comprehensive 23 passed, 2 xfailed, 0 failed across test_stream_disable_fold.py (#963).
    • Full regression sweeps (run on 54c10ba): --comprehensive 666 passed, 4 xfailed, 1 deselected, 0 failed; --rust-integration 560 passed, 0 failed (10 CreateBackup cells filtered); --pytest 71 passed, 2 skipped, 0 failed over IPv6 [::1] across test_authz_cross_account, test_metrics_table_names, test_authz_resource_arn, and test_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.
  • Live Google Cloud Bigtable verification (https://bigtable.googleapis.com:443 over TLS + ADC on a shared single-cluster dev instance, run on 2d3429a):
    • Verified startup GetAppProfile rejection against a live allow_transactional_writes = false app profile (#34), live init (M0001CatalogBaseline + M0001DataBaseline migrations), serve, and destroy (#14, leaving all 9 pre-existing non-ExtendDB tables on the shared instance untouched).
    • Ran 381 wire tests (including test_query_reverse_order and all 10 tests/rust query::* cases incl. query_scan_index_forward_false with bigtable-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 in test_transact_write_conflict.py) passed every correctness assertion (0 torn reads, 0 deadlocks, 0 HTTP 5xx, exact TransactionConflict/None cancellation shapes) while hitting only their localhost throughput/time-budget bounds (7 vs >10 2PC writes in 5 s and 36–40 vs 100 contended 2PC attempts in 20 s) over ~55 ms cross-region WAN RTT per gRPC round-trip.

Not run:

  • GitHub Actions workflows on hosted runners (awaiting fork maintainer approval), including licenses.yml (cargo-about) and wasm.yml (wasm32-unknown-unknown target build/clippy/Node steps). Note: relative to main (222d80a), Cargo.lock adds only extenddb-storage-bigtable 1.1.0 and the 18 Bigtable/GCP third-party crate entries (all Apache-2.0 / MIT, with zero changes to any upstream crate pin).
  • devtools/run-tests --terraform (configured to run on shard 1/3 in .github/workflows/integration-bigtable.yml, not run locally) and --external.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace / devtools/run-bigtable-tests) — see "Testing done"
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (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)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed — README.md, crates/storage-bigtable/README.md, docs/bigtable-setup.md, docs/differences-from-dynamodb.md, crates/bin/README.md, and extenddb.sample.toml
  • Breaking changes are noted below (if any) — none (bigtable is opt-in; default binary stays postgres)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, 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.md removed 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.

@annguy3n

annguy3n commented Nov 19, 2026 •

Copy link
Copy Markdown
Author

@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 action_required, waiting for a maintainer to approve it (fork PR). Could you approve them?

What changed since the tree you built in pass 4. Besides the rebase onto v1.0.0 and the pass-4 items, there is one further commit, 44f067f (+7.6k/−2.1k), from a second review pass over the transaction and stream paths. It changes:

  • the coordinator commit and the sweeper abort, which are now compare-and-swap on the coordinator row;
  • intent handling: an intent is no longer skipped once it passes a wall-clock age. Whoever meets one looks up the coordinator row and rolls it forward, clears it, or aborts a PENDING transaction that is past its timeout;
  • TransactGetItems, which reads twice and retries if anything changed in between;
  • stream sequence numbers, which are allocated per shard when the record is written;
  • GSI shadow writes, which are guarded by the row version;
  • UpdateTable, which now applies GlobalSecondaryIndexUpdates.

The RFC text in #186 was updated for these in 1150651.

Still to come on this PR. The description lists what was run locally and what was not.

  • RFC-0003 requires the wire-level conformance suites to pass in CI before acceptance. They have not been run against this backend yet, because devtools/run-tests does not accept --backend bigtable. I am adding that now and will post the results here, followed by a CI job that starts cbtemulator.
  • Without BIGTABLE_EMULATOR_HOST the emulator tests return early and report ok, so cargo test --workspace in CI does not exercise them. I will add a "required" variable that turns the skip into a failure, as the Postgres, MongoDB, Cassandra and S3 suites have.
  • A cleanup commit: some test names and comments carry internal labels that I will rename, and two test-only methods (debug_fenced_put_*) will move behind a test-hooks feature.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, both clippy.yml commands and clippy on the --features bigtable binary 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 --workspace and devtools/check-crate-packages pass, 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

  1. TransactWriteItems doesn't check the type of a member's table key (engine.rs:3843-3887). On the emulator, a Put of pk={"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 through CancellationReason::resolve_key_faults as the PostgreSQL backend does.

  2. 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 of test_gsi_multi_range_query.py fail in their fixture, and one test of test_multipart_gsi.py fails. 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.

  3. 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 of test_item_size_at_limit.py fail. Please call validate_update_item_size on the new item, as the SQLite and PostgreSQL backends do.

  4. A base-table Query uses an S or B sort-key bound as a prefix (query_scan.rs:342-346 and :369). With sort keys a, ab, b, ba and c in one partition:

    Query DynamoDB This backend
    sk = a a a, ab
    sk <= b a, ab, b a, ab, b, ba
    sk > b ba, c c
    sk BETWEEN a AND b a, 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_with and the partition bound only. No wire test caught this, so please add the five-item case to the emulator suite.

  5. 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 400 encoded GSI shadow row key size (4106 bytes) exceeds Bigtable maximum limit of 4096 bytes but 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 before put_cas, so a key failure can't follow the commit.

  6. 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. With pk S and sk N, DynamoDB returns the item for pk = a AND sk = 5 on the index, and this backend returns nothing. Please pass from the engine whether the read is on an index. The engine knows it from index_name.

  7. 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 of test_gsi_online_backfill.py left an extra index entry after a ResourceExhausted on the shadow delete. Please return the error or retry it, so the client gets a transient failure instead of a stale index entry.

  8. 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_index writes 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

  1. An error after the commit point reaches the client (engine.rs:1514, and maintain_ttl_index(...).await? at :3130, :3240 and :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. So ADD #n :one adds two. Please log these errors and return the write's result once the commit point has passed.
  2. 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.
  3. 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 the None arm, 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 the None arm.
  4. A record can land in a closed shard after its EndingSequenceNumber (streams.rs:461-535). write_record_ordered doesn't read ending_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.
  5. 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

  1. extenddb destroy deletes every table in the instance whose name starts with t and has 17 or more characters (bootstrapper.rs:401-404, :421). That matches tables of other applications, such as transactions_2024. destroy shows 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})?$.
  2. dev_mode gives 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 that init writes calls it "Bypass authentication for local testing". dev_auth.rs is dead code, because nothing constructs DevAuthProvider. The project allows dev mode only as a compile-time feature of the SQLite build (crates/bin/src/main.rs:50-62). Please delete dev_auth.rs, the dev_mode setting and its two branches in catalog_store.rs. The emulator tests don't need them.
  3. Long-term access keys lack the AKIAEXTENDDB and extenddb prefixes (catalog_store.rs:61-86, :2158-2161). The emulator server issued AKIASJREOZOTNPCFCUPN. Every other backend issues AKIAEXTENDDB and 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 in crates/server/src/management/crypto.rs, or move it into extenddb_storage, instead of a new copy.
  4. serve reads no catalog status and takes no serving registration (lib.rs:111-187). A server therefore starts on an uninitialized, behind, changed or incompatible catalog, and migrate --yes can run beside it. ADR-0023 decisions 5 to 7 require both, and the MongoDB factory shows the shape (register_and_check_as). Please read Runner::status before the engine starts, refuse the statuses the ADR names, and add a serving_registrar.
  5. The 120 s migration lease is never renewed, and a run continues after it lapses (migrations.rs:459-530). A second migrate --yes can then take the lock while the first still writes. On a fresh catalog, lock takes no lock row, so two init runs 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.
  6. Under load on the emulator, the gRPC client drops its connection after a GoAway with ENHANCE_YOUR_CALM, 23 times in one run. test_concurrency.py::TestParallelInserts::test_parallel_inserts failed in 3 of 3 runs, with ServiceUnavailable on a Scan. On catalog paths the same fault became InternalServerError 10 times, because map_catalog_err matches 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 a GoAway.
  7. 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.
  8. No CI job builds the backend or runs a test against it. You've said a job with cbtemulator is coming. Please run the pytest suites in it, test_concurrency.py included, and add the --features bigtable clippy command to clippy.yml.

Reads that grow with the data

  1. 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.
  2. 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.
  3. 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.
  4. 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

  1. 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), and engine.rs:3890-3898 repeats it. transact.rs:962-972 copies the cancellation-reason constructors of crates/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:

  1. The emulator tests return early and report ok when BIGTABLE_EMULATOR_HOST is unset (tests/emulator_integration.rs:84-87). You've said a required variable is coming. Please set it in the CI job.
  2. DescribeTable of a provisioned table includes BillingModeSummary (engine.rs:1978). 3 tests of test_table_throughput_mode.py fail. SQLite sets it only for PAY_PER_REQUEST.
  3. 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.
  4. A failed update action's message gains an update expression evaluation: prefix (item_ops.rs:1183), and a failed condition gains condition evaluation: (item_ops.rs:1203-1205). The service message should reach the client unchanged.
  5. 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.
  6. 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.
  7. With BIGTABLE_EMULATOR_HOST set, 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.
  8. The comment on app_profile_id says "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.
  9. With data_instance_id set, 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, which init and each start create outside the migration runner. The data instance also has no ledger.
  10. 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 to Internal.
  11. Each attribute is a cell, and a CheckAndMutateRow takes 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.
  12. begins_with on a B sort key misses keys that continue with 17 or more 0xFF bytes (query_scan.rs:373-397). binary_prefix_upper_bound in the SQLite backend builds this bound.
  13. Stream SizeBytes is the JSON length of the keys and the new image (streams.rs:250-254). The other backends report item_size_bytes of the item.
  14. 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 through read_row_resolving_committed_intents in get_item would return the new value.
  15. 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.
  16. refresh_table_size does 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.
  17. The startup log says CreateBackup writes in-catalog backups, but the backend refuses it.
  18. The extenddb crate'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.
  19. 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.
  20. Other copies of code that already exists: the write loop of put_item, delete_item and update_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_u64 beside string_coerce, extract_keys beside extract_key, and DEFAULT_ACCOUNT_SETTING twice.
  21. impl Default for BigtableStorageConfig points at the emulator (config.rs:118-137). version:catalog writes applied_at in Display form, 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.
@annguy3n
annguy3n force-pushed the feat/bigtable-backend branch from 44f067f to 01efd8a Compare November 20, 2026 17:39
@annguy3n

annguy3n commented Nov 20, 2026 •

Copy link
Copy Markdown
Author

Thanks for running the emulator and wire suites and for the detailed review, @LeeroyHannigan! All 47 items are addressed on the updated branch (523548f, cleanly merged with main v1.1.0 at 222d80a and adapted to #468/#503 AT_TIMESTAMP & stream retention, #588 U+10FFFF queries, #963 pre-companion stream refusals, #1349 bootstrap env vars, #1375 escaped idempotency tokens, and #1523 access-key-indexed fetch_session_data):

Items, keys, and indexes (#1–#8)

  • #1 (TransactWriteItems key checks): Added upfront primary/secondary-index key validation (transact_op_key_checks) and post-update key checks routed through CancellationReason::resolve_key_faults.
  • #2 & #5 (Multi-attribute & <= 4 KiB GSI/LSI shadow keys): gsi.rs encodes 1..=4 HASH keys via a 32-byte SHA-256 envelope digest, 0..=4 RANGE keys via FDB escape-terminated segments in KeySchema order (skipping sparse items missing any key attribute), and a 64-byte escaped base_pk prefix + SHA-256 tie-breaker (<= 3,276 bytes for single-RANGE indexes). prepare_shadow_plan validates all shadow keys against 4,096 bytes before put_cas / delete_cas / try_commit_full.
  • #3 (UpdateItem & transacted Update size limit): Wired max_item_size_bytes into BigtableEngine::with_options, calling validate_update_item_size on UpdateItem and validate_transact_update_item_size on transacted Update.
  • #4 (Base-table Query sort-key bounds): Replaced prefix trailers on =, <, <=, >, >=, and BETWEEN with exact bounds (keeping 0xFF / binary_prefix_upper_bound for begins_with and partition ends only) and added test_exact_five_item_sort_key_bounds ([a, ab, b, ba, c]) plus test_query_begins_with_max_unicode_scalar_base_gsi_and_lsi (#588) to emulator_integration.rs.
  • #6 (GSI matching base key schema): engine.rs passes explicit is_index: bool (index_name.is_some()) into QueryScan.
  • #7 & #9 (CAS retry idempotency & shadow/TTL post-commit recovery): Non-disambiguated CAS paths (put_cas, delete_cas, apply_shadow_version_cas) retry strictly pre-execution transport rejections (DataHandle::check_and_mutate_row), while TxnCoordinator::open_with_token disambiguates retries via t:open_nonce so a dropped response after server execution never triggers ABA double-application on ADD or false coordinator collisions. Once past the base commit point, inline GSI/LSI/TTL maintenance runs under a bounded budget and records any unrecovered transient failure as a COMMITTED post-<uuid> entry in __extenddb_txn_log__ (with exponential-backoff retries, in-memory pending_side_effect_recoveries queuing if __extenddb_txn_log__ is momentarily unreachable, and ensure_lsi_read_after_write flushing/rolling forward committed entries before LSI reads) without returning HTTP 503 after commit.
  • #8 (TTL pre-existing item backfill, <= 4 KiB keys & disabled retention): update_ttl(..., true) sets ENABLING while create_ttl_index scans existing items under renewed lock:ttl_backfill:<table_id> (after waiting out the metadata cache fence) before flipping to ENABLED, using <= 4,096-byte table_id-tagged entries ([0x44][SHA-256:32] + tv1: cell payload when wide composite keys + table names exceed 4 KiB). drop_ttl_index flips to DISABLED in O(1) via ttl.generation, ttl_worker leaves due entries untouched while TTL is Disabled/Enabling/Disabling so re-enabling never misses items, and orphaned entries from deleted or recreated tables (table_id mismatch) are retired lazily in O(due).

Transactions and streams (#10–#13, #39–#41, plus upstream #468 / #503 / #963)

  • #10 (Deleted participant table in roll_forward): roll_forward, apply_fenced_mutation, and clear_intent treat TableNotFound on a dropped table as done so surviving rows' intents clear and the coordinator entry advances to CLEANED.
  • #11 & #12 (Pre-CAS stream shards, closed-shard fencing, pre-companion refusals & AT_TIMESTAMP): UpdateTable evaluates StreamSpecification transitions/refusals ahead of companion fields and GSI updates (#963), inserts all 4 ShardMeta rows before publishing latest_stream_label (cleaning up orphans on CAS loss), removes the clock-based None arm in write_record_ordered_at, drains committed transactions before closing shards on disable, and fences writes, latest_sequence_for_shard tail probes, and retention pruning against advancing past ending_sequence_number (advance_shard_cursor_if_open). Implemented StreamEngine::first_sequence_number_at_or_after (#468) with single-clock-read (epoch_secs, epoch_millis) capture (current_stream_clock), persisted created_at_ms (stripped on wire decode via decode_stored_record, with whole-second legacy fallback), paged ascending seeks, and millisecond retention cutoffs (#503).
  • #13 & #41 (Online GSI build visibility & cross-node build lock): Lowered METADATA_CACHE_TTL to 1 s with 250 ms repair_slow_write_schema_drift and a 1.35 s await_schema_visibility_fence before backfill, coordinated across nodes under a renewed lock:gsi_build:<table_id>:<index_name> lease (rolling back only CREATING on failure).
  • #39 & #40 (Stream SizeBytes & GetItem/Query/Scan read-through): streams.rs computes SizeBytes via extenddb_core::types::item_size_bytes, and GetItem, Query, and Scan inspect column family m (Interleave filter), skip pure m:v tombstones server-side without consuming rows_limit, fence > 90,000-mutation writes via coordinator sgl-* commits, and resolve COMMITTED unapplied intents from __extenddb_txn_log__.

Catalog, security, and operations (#14–#21, #27–#38, #42–#47, plus upstream #1523 / #1349)

  • #14 (destroy scoping): drop_databases deletes only the 4 system tables, catalog-listed data/GSI/LSI tables, and orphans matching ^t[0-9a-f]{16}(_[gl][0-9a-f]{8})?$.
  • #15 (dev_mode removal): Deleted dev_auth.rs, removed dev_mode (#[serde(deny_unknown_fields)]), removed both __dev_admin__ branches in catalog_store.rs, and disallowed dev-mode with bigtable in crates/bin/src/main.rs.
  • #16, #26, #46 (Shared helpers, fetch_session_data & deduplication): Moved AKIAEXTENDDB/ASIAEXTENDDB/extenddb key generators, self_service_policy, DEFAULT_ACCOUNT_SETTING, and string_coerce::u64 into extenddb-storage (reused across all 5 backends and crates/server, alongside write_bootstrap_rows #1349); adapted AuthorizationStore::fetch_session_data (#1523) to O(1) iam_session_ak:<access_key_id> -> iam_session:<session_token> point reads without re-checking expiry (with symmetric 4,096-byte key bounds); deleted the duplicate same-item check in engine.rs and duplicate CancellationReason constructors in transact.rs; and consolidated execute_single_item_write, apply_shadow_version_cas, run_leased_worker, and extract_key.
  • #17, #18, #35, #47 (ADR-0023 migrations, LockedStores, ServingRegistrar, data_instance_id, config defaults): m0001_baseline.rs splits M0001CatalogBaseline (StoreKind::Catalog) and M0001DataBaseline (StoreKind::Data on effective_data_instance_id: __extenddb_data_ledger__, __extenddb_txn_log__, __extenddb_ttl_index__); migrations.rs creates __extenddb_catalog__ before locking, flags populated uninitialized catalogs as NeedsAttention via raw row-key sampling, renews the 60 s lock:catalog_migrations lease every 15 s (TimestampRangeFilter-guarded renew_lock + local deadline cancellation), wraps LockedStores::management() under the migration lease, writes RFC 3339 applied_at in version:catalog, and enforces Runner::status + ServingRegistration at serve startup (verified end-to-end by devtools/check-bigtable-catalog-lock). BigtableStorageConfig::default() no longer points at the emulator, and Catalog::put / put_if_present advance timestamps per-row via compare_and_swap_raw_after.
  • #19, #33, #34, #36, #37 (gRPC pool, GoAway, app profile, error mapping, 100k mutations & >4 MiB rows): Replaced bigtable_rs with a direct tonic balance_channel pool (64 MiB message limit, per-message streaming deadlines, stateful multi-frame ReadRowsAssembler) that reconnects and retries reads on HTTP/2 GoAway (ENHANCE_YOUR_CALM), preserves tonic::Status codes across both BigtableClient and AdminClient (with connect/request timeouts and a shared TokenProvider), validates single-cluster transactional AppProfile routing via GetAppProfile at startup/init, and reduces shadow puts to one SetCell per retained attribute (50,002 mutations at 50k attrs) with 90,000-mutation coordinator-fenced chunking.
  • #22–#25 (O(data) & O(catalog) scan elimination):
    • #22 (Option A chosen): Stored each LSI as an ordered shadow table (t<16hex>_l<8hex>), maintained synchronously on writes (with table_id_index: + cache providing O(1) index_info_by_table_id lookups).
    • #23: Bounded GetRecords, read_secret_page, and retention sweeps via Catalog::scan_str_range with rows_limit and O(1) latest_sequence_for_shard.
    • #24: Added b"tomb:" GC queue entries and atomic reclaim_version_only_row after the intent_timeout_secs grace window (guarding unsettled (table, row) pairs without starving GC when unrelated < 60 s settled transactions exist).
    • #25: Restricted gsi_worker strictly to CREATING indexes under renewed leases.
  • #28–#32, #38, #42–#45, #20–#21, #27:
    • Omitted BillingModeSummary on PROVISIONED tables (#28), aligned DeleteAccount message (#29), stripped expression/condition prefixes (#30), used binary_prefix_upper_bound on B begins_with (#38), and redacted pre-SigV4 lookup_credential errors (#32).
    • Refused CreateBackup only (ListBackups -> [], DescribeBackup/DeleteBackup/RestoreTableFromBackup -> BackupNotFoundException, #31) and updated the startup banner/log across unconfigured, disabled, and configured backup stores for bigtable (#43).
    • #42 (Option B chosen): Deleted the table_size_refresh worker (5 runtime workers) and documented ItemCount = 0 / TableSizeBytes = 0 in docs/differences-from-dynamodb.md.
    • Added Experimental tier docs (README.md, crates/storage-bigtable/README.md, docs/bigtable-setup.md, docs/differences-from-dynamodb.md, crates/bin/{Cargo.toml,README.md}, #20, #44), deleted duplicate docs/rfcs/0000-bigtable-backend.md from this PR (#45), eliminated all clippy::pedantic warnings in extenddb-storage-bigtable (0 warnings under -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used), and added EXTENDDB_TEST_BIGTABLE_REQUIRED=1, test-hooks, devtools/check-bigtable-catalog-lock, .github/workflows/integration-bigtable.yml, and --features bigtable in clippy.yml (#21, #27).

Verification on 523548f (v1.1.0)

  • Unit, pedantic clippy & governance: cargo fmt --check, check-released-through, check-actions-pinned (29 workflows, 3 actions), devtools Python tests (163 passed), doc_version_literals, cargo package --workspace --no-verify --locked + check-crate-packages (16/16 crates at 1.1.0), clippy (0 warnings under -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used on --lib --no-deps with and without test-hooks, and 0 warnings under --all-targets), 83 extenddb-storage-bigtable unit tests, and 1 extenddb bin test all pass.
  • Direct cbtemulator & catalog-lock checks: 36/36 passed (default) and 46/46 passed (--features test-hooks) with EXTENDDB_TEST_BIGTABLE_REQUIRED=1 -- --nocapture --test-threads=1 (0 skipped), plus devtools/check-bigtable-catalog-lock (init, migrate, verify, serve, backup, SIGKILL lease expiry, and SIGSTOP 503/exit-1/PID cleanup).
  • Wire conformance (devtools/run-bigtable-tests):
    • Merged v1.1.0 suites on 523548f: --pytest 128 passed, 0 failed (test_session_name_reuse, test_idempotency_account_scope, test_auth_integration, test_streams_at_timestamp, test_query_begins_with_max_character) and --comprehensive 23 passed, 2 xfailed, 0 failed (test_stream_disable_fold.py).
    • Full prior regression sweeps (54c10ba): all 139 prior failures pass (289 passed, 1 skipped, 1 xfailed, 0 failed on the 12-suite parallel sweep; 71 passed, 2 skipped, 0 failed over IPv6 [::1] across test_authz_cross_account.py, test_metrics_table_names.py, test_authz_resource_arn.py, and test_backup_restore_fidelity.py using fixture/case-level CreateBackup skips; 5,787 passed, 25 skipped, 0 failed across the 4-shard sweep); --comprehensive 666 passed, 4 xfailed, 1 deselected, 0 failed; --rust-integration 560 passed, 0 failed (10 CreateBackup cells filtered).
  • Live Google Cloud Bigtable (https://bigtable.googleapis.com:443 over TLS + ADC, single-cluster dev instance, run on 2d3429a): Verified live GetAppProfile rejection on a non-transactional profile (#34), init (M0001CatalogBaseline + M0001DataBaseline), serve, 381 wire tests across CRUD/reverse-Query/2PC/multi-key GSI/LSI/Streams/TTL/IAM/backups (374 passed, 3 skipped, 1 xfailed, incl. test_query_reverse_order and 10/10 Rust query::* tests with bigtable-features: CAE=, plus 3 WAN-RTT throughput-budget checks in test_transact_get_snapshot / test_transact_write_conflict with 0 torn reads, 0 deadlocks, 0 5xx, and exact cancellation reasons), and extenddb destroy (#14, leaving all 9 pre-existing non-ExtendDB tables on the shared instance untouched).

Could you also approve the pending GitHub Actions workflow runs on this PR and #186 when you get a chance?

…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 LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.yml commands 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. With EXTENDDB_TEST_BIGTABLE_REQUIRED=1 and no emulator, 35 of the 36 fail.
  • devtools/check-bigtable-catalog-lock passes 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_inserts still 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:

  1. Item 19 isn't fixed. My comment on line 478 of client.rs has the runs, and a change that stopped the GoAway closes under the same load.
  2. Items 11, 12 and 13 are partly fixed. My comments on lines 4235, 6834 and 913 of engine.rs say what is left.
  3. Item 10: the deleted-table case is fixed, and the new emulator test covers it. roll_forward still 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:

  1. 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, -rpc and -type each come in at two versions, one set through googleapis-tonic-google-bigtable-v2 0.36 and one through -admin-v2 0.44. Only the Bigtable crate uses DEFAULT_ACCOUNT_SETTING and string_coerce::u64, and Cassandra and MongoDB still use the default_account_id literal. 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:123 gives the default of catalog_pool_size as 8. With the key unset, the catalog pool uses pool_size, which defaults to 20.
  • crates/storage-bigtable/Cargo.toml declares anyhow, prost-types, hyper, hyper-util and bcrypt, and nothing in src/ or tests/ uses them.
  • table_key_info in engine.rs and build_reconciler_base_key_info in gsi_worker.rs are two copies of the mapping from a TableDescription to a TableKeyInfo.
  • abort_cleanly and rollback_pending_txn in engine.rs ignore the result of try_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 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/bigtable-setup.md

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`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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", ""):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Cloud Bigtable Storage Backend

2 participants