|
|
-
isRegionName logic in HBaseAdmin
Shrijeet Paliwal 2011-12-22, 23:01
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.
+
Shrijeet Paliwal 2011-12-22, 23:01
-
Re: isRegionName logic in HBaseAdmin
Stack 2011-12-23, 04:27
On Thu, Dec 22, 2011 at 3:01 PM, Shrijeet Paliwal <[EMAIL PROTECTED]> wrote: > private boolean isRegionName(final byte [] tableNameOrRegionName) > throws IOException { > if (tableNameOrRegionName == null) { > throw new IllegalArgumentException("Pass a table name or region name"); > } > return !tableExists(tableNameOrRegionName); > } >
The above is a bit crass for sure; if not a table name, it MUST BE a region name.
> What do others think about changing this logic? I do not have enough > insight to propose an alternative.
Should we next go look for a region in .META.? Or do this optionally? Make new methods isTableName and isRegionName with each doing looksee if table/region exists?
Open to any suggestion....
St.Ack
+
Stack 2011-12-23, 04:27
-
Re: isRegionName logic in HBaseAdmin
Shrijeet Paliwal 2011-12-23, 04:58
Stack, We took the discussion here HBASE-5041 I uploaded a patch . Could you please review?
On Thu, Dec 22, 2011 at 8:27 PM, Stack <[EMAIL PROTECTED]> wrote: > On Thu, Dec 22, 2011 at 3:01 PM, Shrijeet Paliwal > <[EMAIL PROTECTED]> wrote: >> private boolean isRegionName(final byte [] tableNameOrRegionName) >> throws IOException { >> if (tableNameOrRegionName == null) { >> throw new IllegalArgumentException("Pass a table name or region name"); >> } >> return !tableExists(tableNameOrRegionName); >> } >> > > The above is a bit crass for sure; if not a table name, it MUST BE a > region name. > >> What do others think about changing this logic? I do not have enough >> insight to propose an alternative. > > Should we next go look for a region in .META.? Or do this optionally? > Make new methods isTableName and isRegionName with each doing looksee > if table/region exists? > > Open to any suggestion.... > > St.Ack
+
Shrijeet Paliwal 2011-12-23, 04:58
|
|
All projects made searchable here are trademarks of the Apache Software Foundation.
Service operated by
Sematext