Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # dev >> isRegionName logic in HBaseAdmin

Copy link to this message
isRegionName logic in HBaseAdmin
Context : HBASE-5041

While working on HBASE-5041 I realized our logic to check if the name
is a regionname or tablename is designed to be as follows:
tl;dr: If it is not an existing table, its should be a region.

   * @param tableNameOrRegionName Name of a table or name of a region.
   * @return True if <code>tableNameOrRegionName</code> is *possibly* a region
   * name else false if a verified tablename (we call {@link
   * else we throw an exception.
   * @throws IOException
  private boolean isRegionName(final byte [] tableNameOrRegionName)
  throws IOException {
    if (tableNameOrRegionName == null) {
      throw new IllegalArgumentException("Pass a table name or region name");
    return !tableExists(tableNameOrRegionName);

My plan was to modify majorCompact function's else block to check if
the table exist and throw TableNotFoundException if it does not.
But because of name logic one will never reach 'else' part and a
compaction request will be registered assuming it must be a region.

What do others think about changing this logic? I do not have enough
insight to propose an alternative.