When we have tables with orphan regions, SHC raises the following exception:
When ingesting data (with parameter newTable), the HBaseRelation class runs the method createTableIfNotExists. This method uses the HBaseAdmin isTableAvailable method to check if table is "available". However, as this method returnstrueonly if all table regions are available, it will return false in the case of table having problematic (e.g., orphan) regions, triggering the createTable method and after the Hbase prepareCreate procedure, which in turn raises the TableExistsException.
Summary
When we have tables with orphan regions, SHC raises the following exception:
When ingesting data (with parameter
newTable
), the HBaseRelation class runs the methodcreateTableIfNotExists
. This method uses the HBaseAdminisTableAvailable
method to check if table is "available". However, as this method returnstrue
only if all table regions are available, it will returnfalse
in the case of table having problematic (e.g., orphan) regions, triggering thecreateTable
method and after the HbaseprepareCreate
procedure, which in turn raises theTableExistsException
.Proposed solution
Check if table can be created using another method, such as
MetaTableAccessor.tableExists
directly, instead checking regions, which is performed byConnectionImplementation
on HBase