Skip to content

Commit

Permalink
HBASE-22774 [WAL] RegionGroupingStrategy loses its function after split
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
  • Loading branch information
Reidddddd authored Aug 14, 2019
1 parent 9821fd8 commit f887207
Show file tree
Hide file tree
Showing 5 changed files with 306 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7180,9 +7180,11 @@ HRegion createDaughterRegionFromSplits(final HRegionInfo hri) throws IOException
// Move the files from the temporary .splits to the final /table/region directory
fs.commitDaughterRegion(hri);

// rsServices can be null in UT
WAL daughterWAL = rsServices == null ? getWAL() :rsServices.getWAL(hri);
// Create the daughter HRegion instance
HRegion r = HRegion.newHRegion(this.fs.getTableDir(), this.getWAL(), fs.getFileSystem(),
this.getBaseConf(), hri, this.getTableDesc(), rsServices);
HRegion r = HRegion.newHRegion(this.fs.getTableDir(), daughterWAL,
fs.getFileSystem(), this.getBaseConf(), hri, this.getTableDesc(), rsServices);
r.readRequestsCount.set(this.getReadRequestsCount() / 2);
r.writeRequestsCount.set(this.getWriteRequestsCount() / 2);
return r;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void init(Configuration config, String providerId) {
int regionGroupNumber = config.getInt(NUM_REGION_GROUPS, DEFAULT_NUM_REGION_GROUPS);
groupNames = new String[regionGroupNumber];
for (int i = 0; i < regionGroupNumber; i++) {
groupNames[i] = providerId + GROUP_NAME_DELIMITER + "regiongroup-" + i;
groupNames[i] = "regiongroup-" + i;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
*/
@InterfaceAudience.Private
public class NamespaceGroupingStrategy implements RegionGroupingStrategy {
private String providerId;

@Override
public String group(byte[] identifier, byte[] namespace) {
Expand All @@ -41,12 +40,10 @@ public String group(byte[] identifier, byte[] namespace) {
} else {
namespaceString = Bytes.toString(namespace);
}
return providerId + GROUP_NAME_DELIMITER + namespaceString;
return namespaceString;
}

@Override
public void init(Configuration config, String providerId) {
this.providerId = providerId;
}
public void init(Configuration config, String providerId) {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public class RegionGroupingProvider implements WALProvider {
* Map identifiers to a group number.
*/
public static interface RegionGroupingStrategy {
String GROUP_NAME_DELIMITER = ".";

/**
* Given an identifier and a namespace, pick a group.
Expand Down Expand Up @@ -252,7 +251,7 @@ static class IdentityGroupingStrategy implements RegionGroupingStrategy {
public void init(Configuration config, String providerId) {}
@Override
public String group(final byte[] identifier, final byte[] namespace) {
return Bytes.toString(identifier);
return "identity-" + Bytes.toString(identifier);
}
}

Expand Down
Loading

0 comments on commit f887207

Please sign in to comment.