Killing the HBase Zombie Table
Join the DZone community and get the full member experience.Join For Free
one of our team leaders approached me in the hall today and asked if i could land a hand in troubleshooting something. he and our qa lead were configuring one of our test hadoop clusters after an upgrade and they had a problem with one table they were trying to set up:
- when they tried to create the table in hbase shell they got an error that the table exists
- when they tried to delete the table they got an error that the table does not exist
- hbase ships with a health-check and fix util called hbck (use: hbase hbck to run. see here for details) – they’ve run hbase reports everything is fine and dandy
hmm, the first thing i tied to do is to look at the .meta. table. this is where hbase keeps the tables and the regions they use. i thought maybe there was some just there. but it didn’t look like that. i tried to do a major compaction for it and that didn’t help either.
the next thing i tried actually found the problem. i ran the zookeeper client (i used hbase zkcli but you can also run it via zookeeper scripts) and looked at /hbase/table ( ls /hbase table ) -the zombie table was listed right there with all the legit tables. hbase stores some data schema and state of each table in zookeeper to be able to coordinate between all the regionservers and it seems that during the upgrade process the system was restarted a few times. one of these restarts coincided with a removal of the table and caught it in the middle.
ok, so that is the problem – what’s the solution? simple just remove the offending znode from zookeeper ( rmr /hbase/table/table_name ) and restart the cluster (since the data is cached in the regionservers/hbase master to save trips to zookeeper). also be careful not to remove any other node or you’d cause problems to other tables.
the role of zookeeper in hbase is not documented very well. the only online account of zookeeper’s role with hbase i found (save looking at the code itself of course) is really outdated. hopefully this post will save some head scratching and time for others who find themselves with the same problem.
Published at DZone with permission of Arnon Rotem-gal-oz, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.