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 <[email protected]>

Conflicts:
	hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransaction.java
  • Loading branch information
Reidddddd committed Aug 14, 2019
1 parent 18c5abe commit d2b310b
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6996,9 +6996,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 @@ -61,7 +61,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 @@ -242,7 +241,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 d2b310b

Please sign in to comment.