[
https://issues.apache.org/jira/browse/HBASE-7846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13579425#comment-13579425
]
Jean-Marc Spaggiari commented on HBASE-7846:
--------------------------------------------
Here is how I did it. Regions is constructed from MetaUtils.scanMetaRegion
{code:title=MassMerger.java|borderStyle=solid}
HRegionInfo region1 = null;
HRegionInfo region2 = null;
for (HRegionInfo regionInfo : regions) {
if (region1 == null) {
region1 = regionInfo; }
} else {
region2 = regionInfo; }
if ((region1 != null) && (region2 != null)) {
regionsCount++;
String[] args = new String[3];
args[0] = tableName;
args[1] = region1.getRegionNameAsString();
args[2] = region2.getRegionNameAsString();
System.out.println ("Merging " + region1.getRegionNameAsString() + " with "
+ region2.getRegionNameAsString());
region1 = null;
region2 = null;
int status;
try {
status = ToolRunner.run(HBaseConfiguration.create(config), new Merge(),
args);
if ((System.in.available() > 0) || (status != 0)) {
return; }
} catch (Exception e) {
e.printStackTrace(); }
}
}
}
{Code}
Pretty simple way.
I will clean the code, and see how I can merge it into the Merge class...
> Add support for merging implicit regions in Merge tool
> ------------------------------------------------------
>
> Key: HBASE-7846
> URL: https://issues.apache.org/jira/browse/HBASE-7846
> Project: HBase
> Issue Type: Improvement
> Components: util
> Reporter: Kaufman Ng
> Priority: Minor
>
> Currently org.apache.hadoop.hbase.util.Merge needs 2 region names to be
> explicitly specified to perform a merge. This can be cumbersome.
> One idea for improvement is to have Merge to figure out all the adjacent
> regions and perform the merges.
> For example:
> regions before merge: row-10, row-20, row-30, row-40, row-50
> regions after merge: row-10, row-30, row-50
> In the above example, region names of "row-10" and "row-20" are merged to
> become a new bigger region of "row-10".
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira