Repository navigation
feat(replication): map HBase table names to Cloud Bigtable table IDs - #4639
Merged
mutianf merged 1 commit intoOct 27, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to map HBase table names to Cloud Bigtable table IDs, which is particularly useful for handling HBase tables in non-default namespaces. The changes include a new TableNameMapper class to handle these mappings via inline JSON, external files, or prefixed configuration properties, and updates to CloudBigtableReplicator to apply these mappings during replication. Additionally, the PR includes robust error handling for mapping collisions, improved batching logic for replication tasks, and comprehensive unit tests to verify the new functionality.
vermas2012
force-pushed
the
feat/replication-table-name-mapping
branch
3 times, most recently
from
October 13, 2026 15:46
37af92b to
e66517c
Compare
mutianf
reviewed
Oct 26, 2026
vermas2012
force-pushed
the
feat/replication-table-name-mapping
branch
2 times, most recently
from
October 26, 2026 23:39
b566432 to
59545ee
Compare
vermas2012
force-pushed
the
feat/replication-table-name-mapping
branch
from
October 27, 2026 03:22
59545ee to
86cf033
Compare
vermas2012
force-pushed
the
feat/replication-table-name-mapping
branch
2 times, most recently
from
October 27, 2026 13:13
f93c64e to
a8e656e
Compare
vermas2012
force-pushed
the
feat/replication-table-name-mapping
branch
2 times, most recently
from
October 27, 2026 13:25
abf2246 to
831516b
Compare
mutianf
reviewed
Oct 27, 2026
mutianf
reviewed
Oct 27, 2026
mutianf
reviewed
Oct 27, 2026
mutianf
reviewed
Oct 27, 2026
vermas2012
force-pushed
the
feat/replication-table-name-mapping
branch
from
October 27, 2026 14:54
831516b to
6074600
Compare
Support mapping HBase table names (such as namespaced tables like
`my_namespace:my_table`, where `:` is not a valid Cloud Bigtable table ID
character) to Cloud Bigtable table IDs during WAL replication via
`google.bigtable.replication.table_name_mapping` in `hbase-site.xml`.
Key details:
- Single configuration surface (`google.bigtable.replication.table_name_mapping`
in `hbase-site.xml` / Hadoop `Configuration`) using the same
`{"source_hbase_table": "destination_bigtable_table"}` JSON structure as
`HBaseSchemaTranslator`.
- Strict startup validation before opening the Cloud Bigtable connection or
incrementing `SharedResources` reference counts: canonicalizes `default:`
table names, rejects duplicate keys and N:1 mappings, and validates target
table IDs against Cloud Bigtable's naming rules (`[_a-zA-Z0-9][-_.a-zA-Z0-9]*`,
max 50 chars).
- Reserves configured mapping targets at runtime so an unmapped table whose
canonical name collides with a mapped target (e.g., unmapped `table_B` when
`ns:table_B -> table_B`) throws `IllegalStateException` before any batch
tasks are submitted, causing `replicate()` to return `false` and halt that
replication peer rather than silently merging two HBase tables into one
Bigtable table.
- Includes review fixes in `CloudBigtableReplicator`:
- Decrements `SharedResources` reference count if `start(Configuration,
MetricsExporter)` fails after `SharedResources.getInstance(configuration)`.
- Uses `long` for `batchSizeInBytes` and `getRowSize()` to avoid integer
overflow.
- Runs the per-table `replicateTable()` loop inside the `try` block in
`replicate()` so any unexpected exception returns `false` per the method
contract.
- Verified that `com/google/bigtable/repackaged/com/google/gson/stream/JsonReader.class`
is shaded into both `bigtable-hbase-1.x-replication` and
`bigtable-hbase-2.x-replication` JARs.
vermas2012
force-pushed
the
feat/replication-table-name-mapping
branch
from
October 27, 2026 15:08
6074600 to
f537455
Compare
mutianf
reviewed
Oct 27, 2026
| // Suppress the exception here and return false to the replication machinery. | ||
| succeeded = false; | ||
| } finally { | ||
| LOG.trace( |
Contributor
There was a problem hiding this comment.
nit: should we drain the rest of added futures if anything throws?
mutianf
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support mapping HBase table names (such as namespaced tables like
my_namespace:my_table, where:is not a valid Cloud Bigtable table ID character) to Cloud Bigtable table IDs during WAL replication viagoogle.bigtable.replication.table_name_mappinginhbase-site.xml.Key Details
google.bigtable.replication.table_name_mappinginhbase-site.xml(Configuration) using the same{"source_hbase_table": "destination_bigtable_table"}JSON structure asHBaseSchemaTranslator.CloudBigtableReplicator.start()before opening the Cloud Bigtable connection or incrementingSharedResourcesreference counts. Canonicalizesdefault:table names, rejects duplicate keys and N:1 mappings, and validates target table IDs against Cloud Bigtable's naming rules ([_a-zA-Z0-9][-_.a-zA-Z0-9]*, max 50 chars).table_Bwhenns:table_B -> table_B),TableNameMapper.map()throwsIllegalStateExceptionbefore any tasks in the batch are submitted to the executor, causingreplicate()to returnfalseand halt replication for that peer rather than writing two HBase tables into one Bigtable table.CloudBigtableReplicator:SharedResourcesreference count instart(Configuration, MetricsExporter)if initialization throws insideSharedResources.getInstance(configuration)or adapter creation.batchSizeInBytesandgetRowSize()frominttolongto avoid integer overflow.replicateTable()loop inside thetryblock inreplicate()so any unexpected exception returnsfalseperreplicate()'s contract.com/google/bigtable/repackaged/com/google/gson/stream/JsonReader.classis present in bothbigtable-hbase-1.x-replicationandbigtable-hbase-2.x-replicationshaded JARs.