Sanjeet Malhotra created PHOENIX-7788:
-----------------------------------------

             Summary: CREATE TABLE fails with TableNotEnabledException when 
underlying HBase table exists but is disabled
                 Key: PHOENIX-7788
                 URL: https://issues.apache.org/jira/browse/PHOENIX-7788
             Project: Phoenix
          Issue Type: Improvement
    Affects Versions: 5.3.0, 5.2.1
            Reporter: Sanjeet Malhotra


When an HBase table exists and is disabled but has no corresponding Phoenix 
metadata in SYSTEM.CATALOG, executing CREATE TABLE IF NOT EXISTS fails with 
TableNotEnabledException.

This can happen if Phoenix metadata was lost or manually removed while the 
HBase table remained in a disabled state.The issue is that ensureTableCreated() 
in ConnectionQueryServicesImpl successfully detects and modifies the existing 
disabled HBase table, but never re-enables it. The SYSTEM.CATALOG metadata is 
written successfully, but the subsequent post-DDL scan fails because the table 
is still disabled.

This also leaves the system in an inconsistent state: metadata exists in 
SYSTEM.CATALOG but the underlying HBase table remains disabled.

Fix: ensureTableCreated() should detect when an existing HBase table is 
disabled and enable it before proceeding.

 

How to Reproduce:
 # Create a Phoenix table normally

 # Delete its metadata from SYSTEM.CATALOG (DELETE FROM SYSTEM.CATALOG WHERE 
TABLE_NAME = '...')

 # Disable the HBase table via admin.disableTable()

 # Execute CREATE TABLE IF NOT EXISTS with the same DDL

 # Observe TableNotEnabledException

 

We saw this in production when drop table succeeded to disable HBase table but 
failed to delete it, leaving HBase table in disabled state.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to