Created 04-17-2017 01:08 PM
Will truncating a HBASE table affect the region server spread of data?
Let us suppose I export the data of a HBASE table. Somebody deletes a lot of rows and now the app group wants to recover the table data from the backed up export.
So now I truncate the table and then I import the data from the exported data.
What effect will it (truncate/import) have on the region server on which the table originally existed?
Appreciate the insights.
Created 04-17-2017 05:42 PM
"Truncate" alone will remove all information about the region boundaries or what you call "spread of data", including pre-split information if any was provided. However, "import" will recreate the regions exactly as they were at the time of "export", thus effectively preserving region boundaries and the number of regions.
Created 04-17-2017 05:42 PM
"Truncate" alone will remove all information about the region boundaries or what you call "spread of data", including pre-split information if any was provided. However, "import" will recreate the regions exactly as they were at the time of "export", thus effectively preserving region boundaries and the number of regions.
Created 04-17-2017 06:08 PM
Thanks for the clarification.
Created 04-17-2017 06:10 PM
btw one small doubt : let us supposed that a region server we had originally was decommissioned. So if we import a table which was originally on that decommissioned region server what would happen?
Created 04-18-2017 02:28 AM
There are no guarantees about region placement on region servers, even if all you RSs are running like before the "truncate". If some of them are not available HBase master will place regions on available ones.
Created 06-12-2017 02:44 PM
HBase shell also includes an alternative command to `truncate` called `truncate_preserve` which can be used to drop data within a table but still maintain the metadata about the table contained in hbase:meta. You can also use the `status 'detailed'` command from `hbase shell` to see the split/presplit regions.
For example:
$ /opt/bin/hbshell.bash <<< "truncate_preserve 'dev06ostgarnerh:contact'"
$ /opt/bin/hbshell.bash <<< "status 'detailed'" | grep contact "dev06ostgarh:contact,600,1497277520170.a17b52eec2a9df78bbc175a5238a13f8." "dev06ostgarh:contact,800,1497277520170.275ff20d4c4036163ee90a94092b47e6." "dev06ostgarh:contact,A00,1497277520170.e94b5202f2cbb100dd74e858f772573e." "dev06ostgarh:contact,E00,1497277520170.7d9f1b140431d2a975ee35e716b9337e." "dev06ostgarh:contact,,1497277520170.ed4ad8c3fb40598bb51d2ad91dee6973." "dev06ostgarh:contact,100,1497277520170.43378ea32c0b3bf64dd697b62b87b23c." "dev06ostgarh:contact,200,1497277520170.be10a9e051b0f9a4f7c460c1b36969d7." "dev06ostgarh:contact,F00,1497277520170.64f57d24d29058f238b1addb08c603a8." "dev06ostgarh:contact,300,1497277520170.6244d798c326984e47a577f579645487." "dev06ostgarh:contact,500,1497277520170.c9b1ed0633850eb5086a32049a5597d5." "dev06ostgarh:contact,C00,1497277520170.bb446488db4bb788248f41551db878f5." "dev06ostgarh:contact,D00,1497277520170.b2d2bc1febc9206df27e05a976066027." "dev06ostgarh:contact,400,1497277520170.b61ffc5cdfda59f96b47d83f8aa46134." "dev06ostgarh:contact,700,1497277520170.e4e1cab56f430344c71e24fa6673b55f." "dev06ostgarh:contact,900,1497277520170.1cb1067053fe203426e0e9e2c00bb37f." "dev06ostgarh:contact,B00,1497277520170.5867477ee49a19f6dafd0ff60f9b8f6f."