guluo created HBASE-28481:
-----------------------------
Summary: Prompting table already exists after failing to create
table with many region replications
Key: HBASE-28481
URL: https://issues.apache.org/jira/browse/HBASE-28481
Project: HBase
Issue Type: Bug
Affects Versions: 2.4.13
Environment: Centos
Reporter: guluo
Reproduction steps:
{code:java}
# Create table with 65537 region replications
# we would get errors as follow, this step is no problem
hbase:005:0> create 't01', 'info', {REGION_REPLICATION => 65537}
ERROR: java.lang.IllegalArgumentException: ReplicaId cannot be greater
than65535
For usage try 'help "create"'
Took 0.7590 seconds{code}
{code:java}
# list, and found the table does not exist, as follow
hbase:006:0> list TABLE
0 row(s) Took 0.0100 seconds
=> []{code}
{code:java}
# we create this tale agin by the correct way
# we would get message that this table already exists
hbase:007:0> create 't01', 'info'
ERROR: Table already exists: t01!
For usage try 'help "create"'
Took 0.1210 seconds {code}
Reason:
In the CreateTableProcedure, we update this table descriptor into HBase cluster
at stage CREATE_TABLE_WRITE_FS_LAYOUT
{code:java}
env.getMasterServices().getTableDescriptors().update(tableDescriptor, true);
{code}
and then, we check if the Region Replication Count is legal at stage
CREATE_TABLE_ADD_TO_META.
{code:java}
newRegions = addTableToMeta(env, tableDescriptor, newRegions);
// MutableRegionInfo.checkReplicaId
private static int checkReplicaId(int regionId) {
if (regionId > MAX_REPLICA_ID) {
throw new IllegalArgumentException("ReplicaId cannot be greater than" +
MAX_REPLICA_ID);
}
return regionId;
}{code}
So, we can not create the same name table by correct way after faling to create
table with many region replications (exceed 65536), because the table
descriptor has been updated into cluster and there is no rollback.
So i think we can check if the region replication count at stage
CREATE_TABLE_PRE_OPERATION to avoid this problem
--
This message was sent by Atlassian Jira
(v8.20.10#820010)