Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain 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
#tableExists(byte[])};
   * 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.
+
Stack 2011-12-23, 04:27
+
Shrijeet Paliwal 2011-12-23, 04:58
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB