How to clear a table in HBase

Uses HBase (0.98 in a client with a server like HBase 1.1.2) with a basic data store like HDFS.

I tried to clear the table using the following code, and I see that the data has been dumped to the HFile location in Hadoop.

htable.put(puts); htable.close(); admin.flush(tableName); 

Hadoop Data Location

 ./hadoop fs -du /hbase/data/default/tableName/ 

When I turn off the power and restart the node, restarting Hadoop and HBase, I was able to see that the data was corrupted in HDFS.

If the data is properly cleared to HFile, why is it corrupted during a power outage.

Do I need to make any changes to the code to clear the table?

Thanks Har

+5
source share
1 answer

I have something similar a year ago and this is due to a synchronization issue . I see a resolution for this. Here is another description, with a sequence diagram for an input operation.

What happens in your case? Perhaps this is very small and ends in memory, not in HFile, where you want to check if it is damaged or not.

Try writing 25 MB or more - since this is the page size for hadoop, and this will trigger all the entries. That way you can simply fix other problems. If this works, then you can play while maintaining the policy or just wait more. Stupid advice, but note that in a regular system there will be more records, so in any case, a full record in HFile will be called. Another option is to force it, but your production may deteriorate with too many records.

0
source

Source: https://habr.com/ru/post/1262645/


All Articles