anmolnar commented on PR #7730:
URL: https://github.com/apache/hbase/pull/7730#issuecomment-6481162043

   > 🤖 AI-assisted review (Claude), posted on behalf of @anmolnar as additional 
input. 
   
   I went through the full diff at `76fd869`. The overall direction looks good, 
and most of the change is a mechanical replacement of `META_TABLE_NAME` with 
the connection-resolved name. A few items stood out that seem worth addressing 
before merge.
   
   ### Likely must-fix
   
   **1. Client/server and cross-cluster compatibility**
   `ConnectionFactory.createAsyncConnection` and `ClusterConnectionFactory` now 
require `registry.getMetaTableName()` to succeed. An older server answers the 
unknown RPC with `UnsupportedOperationException`, so connection setup fails for:
   - new clients talking to an un-upgraded cluster,
   - upgraded RegionServers during a rolling upgrade when the bootstrap node is 
still old,
   - replication sinks (`createAsyncClusterConnection(URI, …)`) targeting an 
older peer.
   
   A fallback to `TableName.META_TABLE_NAME` on an unknown method would cover 
this. Carrying the name on an existing response (e.g. `GetClusterId`) would 
also avoid an extra round trip per connection.
   
   **2. Public API compatibility**
   `Connection.getMetaTableName()` and `AsyncConnection.getMetaTableName()` are 
new abstract methods on `@InterfaceAudience.Public` interfaces, which breaks 
downstream implementations and test doubles (several mocks in this PR needed 
updating). Making them `default` methods returning `TableName.META_TABLE_NAME` 
avoids that. The new `AsyncConnectionImpl` / `AsyncClusterConnectionImpl` 
constructor signatures also affect custom impls loaded via 
`hbase.client.async.connection.impl` / `hbase.server.cluster.connection.impl`. 
That probably warrants a release note.
   
   **3. Suffix pattern mismatch**
   `META_QUALIFIER_PATTERN` is `meta(_[a-z0-9]+)?`, while 
`VALID_META_TABLE_SUFFIX_REGEX` allows `[a-zA-Z0-9]+`. With 
`hbase.meta.table.suffix=Replica1`, `isMetaTableName(META_TABLE_NAME)` returns 
`false`, so the meta table gets the wrong `CellComparator` and `IS_META` flag. 
Deriving one pattern from the other would keep them in sync.
   
   ### Design questions
   
   **4. Storage location.** `MetaTableNameStore` writes into the master 
region's `info` family, which holds meta location rows. 
`tryMigrateMetaLocationsFromZooKeeper` treats any row there as "migration 
done", so correctness now depends on it running before `initMetaTableName()` 
(no comment explains the ordering). `TestMigrateAndMirrorMetaLocations` also 
had to be relaxed. The `state` family used by the other `*StateStore` classes 
might be a cleaner home.
   
   **5. "A meta table" vs. "this cluster's meta table".** `isMetaTableName` now 
matches any `hbase:meta_*`, but some callers mean "our meta":
   - `ProtobufUtil.toRegionInfo` returns `FIRST_META_REGIONINFO` (`hbase:meta`) 
for a proto naming `hbase:meta_foo`, silently changing the table name.
   - `HMaster.isCatalogTable`, `TableDescriptorBuilder` (`IS_META`) and 
`MetaTableAccessor.getTableState` treat any meta-like table as the local one.
   
   In a shared-storage read-replica setup these become real bugs. Comparing 
against the resolved name at those sites would separate the two meanings.
   
   **6. Stored vs. configured name.** The master persists the name on first 
boot, but several paths still use the static constant (`FIRST_META_REGIONINFO`, 
`InitMetaProcedure.getTableName()`, `MasterProcedureScheduler`/`SchemaLocking`, 
`FSTableDescriptors`). If `hbase.meta.table.suffix` changes later, the two 
silently diverge. A fail-fast check at master startup would catch that.
   
   **7. Backup masters.** `HMaster.getMetaTableName()` stays null on backup 
masters and before active-master init, so clients that hit them silently fall 
back to `hbase:meta`. That's harmless today, but it will matter once custom 
names are supported.
   
   ### Performance
   `CellComparatorImpl.isMetaTable(byte[])` now does `TableName.valueOf()` (a 
linear scan of `tableCache`) plus a regex on every call. 
`MutableRegionInfo.containsRow/containsRange` round-trip TableName → bytes → 
TableName each time. A `getCellComparator(TableName)` overload plus a 
`Bytes.startsWith` pre-check on the `byte[]` path would keep this cheap. The 
current javadoc ("avoid materializing a TableName") also doesn't match what the 
code does.
   
   ### Minor
   - The commit message references HBASE-29881, while the PR title references 
HBASE-29691.
   - The meta name is cached in both `MetaTableNameStore` and `HMaster`. The 
store's cache and `synchronized` block look unnecessary.
   - `initMetaTableName` wraps `IOException` in `RuntimeException`, though the 
caller already declares `IOException`.
   - The comment in `HBaseServerBase.getMetaTableName` says persistence will 
come later, but this PR already persists the name.
   - The `TODO: Get dynamic name from MasterServices` markers could be JIRA 
subtasks instead.
   
   ### Tests
   No new tests are included. Useful additions would be:
   - `isMetaTableName` edge cases (uppercase suffix, `meta_`, `metadata`, 
non-`hbase` namespace),
   - a `MetaTableNameStore` round trip across master restart,
   - the new RPC via both the RPC and short-circuit registries,
   - a client-against-old-server test for #1.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to