Fixing "Can't get distribution attribute of table" in GBase 8a
When a gbase database cluster experiences an unclean shutdown — a sudden power loss or kernel panic — some metadata that was still in memory may never make it to disk. This can leave the critical gbase.table_distribution table with missing rows, causing queries against certain tables to fail with the error: ERROR 1149 (42000): (GBA-02SC-1001) Can't get distribution attribute of table `testdb`.`t2_test`, please check your gbase.table_distribution. The Symptom The affected table enters a contradictory state: Dropping it returns Unknown table . Re‑creating it returns Table already exists . The data files exist on disk, but the metadata record that describes how the table is distributed is gone. Root Cause GBase 8a stores critical table metadata — distribution type (hash or random), replication status, hash column — in the system table gbase.table_distribution . After an abrupt shutdown, this table may have missing entries, causing the cluster to lose track of the table's distribution properties. Recovery Options Option 1: Re‑insert the Metadata Row (Keeps Data Intact) This is the recommended approach when the data must be preserved. Insert the missing row directly into gbase.table_distribution . -- Insert the lost metadata record INSERT INTO gbase . table_distribution VALUES ( 'testdb.t2_test' , 'testdb' , 't2_test' , 'NO' , NULL , NULL , NULL , 'NO' , 2 ); -- Verify the row is now present SELECT * FROM gbase . table_distribution WHERE index_name LIKE '%t2_test%' ; Key fields: isReplicate : YES if the table is replicated, otherwise NO . hash_column : The distribution key column name (if hash‑distributed); NULL for random distribution. data_distribution_id : A numeric ID. Copy the value from another healthy table in the same database to keep it consistent. After inserting, restart the gcluster service so the metadata takes effect (the table_distribution table is managed by gcluster, not gnodes): gcluster_services gcluster restart The table should now be queryable again.