Repository navigation
Conversation
88190c4 to
e0d1d91
Compare
|
Thank you for this RFC. At a quick glance, this looks solid. Let me do a thorough review and circle back to you early next week (week commencing 6 July). |
|
Thanks for the detailed RFC, @annguy3n this is a strong design and we're happy to accept a Cloud Bigtable backend on these lines. You've clearly thought hard about the DynamoDB semantics: the lock-then-read 2PC, single-row write guarding, stream replay via the txn log, and the sharded TTL index are exactly the right calls given Bigtable's single-row atomicity. A few DynamoDB-parity points to fold in, split into what must match vs. what's fine to differ if documented: Must match DynamoDB
Fine to differ, just call it out
Overall: accepted in principle, let's tighten the TTL-stream path, key-encoding, and the read-isolation guarantees in the doc, then move to implementation behind the opt-in feature. Really nice write-up. |
|
@LeeroyHannigan Thanks for the feedback, I've updated the RFC to address them. Let me know if you have any other questions/comments. |
0a09a0f to
aa6a7a5
Compare
|
Hi @annguy3n , Thanks for the update to the RFC, please find below my findings BlockingB1. Internal phase-numbering is self-contradictory. The 2PC mermaid in 2.B defines exactly three labeled phases (Phase 1 Open, Phase 2 Commit, Phase 3 Clean up), with intent placement and data apply as unlabeled steps. But the prose references non-existent/contradictory phases: 2.C says intents are written in "Phase 3" (the diagram's Phase 3 is Clean up) and data is applied "only in Phase 7"; 3 says log enrichment in "Phase 2" and stream records written in "Phase 5"; the recovery sweeper (2.E) and streams (3.4) roll forward against these. There is no Phase 4–7 anywhere. This must be reconciled to a single consistent phase list before implementation, because the commit/visibility ordering (see B2) hinges on which phase is the durable commit point. B2. Non-blockingN1. Commit-point vs client-ack visibility gap (needs to be pinned down). 2.C states data in N2. GSI row-key delimiter contradicts the string-key encoding rule. 1.B first says String/Binary keys use "null-byte / length-prefixed terminators to preserve lexicographical sort order," then defines the GSI shadow row key as N3. Trait name is stale vs Notes (positive / low-risk)
Thanks again, looking forward to seeing your implementation of Bigtable here. |
|
@LeeroyHannigan, would you mind to take another pass at it? |
|
Hi @annguy3n, Third pass done. B1 (phase numbering), N2 (bare- BlockingB3. The GSI composite key has a non-terminal raw sort-key segment (1.B, GSI Index Row Keys). Should-fixB2 (carry-over, much improved). The mutation payloads stored in the coordinator row at N1 (carry-over). The success ack point is still unstated - failure paths return NitThe OCC existing-row predicate is written as Close on B3 and the two paragraphs and this is ready to land as an accepted RFC from my side. The design has gotten genuinely tight across the three rounds. |
|
Hi @LeeroyHannigan, Thanks again for the thorough review! We have updated both the RFC ( 1. B3: FoundationDB Tuple Escape-Encoding for Non-Terminal GSI Sort Keys (§1.B)
2. B2: Explicit
|
|
Hi @annguy3n, Thanks for the quick turnaround on pass three, all previous points are cleanly resolved. Before anything else, an apology: some of the items below existed in the first draft and should have been caught in my first pass rather than trickling out over four rounds. To close this out fairly, I did a full front-to-back review of the RFC against the Bigtable documentation, and I also checked out your feat/bigtable-backend branch, built it, and ran the emulator integration suite against a live Bigtable emulator. The good news first: formatting is clean, clippy has zero errors, the feature-gating is exactly right (the default binary builds without the crate), all 44 unit tests pass, and 5 of 7 emulator integration tests pass. The 2PC design held up well under a hard look. Three items block acceptance, all confirmed in the branch:
Handled by the rebase you'll need anyway (the branch is 84 commits behind and Cargo.lock, the workspace Cargo.toml, and extenddb.sample.toml will conflict): main now has a StorageError::Unsupported variant, which is what the BackupEngine stubs should return instead of Internal (Internal maps to HTTP 500 plus error logs; Unsupported maps to ValidationException). Please also update the RFC text to match, and keep the title at RFC-0000 until a number is assigned at acceptance, since 0003 is already referenced in shipped code. Everything else I found (deliverables matrix, clippy warnings under -D warnings, transient-error classification, a line on why the table ledger beats change streams) is non-blocking and fine for the implementation PR. With the three items above addressed and the rebase done, we'd love to see your code in a PR. Thanks for your patience across the rounds, the quality of this contribution is excellent and we're really looking forward to supporting it as a backend. |
Proposes the design of a production-grade Cloud Bigtable storage backend for ExtendDB. Key items include a Lock-then-Read 2PC transaction flow, sharded TTL indexing shadow table, GSI projection enforcement, and secure GCP authentication config.
- Promoted exact decimal number key encoding to core design specification. - Documented TransactWriteItems ClientRequestToken idempotency (10m) and duplicate item rejection rules. - Clarified read isolation guarantees (no dirty reads via CF 'd' snapshot writes and serializable TransactGetItems). - Documented TTL sweeper REMOVE stream emission with service principal identity. - Added explicit ConsistentRead=true rejection on GSIs. - Called out cross-row visibility in apply window and PITR retention differences.
…p_profile, and BackupEngine stubs
…coding, TransactGetItems rule, and ack boundary
…ced streams, Unsupported stubs, and deliverables matrix
88a7659 to
0632fbd
Compare
|
Hi @LeeroyHannigan, Thanks for the front-to-back review and live emulator run! Both
Verified on rebased Implementation PR is now open at #1154. |
|
@LeeroyHannigan the pass-4 items are in Two corrections to what I have written here:
|
LeeroyHannigan
left a comment
There was a problem hiding this comment.
I read this against the implementation in #1154 at 44f067f. The three pass-4 items hold there. Every cell timestamp comes from the OCC version, and single-item writes and the TTL worker write their stream records through the transaction log. test_transact_get_items_read_through_log_rule passes on the emulator.
Since my last pass, the RFC has become a description of the backend as built. It "implements the full ExtendDB v1.0.0 backend surface", and each row of section 8 says Implemented. RFC-0003 §6.3 asks an RFC not to present a mechanism as working unless it is in the live code path. Parts of the new text don't match the code, so before it merges:
- Section 8 says the bootstrapper works through
catalog_key_presentanddata_connection_present(line 241). Neither is a function in the crate.catalog_key_presentis a field of the shared key status report, anddata_connection_presentexists nowhere in the tree. - Section 8 marks
CatalogMigrationsandServerRuntimeHooksas Implemented, with alock:catalog_migrationslease (lines 242 and 244). In the crate nothing renews the lease, a fresh catalog takes no lock row, andservetakes no serving registration and reads no catalog status. - Section 6 says migrations 2 to 12 are recorded under the lock, and that
m0001_baselineprovisions the transaction log and the TTL index (line 212). Migration 1 isKind::Breaking. Withdata_instance_idset, the engine uses a transaction log and a TTL index on the data instance that no migration creates. - Section 1.B describes a GSI key of one HASH and one RANGE segment, but since #429 main's GSIs take several of each. Section 2.D says version-guarded shadow updates never leave a stale entry. But when the delete of the old entry fails, the engine only logs it and the write succeeds (
engine.rs:963-970in #1154). - Section 7 no longer mentions export. The August text noted it, as my 7 July review asked. On this backend, as on the others, ExportTableToPointInTime is a paged Scan with no point in time, and section 7 should say so.
- The Motivation says the design solves out-of-order shard visibility in streams and the online GSI build (items 4 and 6). In #1154 at 44f067f these don't hold yet. A stream record written before its shard row exists gets a clock-based sequence number that sorts after later records. A reader of that shard then gets nothing more. A new GSI can go ACTIVE without the writes of a node that hadn't seen the index yet. My review of #1154 has the detail. The RFC shouldn't claim these as solved until the code solves them.
- Testing Strategy 3 names TLC model checking, but no TLA+ spec or config is in the tree. You've said you'll delete it, which covers this.
These were in the text at my last pass, so they aren't conditions, but please fix them in the same change:
- The summary calls the backend production-grade (line 10). The crate's description and the sample config call it experimental, and
README.md:53defines Experimental as not for production use. 139 of our 1,388 wire tests fail on it today. Please state the tier as Experimental. - On 21 August I called the app-profile text accurate, and one part isn't. Section 2.E says
CheckAndMutateRowneeds single-cluster routing "or multi-cluster routing with single-row transactions enabled". The API offers single-row transactions only on single-cluster routing. Nothing checks the app profile at startup either. - The TTL index design has no step that indexes the items written before TTL is enabled, so TTL never deletes them. #1154 needs one, and the RFC should describe it.
The RFC also doesn't mention dev_mode, which gives any user named __dev_admin__ allow-all in a production build (catalog_store.rs:2650-2656 in #1154). I've asked #1154 to delete that code path. If it stays, section 6 should describe it.
On the process: I put the accepted label on with my 7 July "accepted in principle" comment, but the process in docs/rfcs/README.md hasn't run yet. There are no maintainer reviews and no final comment period, the file still says Status: Draft, and it has no number. #1154 carries a byte-identical copy of this file, so merging #1154 first would land it as 0000. I'd keep the file only in this PR, and have #1154 reference the RFC by number once this one merges.
… parity, and backend protocols - State backend tier as Experimental and remove unshipped verification claims and dev_mode references. - Align Bootstrapper, CatalogMigrations (MigrationId::Baseline catalog + data_instance_id split, renewed lock:catalog_migrations), and ServerRuntimeHooks (ServingRegistrar, ServingRegistration, startup status & single-cluster GetAppProfile check, 5 leased workers) with live crate symbols. - Document multi-attribute digest-bounded GSI/LSI shadow keys, durable post-* shadow/TTL recovery, pre-CAS stream_lineage shard creation, leased online GSI visibility fence, TTL ENABLING backfill, live-scan ExportTableToPointInTime, and zero ItemCount/TableSizeBytes.
1150651 to
0730036
Compare
…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.
|
Thanks for the thorough review against Summary of changes:
|
…k/recovery invariants - Document bigtable-features: CAE= reverse-scan metadata, URL-encoded AdminClient x-goog-request-params routing metadata, and AlreadyExists-gated missing-family ModifyColumnFamilies reconciliation. - Sync multi-chunk CheckAndMutateRow stage fencing, (m:v, m:chunk) shadow preemption, bounded inline post-commit side effects with t:base_guard recovery, wall-clock-gated tombstone reclamation, CAS-verified stream shard sealing, and slow-write GSI drift repair in docs/rfcs/0000-bigtable-backend.md.
…rough protocols
- Align §1.B `gsi::hash_partition_values` framing (`[count:u32BE:4]([tag_i:1][len_i:4][bytes_i]){1..4}`), §4.A `<= 4,096`-byte `[0x44][SHA-256:32]` + `tv1:` TTL index keys, and §1.A monotonic per-row catalog overwrites (`get_raw_cell_bytes_with_ts` / `compare_and_swap_raw_after`) and `O(1)` `table_id_index:` lookups with `crates/storage-bigtable`.
- Sync §2.A/§2.C/§2.D/§2.F pre-execution CAS retry rules and `t:open_nonce` coordinator disambiguation (`DataHandle::check_and_mutate_row_idempotent_with_attempt`), `GetItem`/`Query`/`Scan` committed-intent read-through (read-committed across rows on `Query`/`Scan`), `ensure_lsi_read_after_write` pre-read flush + roll-forward, buffered/backoff `post-*` recovery, and per-row non-starving `b"tomb:"` tombstone GC (`blocked_tables` + `unsettled_committed_rows`).
- Sync §5 online GSI build symbols (`TableEngine::update_table` and `gsi_worker::recover_creating_gsi`), §6/§8 `ADR-0023` migration lease fencing (`resolve_status` raw row-key foreign-catalog check, `TimestampRangeFilter`-guarded `renew_lock`, lease-wrapped `LockedStores::management()`), `1h` `stream_record_cleanup` cadence (`24h` retention), `AdminError::Rpc { context, status }`, `EffectiveStore::Configured` backup banner behavior, and `devtools/check-bigtable-catalog-lock`.
…sticsStore defaults, and U+10FFFF query coverage
Merge upstream main (ExtendDB v1.1.0) into rfc/bigtable-backend and reverse-sync docs/rfcs/0000-bigtable-backend.md with the v1.1.0 trait surface and conformance coverage: - Update ExtendDB binary version literals to v1.1.0 (ExtendDB#1514). - Document O(1) access-key-indexed AuthorizationStore::fetch_session_data (including expired sessions), symmetric 4 KiB key-length bounds, and session_data_conformance::run (ExtendDB#1523). - Document escaped ClientRequestToken stored tokens (ExtendDB#1375), pre-companion StreamSpecification refusal in TableEngine::update_table (ExtendDB#963), default SettingsStore::get_setting_bounded (ExtendDB#1449), and write_bootstrap_rows admin environment-variable handling (ExtendDB#1349).
LeeroyHannigan
left a comment
There was a problem hiding this comment.
I read this head (4c02b8e) against #1154 at 523548f. I checked each item of my last review in the RFC and in the code it describes, and I read every change since 1150651.
You fixed six of the seven items of my last review, and partly fixed the other one:
- Fixed. The §8
Bootstrapperrow names only functions that exist. Each one is a method ofBigtableBootstrapperin #1154. - Fixed. §6 and §8 describe the renewed lease,
wait_for_servers, the serving registration and the status check inserve, and #1154 has each of them. Two attributions on line 196 are wrong. My comment there gives them. - Fixed. §6 gives migration 1 as
Kind::Breaking, with the catalog body oninstance_idand the data body on the data instance, asm0001_baseline.rsdoes. - Fixed. §1.B describes up to four HASH attributes under a digest and up to four RANGE segments. §2.D no longer says that a shadow update never leaves a stale entry.
- Fixed. Line 208 describes ExportTableToPointInTime as a paged Scan with no point in time.
- Partly fixed. The Motivation now lists the problems instead of calling them solved. #1154 now refuses a record whose shard row is missing, where my last review found a clock-based sequence number. §3.A still says that each enable creates the shard rows before it publishes the label, and #1154 doesn't do that in every case yet. My comment on line 147 gives the detail. The GSI build fence in #1154 also has a gap. Its 1 s cache age starts when the catalog read returns. So a catalog read slower than about 100 ms reopens the window that §5 says the fence closes.
- Fixed. Testing Strategy no longer names TLC.
You fixed the three notes and the dev_mode text too. The Summary says Experimental. §2.E gives single-cluster routing as the only routing with single-row transactions. §4.A describes the ENABLING backfill, and §6 says that no development admin bypass exists. #1154 has none.
The inline comments hold the new items. Each one is in text that is new since my last review.
The process items are unchanged. The file says Status: Draft, with no final comment period and no number. No maintainer has approved it, and the accepted label is still on. RFC-0003 asks for devtools/run-tests --extenddb --all to pass in CI before acceptance, and no CI has run at the head of #1154 yet.
I found no other PR that adds a Bigtable RFC. #1184, #1396 and #142 are RFCs for other backends, and each one changes only its own file under docs/rfcs/.
| * `version_to_timestamp_micros(v) = (v * 1_000) as i64` | ||
| * `next_millis_exclusive(ts_micros) = ((ts_micros / 1_000) + 1) * 1_000` | ||
| * **Single-`SetCell` Shadow Puts & Intent-Fenced 100,000-Mutation Chunking (`MAX_MUTATIONS_PER_RPC = 90_000`):** Because family `d` uses `MaxNumVersions(1)` and every reader applies `CellsPerColumnLimitFilter(1)`, `ItemOps::build_shadow_put_mutations` emits a single `SetCell` per retained projected attribute (`ts_micros >= max_d_ts`) plus `DeleteFromColumn` **only** for removed attributes—keeping a 50,000-attribute `ALL`-projected GSI/LSI shadow write at `50,002` mutations inside a single atomic `CheckAndMutateRow` RPC. Whenever a base-table write exceeds `MAX_MUTATIONS_PER_RPC` (`90_000`), single-item `PutItem` and `UpdateItem` writes route exclusively through the coordinator-logged `sgl-*` commit path (`ItemOps::put_cas` rejects `> MAX_MUTATIONS_PER_RPC` rather than staging unlogged multi-chunk writes) so `GetItem`, `Query`, `Scan`, and `TransactGetItems` resolve the full committed item from `__extenddb_txn_log__` (with `in_progress_chunk` retry guards preventing torn mid-chunk reads), while `apply_fenced_mutation` and `apply_shadow_version_cas` execute progressive single-`Condition` `CheckAndMutateRow` batches fenced on `m:intent:*` (`attr:<offset>`) or `m:chunk` stage markers and `m:v`—placing primary-key attributes in the initial chunk and advancing `m:v` only on the final chunk. | ||
| * **Non-Idempotent CAS Pre-Execution Retry Only & Wall-Clock Per-Row Timestamps:** `ItemOps::put_cas`, `ItemOps::delete_cas`, and `ItemOps::apply_shadow_version_cas` invoke `DataHandle::check_and_mutate_row` (retrying only pre-execution transport rejections, never post-execution `Unavailable`/`DeadlineExceeded`/`GoAway` without write disambiguation) so a lost response after Attempt 1 commits never triggers an `OccMismatch` re-execution of `UpdateItem` (`ADD`) or spurious `ConditionalCheckFailedException`. Non-OCC metadata cells (coordinator, catalog, stream, and chunk markers) use wall-clock millisecond-aligned timestamps (`monotonic_timestamp_micros`) paired with per-row `monotonic_timestamp_after_micros(existing_ts)` rather than advancing a process-wide counter that could drift ahead of wall clock under high QPS. |
There was a problem hiding this comment.
Minor: #1154 at 523548f doesn't do this yet. is_pre_execution_rejection in crates/storage-bigtable/src/data/client.rs treats every RESOURCE_EXHAUSTED as a rejection before execution, so check_and_mutate_row retries it. tonic 0.14.6 also gives RESOURCE_EXHAUSTED for an HTTP/2 error with the reason ENHANCE_YOUR_CALM, which is how the connection closes after a GOAWAY with that code. That close can come after Bigtable has applied the first attempt. The retry then answers OccMismatch, and the OCC loop applies the ADD a second time. In the emulator run of my first review, the server logged 23 of these closes, and 4 of them were on CheckAndMutateRow. This line can stay as it is once #1154 stops the retry when is_status_goaway_or_transport is true.
| #### A. Write-Ahead Fenced Stream Emission, Pre-CAS Shard Creation & Stream Lineage | ||
| Whenever a caller supplies `stream: Some(&StreamCapture)` on a stream-enabled table, single-item writes (`PutItem`, `UpdateItem`, `DeleteItem`—including TTL sweeper deletions) execute through the `__extenddb_txn_log__` commit fence (`commit_fenced_single_item_write` + `roll_forward`), while `stream: None` writes (`ImportTable` bulk imports) suppress stream emission: | ||
|
|
||
| 1. **Pre-CAS Shard Provisioning & Pre-Close Roll-Forward (`extenddb_storage::stream_lineage`):** Each stream enablement (`CreateTable` or `UpdateTable`) allocates a monotonic stream label via `stream_lineage::next_stream_label` and pre-creates `SHARDS_PER_STREAM` (`4`) open `ShardMeta::new_open` rows (`00..03`) at `stream_shard:<shard_id>` **before** publishing `latest_stream_label` in `table_meta` via `Catalog::mutate_json_cas` (cleaning up orphaned pre-created shards if CAS loses a race). Conversely, disabling a stream calls `roll_forward_committed_txns_for_table` **before** closing shards (`close_shards_by_id` serializing under `shard_local_mutex` and using `O(1)` tail-probing `latest_sequence_for_shard` clamped at `ending_sequence_number` via `advance_shard_cursor_if_open` rather than scanning every historical record), `streams::write_record_ordered_at` persists `stream_dedup` markers before atomically verifying `ShardMeta` remains open via `advance_shard_cursor_if_open` (`Catalog::mutate_json_cas`—deleting any unexposed record/dedup slot `> ending_sequence_number` and returning `Ok(None)`), `streams::ensure_shard_past_record` uses the same `advance_shard_cursor_if_open` fence during retention pruning so expired post-seal orphans never advance `ShardMeta.last_sequence_number` past `ending_sequence_number`, and `StreamEngine::get_stream_records` and `StreamEngine::first_sequence_number_at_or_after` clamp both `scan_str_range` bounds and returned records at `ending_sequence_number`. |
There was a problem hiding this comment.
Minor: two parts of this paragraph don't hold in #1154 at 523548f. First, when the CAS can't use the pre-created label, it falls back to a fresh label. The call inserts the shard rows of that label after the CAS publishes it, which is the order this paragraph rules out. Second, the label is a time in milliseconds. So two enables with the same view type in the same millisecond pre-create the same four shard ids. The second call's put_shard_if_absent calls return false, and nothing reads that result. Its CAS then fails, and its cleanup deletes the four rows that the published stream uses. After that, a write that captures a stream record can't finish its roll-forward, and later writes to the same item fail. RFC-0003 §10.3 asks that repeated UpdateTable calls don't corrupt state. Please describe the design that #1154 settles on. It needs a cleanup that deletes only the rows its own call created, and no label published before its rows exist.
| ``` | ||
|
|
||
| * **Resilient Direct `tonic` Pool, Multi-Frame `ReadRowsAssembler`, `64 MiB` gRPC Limits & Split-Instance Isolation (`data/client.rs`, `data/admin.rs`, `config.rs`):** `BigtableClient::connect` builds a multi-channel `tonic::transport::Channel::balance_channel` pool directly over `googleapis_tonic_google_bigtable_v2` configured with `64 MiB` max encoding/decoding message sizes (`MAX_GRPC_MESSAGE_BYTES`), per-message `tokio::time::timeout` guards on streaming `ReadRows` and `MutateRows` responses, a stateful multi-frame `ReadRowsAssembler` (reassembling multi-megabyte cells and multi-cell rows split across consecutive `ReadRowsResponse` stream messages), URL-encoded `x-goog-request-params` regional routing metadata across both data-plane `BigtableClient` and control-plane `AdminClient` RPCs (with `AdminClient` configuring `.connect_timeout` / `.timeout`, sharing a cached `TokenProvider`, preserving structured `AdminError::Rpc { context, status }` codes via `classify_grpc_status`, and `AdminClient::create_table` invoking `ensure_families` strictly on `AlreadyExists` to add only missing column families after `GetTable(SchemaView)`), `bigtable-features: CAE=` (`FeatureFlags { reverse_scans: true }`) metadata enabling server-side reverse `ReadRows`, OAuth2 bearer token injection via `gcp_auth` (skipped with a `BigtableClient::log_startup_endpoint` `tracing::warn!` warning when `emulator_host` or `BIGTABLE_EMULATOR_HOST` is resolved via `BigtableStorageConfig::resolve_emulator_host`, or logged via `tracing::info!` when connecting to Cloud Bigtable over TLS), and automatic pool replacement + bounded retry on HTTP/2 `GoAway` (`ENHANCE_YOUR_CALM`) or transport resets across `read_rows`, `mutate_row`, stream-draining `mutate_rows`, and pre-execution `check_and_mutate_row` errors. | ||
| * **Compile-Time Backend Registration & Shared Storage Helpers (`default = ["postgres"]` Preserved):** `crates/bin` preserves `default = ["postgres"]` while exposing the mutually exclusive `bigtable` Cargo feature (`cargo build --no-default-features --features bigtable`, linted in `.github/workflows/clippy.yml`). Shared IAM key/policy helpers (`generate_access_key_id`, `generate_secret_key`, `generate_session_key_id`, `generate_session_token`, `self_service_policy`) and `string_coerce::u64` live in `extenddb-storage` (reused across all five backends and `crates/server`), and `create_backup_unsupported("bigtable")` wires the startup banner/log notice in `crates/{engine,server,app}` across both `EffectiveStore::Unconfigured` and `EffectiveStore::Configured`. |
There was a problem hiding this comment.
Nit: in #1154 only the Bigtable config uses string_coerce::u64. The helpers that the five backends and crates/server share are the key generators and the self-service policy. Please say that here.
|
|
||
| * **Resilient Direct `tonic` Pool, Multi-Frame `ReadRowsAssembler`, `64 MiB` gRPC Limits & Split-Instance Isolation (`data/client.rs`, `data/admin.rs`, `config.rs`):** `BigtableClient::connect` builds a multi-channel `tonic::transport::Channel::balance_channel` pool directly over `googleapis_tonic_google_bigtable_v2` configured with `64 MiB` max encoding/decoding message sizes (`MAX_GRPC_MESSAGE_BYTES`), per-message `tokio::time::timeout` guards on streaming `ReadRows` and `MutateRows` responses, a stateful multi-frame `ReadRowsAssembler` (reassembling multi-megabyte cells and multi-cell rows split across consecutive `ReadRowsResponse` stream messages), URL-encoded `x-goog-request-params` regional routing metadata across both data-plane `BigtableClient` and control-plane `AdminClient` RPCs (with `AdminClient` configuring `.connect_timeout` / `.timeout`, sharing a cached `TokenProvider`, preserving structured `AdminError::Rpc { context, status }` codes via `classify_grpc_status`, and `AdminClient::create_table` invoking `ensure_families` strictly on `AlreadyExists` to add only missing column families after `GetTable(SchemaView)`), `bigtable-features: CAE=` (`FeatureFlags { reverse_scans: true }`) metadata enabling server-side reverse `ReadRows`, OAuth2 bearer token injection via `gcp_auth` (skipped with a `BigtableClient::log_startup_endpoint` `tracing::warn!` warning when `emulator_host` or `BIGTABLE_EMULATOR_HOST` is resolved via `BigtableStorageConfig::resolve_emulator_host`, or logged via `tracing::info!` when connecting to Cloud Bigtable over TLS), and automatic pool replacement + bounded retry on HTTP/2 `GoAway` (`ENHANCE_YOUR_CALM`) or transport resets across `read_rows`, `mutate_row`, stream-draining `mutate_rows`, and pre-execution `check_and_mutate_row` errors. | ||
| * **Compile-Time Backend Registration & Shared Storage Helpers (`default = ["postgres"]` Preserved):** `crates/bin` preserves `default = ["postgres"]` while exposing the mutually exclusive `bigtable` Cargo feature (`cargo build --no-default-features --features bigtable`, linted in `.github/workflows/clippy.yml`). Shared IAM key/policy helpers (`generate_access_key_id`, `generate_secret_key`, `generate_session_key_id`, `generate_session_token`, `self_service_policy`) and `string_coerce::u64` live in `extenddb-storage` (reused across all five backends and `crates/server`), and `create_backup_unsupported("bigtable")` wires the startup banner/log notice in `crates/{engine,server,app}` across both `EffectiveStore::Unconfigured` and `EffectiveStore::Configured`. | ||
| * **CAS Catalog Overwrites, At-Rest Secret Encryption & Fail-Closed Auth Redaction (`catalog/mod.rs`, `catalog_store.rs`):** `Catalog::put`, `Catalog::put_if_present`, and `Catalog::mutate_json_cas` read raw cell bytes + timestamps via `get_raw_cell_bytes_with_ts` and overwrite via `compare_and_swap_raw_after` (`monotonic_timestamp_after_micros(existing_ts)` + `DeleteFromColumn([0, write_ts))`) so overwrites always supersede any future-skewed or corrupt prior cell under `CellsPerColumnLimitFilter(1)`. `BigtableCatalogStore` and `BigtableCredentialStore` encrypt and decrypt `AKIAEXTENDDB*` access keys and `ASIAEXTENDDB*` STS sessions via `SecretKeys` (`CATALOG_KEY_SETTING = "catalog_encryption_key"`), paging secrets in `O(page_size)` via `Catalog::scan_str_range` (`StartKeyOpen` + `rows_limit = page_size + 1`). Any corrupt catalog row, missing key ring, or AEAD decryption failure in `lookup_credential` logs details server-side via `tracing::error!` and returns a redacted `DynamoDbError::InternalServerError("Internal error during authentication")` without leaking internal identifiers. No unauthenticated development admin bypass exists in the crate. |
There was a problem hiding this comment.
Minor: the catalog key setting is encryption_key. CATALOG_KEY_SETTING in crates/storage/src/secret_keys.rs is "encryption_key", and the bootstrapper in #1154 writes setting:encryption_key. This line and line 29 say catalog_encryption_key. Please use the name that the code writes in both places.
| * **Resilient Direct `tonic` Pool, Multi-Frame `ReadRowsAssembler`, `64 MiB` gRPC Limits & Split-Instance Isolation (`data/client.rs`, `data/admin.rs`, `config.rs`):** `BigtableClient::connect` builds a multi-channel `tonic::transport::Channel::balance_channel` pool directly over `googleapis_tonic_google_bigtable_v2` configured with `64 MiB` max encoding/decoding message sizes (`MAX_GRPC_MESSAGE_BYTES`), per-message `tokio::time::timeout` guards on streaming `ReadRows` and `MutateRows` responses, a stateful multi-frame `ReadRowsAssembler` (reassembling multi-megabyte cells and multi-cell rows split across consecutive `ReadRowsResponse` stream messages), URL-encoded `x-goog-request-params` regional routing metadata across both data-plane `BigtableClient` and control-plane `AdminClient` RPCs (with `AdminClient` configuring `.connect_timeout` / `.timeout`, sharing a cached `TokenProvider`, preserving structured `AdminError::Rpc { context, status }` codes via `classify_grpc_status`, and `AdminClient::create_table` invoking `ensure_families` strictly on `AlreadyExists` to add only missing column families after `GetTable(SchemaView)`), `bigtable-features: CAE=` (`FeatureFlags { reverse_scans: true }`) metadata enabling server-side reverse `ReadRows`, OAuth2 bearer token injection via `gcp_auth` (skipped with a `BigtableClient::log_startup_endpoint` `tracing::warn!` warning when `emulator_host` or `BIGTABLE_EMULATOR_HOST` is resolved via `BigtableStorageConfig::resolve_emulator_host`, or logged via `tracing::info!` when connecting to Cloud Bigtable over TLS), and automatic pool replacement + bounded retry on HTTP/2 `GoAway` (`ENHANCE_YOUR_CALM`) or transport resets across `read_rows`, `mutate_row`, stream-draining `mutate_rows`, and pre-execution `check_and_mutate_row` errors. | ||
| * **Compile-Time Backend Registration & Shared Storage Helpers (`default = ["postgres"]` Preserved):** `crates/bin` preserves `default = ["postgres"]` while exposing the mutually exclusive `bigtable` Cargo feature (`cargo build --no-default-features --features bigtable`, linted in `.github/workflows/clippy.yml`). Shared IAM key/policy helpers (`generate_access_key_id`, `generate_secret_key`, `generate_session_key_id`, `generate_session_token`, `self_service_policy`) and `string_coerce::u64` live in `extenddb-storage` (reused across all five backends and `crates/server`), and `create_backup_unsupported("bigtable")` wires the startup banner/log notice in `crates/{engine,server,app}` across both `EffectiveStore::Unconfigured` and `EffectiveStore::Configured`. | ||
| * **CAS Catalog Overwrites, At-Rest Secret Encryption & Fail-Closed Auth Redaction (`catalog/mod.rs`, `catalog_store.rs`):** `Catalog::put`, `Catalog::put_if_present`, and `Catalog::mutate_json_cas` read raw cell bytes + timestamps via `get_raw_cell_bytes_with_ts` and overwrite via `compare_and_swap_raw_after` (`monotonic_timestamp_after_micros(existing_ts)` + `DeleteFromColumn([0, write_ts))`) so overwrites always supersede any future-skewed or corrupt prior cell under `CellsPerColumnLimitFilter(1)`. `BigtableCatalogStore` and `BigtableCredentialStore` encrypt and decrypt `AKIAEXTENDDB*` access keys and `ASIAEXTENDDB*` STS sessions via `SecretKeys` (`CATALOG_KEY_SETTING = "catalog_encryption_key"`), paging secrets in `O(page_size)` via `Catalog::scan_str_range` (`StartKeyOpen` + `rows_limit = page_size + 1`). Any corrupt catalog row, missing key ring, or AEAD decryption failure in `lookup_credential` logs details server-side via `tracing::error!` and returns a redacted `DynamoDbError::InternalServerError("Internal error during authentication")` without leaking internal identifiers. No unauthenticated development admin bypass exists in the crate. | ||
| * **`ADR-0023` / `ADR-0029` Baseline Migrations, Renewed Lock, Lease-Guarded `LockedStores` & `ServingRegistrar` (`m0001_baseline.rs`, `migrations.rs`, `runtime_hooks.rs`):** |
There was a problem hiding this comment.
Nit: ADR-0029 is the crates.io packaging decision. The migration rules are in ADR-0023. Line 10 also cites ADR-0029 for the baseline migrations. Please cite ADR-0023 in both places.
| * **Compile-Time Backend Registration & Shared Storage Helpers (`default = ["postgres"]` Preserved):** `crates/bin` preserves `default = ["postgres"]` while exposing the mutually exclusive `bigtable` Cargo feature (`cargo build --no-default-features --features bigtable`, linted in `.github/workflows/clippy.yml`). Shared IAM key/policy helpers (`generate_access_key_id`, `generate_secret_key`, `generate_session_key_id`, `generate_session_token`, `self_service_policy`) and `string_coerce::u64` live in `extenddb-storage` (reused across all five backends and `crates/server`), and `create_backup_unsupported("bigtable")` wires the startup banner/log notice in `crates/{engine,server,app}` across both `EffectiveStore::Unconfigured` and `EffectiveStore::Configured`. | ||
| * **CAS Catalog Overwrites, At-Rest Secret Encryption & Fail-Closed Auth Redaction (`catalog/mod.rs`, `catalog_store.rs`):** `Catalog::put`, `Catalog::put_if_present`, and `Catalog::mutate_json_cas` read raw cell bytes + timestamps via `get_raw_cell_bytes_with_ts` and overwrite via `compare_and_swap_raw_after` (`monotonic_timestamp_after_micros(existing_ts)` + `DeleteFromColumn([0, write_ts))`) so overwrites always supersede any future-skewed or corrupt prior cell under `CellsPerColumnLimitFilter(1)`. `BigtableCatalogStore` and `BigtableCredentialStore` encrypt and decrypt `AKIAEXTENDDB*` access keys and `ASIAEXTENDDB*` STS sessions via `SecretKeys` (`CATALOG_KEY_SETTING = "catalog_encryption_key"`), paging secrets in `O(page_size)` via `Catalog::scan_str_range` (`StartKeyOpen` + `rows_limit = page_size + 1`). Any corrupt catalog row, missing key ring, or AEAD decryption failure in `lookup_credential` logs details server-side via `tracing::error!` and returns a redacted `DynamoDbError::InternalServerError("Internal error during authentication")` without leaking internal identifiers. No unauthenticated development admin bypass exists in the crate. | ||
| * **`ADR-0023` / `ADR-0029` Baseline Migrations, Renewed Lock, Lease-Guarded `LockedStores` & `ServingRegistrar` (`m0001_baseline.rs`, `migrations.rs`, `runtime_hooks.rs`):** | ||
| * **Migration 1 (`MigrationId::Baseline`, `Kind::Breaking`, convergent):** Splits cleanly across `M0001CatalogBaseline` (`StoreKind::Catalog` on `instance_id`: provisions `__extenddb_catalog__` and `setting:catalog_id`, with a `detect` check flagging `CatalogStatus::NeedsAttention` if application rows already exist without ledger/version rows) and `M0001DataBaseline` (`StoreKind::Data` on `effective_data_instance_id`: provisions `__extenddb_data_ledger__`, `__extenddb_txn_log__`, and `__extenddb_ttl_index__`), pinned under a single SHA-256 checksum verified by `devtools/check-released-through`. |
There was a problem hiding this comment.
Minor: this line credits two checks to code that doesn't run them. In #1154, both detect bodies in m0001_baseline.rs return an empty list. The NeedsAttention answer for a catalog table with rows and no ledger comes from resolve_status in migrations.rs. devtools/check-released-through compares RELEASED_THROUGH with the last migration id and reads no checksum. The crate's test migration_table_covers_all_ids_and_refuses_additive checks the Bigtable checksums through check_released. Please name the code that does each check.
navareamol
left a comment
There was a problem hiding this comment.
Two things in the Bigtable claims are not backed by the docs, and one test command does not exist on main.
Section 2.E requires a single-cluster profile with single-row transactions on, and checks that one profile at startup. Google's routing page says that if single-row transactions are enabled in profiles pointing at different clusters, the user must make sure conflicting check-and-mutate requests do not go to different clusters (https://docs.cloud.google.com/bigtable/docs/routing). The OCC and 2PC design depends on that atomicity. Does the backend require an instance with one cluster? What happens to the guarantees if someone adds a second cluster or another profile with transactions on? Single-cluster routing also has no automatic failover. Please state the supported deployment shape.
Motivation item 7 and section 2.E say multi-cluster profiles reject CheckAndMutateRow with FailedPrecondition. The routing and app profile pages say transactions cannot be enabled on multi-cluster routing, but I could not find the error a request gets. Has anyone sent the request to a multi-cluster profile on the real service? If not, I think the text should say what the docs say and leave out the error name.
Testing Strategy item 3 uses devtools/run-tests --extenddb --backend bigtable. On main that script accepts only postgres, sqlite, mongodb and cassandra, and devtools/run-bigtable-tests and devtools/check-bigtable-catalog-lock do not exist. Please mark them as arriving with the implementation PR.
I will approve once the replication constraint is written down, the FailedPrecondition sentence is sourced or reworded, and the test commands are marked as not yet on main, together with the open points Lee has on this head.
What
This PR introduces the draft design for the Cloud Bigtable storage backend (RFC-0003).
Key design highlights include:
Why
Cloud Bigtable is GCP's managed wide-column store and serves as the natural target for DynamoDB workloads migrating to GCP. A robust connector allows AWS-to-GCP migration for high-throughput, low-latency applications with zero code changes.
Checklist
ADR / RFC: #185
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.