Skip to content

Commit f887207

Browse files
authored
HBASE-22774 [WAL] RegionGroupingStrategy loses its function after split
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
1 parent 9821fd8 commit f887207

File tree

5 files changed

+306
-18
lines changed

5 files changed

+306
-18
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7180,9 +7180,11 @@ HRegion createDaughterRegionFromSplits(final HRegionInfo hri) throws IOException
71807180
// Move the files from the temporary .splits to the final /table/region directory
71817181
fs.commitDaughterRegion(hri);
71827182

7183+
// rsServices can be null in UT
7184+
WAL daughterWAL = rsServices == null ? getWAL() :rsServices.getWAL(hri);
71837185
// Create the daughter HRegion instance
7184-
HRegion r = HRegion.newHRegion(this.fs.getTableDir(), this.getWAL(), fs.getFileSystem(),
7185-
this.getBaseConf(), hri, this.getTableDesc(), rsServices);
7186+
HRegion r = HRegion.newHRegion(this.fs.getTableDir(), daughterWAL,
7187+
fs.getFileSystem(), this.getBaseConf(), hri, this.getTableDesc(), rsServices);
71867188
r.readRequestsCount.set(this.getReadRequestsCount() / 2);
71877189
r.writeRequestsCount.set(this.getWriteRequestsCount() / 2);
71887190
return r;

hbase-server/src/main/java/org/apache/hadoop/hbase/wal/BoundedGroupingStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void init(Configuration config, String providerId) {
7272
int regionGroupNumber = config.getInt(NUM_REGION_GROUPS, DEFAULT_NUM_REGION_GROUPS);
7373
groupNames = new String[regionGroupNumber];
7474
for (int i = 0; i < regionGroupNumber; i++) {
75-
groupNames[i] = providerId + GROUP_NAME_DELIMITER + "regiongroup-" + i;
75+
groupNames[i] = "regiongroup-" + i;
7676
}
7777
}
7878

hbase-server/src/main/java/org/apache/hadoop/hbase/wal/NamespaceGroupingStrategy.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
*/
3232
@InterfaceAudience.Private
3333
public class NamespaceGroupingStrategy implements RegionGroupingStrategy {
34-
private String providerId;
3534

3635
@Override
3736
public String group(byte[] identifier, byte[] namespace) {
@@ -41,12 +40,10 @@ public String group(byte[] identifier, byte[] namespace) {
4140
} else {
4241
namespaceString = Bytes.toString(namespace);
4342
}
44-
return providerId + GROUP_NAME_DELIMITER + namespaceString;
43+
return namespaceString;
4544
}
4645

4746
@Override
48-
public void init(Configuration config, String providerId) {
49-
this.providerId = providerId;
50-
}
47+
public void init(Configuration config, String providerId) {}
5148

5249
}

hbase-server/src/main/java/org/apache/hadoop/hbase/wal/RegionGroupingProvider.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public class RegionGroupingProvider implements WALProvider {
6262
* Map identifiers to a group number.
6363
*/
6464
public static interface RegionGroupingStrategy {
65-
String GROUP_NAME_DELIMITER = ".";
6665

6766
/**
6867
* Given an identifier and a namespace, pick a group.
@@ -252,7 +251,7 @@ static class IdentityGroupingStrategy implements RegionGroupingStrategy {
252251
public void init(Configuration config, String providerId) {}
253252
@Override
254253
public String group(final byte[] identifier, final byte[] namespace) {
255-
return Bytes.toString(identifier);
254+
return "identity-" + Bytes.toString(identifier);
256255
}
257256
}
258257

0 commit comments

Comments
 (0)