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:![image](https://user-images.githubusercontent.com/11285563/128567062-a7d47b55-74b8-4c9b-bdc0-b135b6f6b78d.png)
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