问题描述:
重新安装了测试环境的hadoop,所以之前hbase所建的表数据都丢失了,但是zookeeper没有动。在hbase shell中list的时候,看不到之前建的表,但是create test table的时候,却报错提示"ERROR: Table already exists: test!".
问题追踪:
1,在list的时候,没有显示之前建的表,也就是没有感知到之前建的表,但是create时候却感知到了之前建的表,所以很自然需要看一下list和create的时候,server执行的逻辑。只要清楚了这个逻辑,问题便一清二楚了。
2,list时server端的逻辑其实很简单。list的时候master端执行的逻辑的入口函数是listTableDescriptors。核心代码如下:
1 // request for all TableDescriptors 2 Collection<HTableDescriptor> htds; 3 if (namespace != null && namespace.length() > 0) { 4 htds = tableDescriptors.getByNamespace(namespace).values(); 5 } else { 6 htds = tableDescriptors.getAll().values();