Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-28481

Prompting table already exists after failing to create table with many region replications

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      Reproduction steps:

      # 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
      # list, and found the table does not exist, as follow 
      hbase:006:0> list TABLE 
      0 row(s) Took 0.0100 seconds 
      => []
      # 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 

       
      Reason:
      In the CreateTableProcedure, we update this table descriptor into HBase cluster at stage  CREATE_TABLE_WRITE_FS_LAYOUT
       

      env.getMasterServices().getTableDescriptors().update(tableDescriptor, true); 

       
      and then, we check if the Region Replication Count is legal at stage CREATE_TABLE_ADD_TO_META.
       
       

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

       
       
      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

      Attachments

        Issue Links

          Activity

            People

              guluo guluo
              guluo guluo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: