Skip to content

Commit c22e111

Browse files
authored
Make the keymeta table initialization happen in a predictable manner (#7433)
1 parent 3de7a7c commit c22e111

File tree

24 files changed

+270
-343
lines changed

24 files changed

+270
-343
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2669,5 +2669,5 @@ List<LogEntry> getLogEntries(Set<ServerName> serverNames, String logType, Server
26692669
* Refresh the system key cache on all specified region servers.
26702670
* @param regionServers the list of region servers to refresh the system key cache on
26712671
*/
2672-
void refreshSystemKeyCacheOnAllServers(Set<ServerName> regionServers) throws IOException;
2672+
void refreshSystemKeyCacheOnServers(Set<ServerName> regionServers) throws IOException;
26732673
}

hbase-client/src/main/java/org/apache/hadoop/hbase/client/AdminOverAsyncAdmin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ public void restoreBackupSystemTable(String snapshotName) throws IOException {
11481148
}
11491149

11501150
@Override
1151-
public void refreshSystemKeyCacheOnAllServers(Set<ServerName> regionServers) throws IOException {
1152-
get(admin.refreshSystemKeyCacheOnAllServers(regionServers));
1151+
public void refreshSystemKeyCacheOnServers(Set<ServerName> regionServers) throws IOException {
1152+
get(admin.refreshSystemKeyCacheOnServers(regionServers));
11531153
}
11541154
}

hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdmin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1879,5 +1879,5 @@ CompletableFuture<List<LogEntry>> getLogEntries(Set<ServerName> serverNames, Str
18791879
* Refresh the system key cache on all specified region servers.
18801880
* @param regionServers the list of region servers to refresh the system key cache on
18811881
*/
1882-
CompletableFuture<Void> refreshSystemKeyCacheOnAllServers(Set<ServerName> regionServers);
1882+
CompletableFuture<Void> refreshSystemKeyCacheOnServers(Set<ServerName> regionServers);
18831883
}

hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncHBaseAdmin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,8 @@ public CompletableFuture<Void> updateConfiguration(String groupName) {
687687
}
688688

689689
@Override
690-
public CompletableFuture<Void> refreshSystemKeyCacheOnAllServers(Set<ServerName> regionServers) {
691-
return wrap(rawAdmin.refreshSystemKeyCacheOnAllServers(regionServers));
690+
public CompletableFuture<Void> refreshSystemKeyCacheOnServers(Set<ServerName> regionServers) {
691+
return wrap(rawAdmin.refreshSystemKeyCacheOnServers(regionServers));
692692
}
693693

694694
@Override

hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4665,7 +4665,7 @@ MasterProtos.RestoreBackupSystemTableResponse> procedureCall(request,
46654665
}
46664666

46674667
@Override
4668-
public CompletableFuture<Void> refreshSystemKeyCacheOnAllServers(Set<ServerName> regionServers) {
4668+
public CompletableFuture<Void> refreshSystemKeyCacheOnServers(Set<ServerName> regionServers) {
46694669
CompletableFuture<Void> future = new CompletableFuture<>();
46704670
List<CompletableFuture<Void>> futures =
46714671
regionServers.stream().map(this::refreshSystemKeyCache).collect(Collectors.toList());

hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/Procedure.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ public enum LockState {
127127
private long rootProcId = NO_PROC_ID;
128128
private long procId = NO_PROC_ID;
129129
private long submittedTime;
130+
private boolean isCriticalSystemTable;
130131

131132
// Runtime state, updated every operation
132133
private ProcedureState state = ProcedureState.INITIALIZING;
@@ -608,6 +609,14 @@ protected void setParentProcId(long parentProcId) {
608609
this.parentProcId = parentProcId;
609610
}
610611

612+
public void setCriticalSystemTable(boolean isCriticalSystemTable) {
613+
this.isCriticalSystemTable = isCriticalSystemTable;
614+
}
615+
616+
public boolean isCriticalSystemTable() {
617+
return isCriticalSystemTable;
618+
}
619+
611620
protected void setRootProcId(long rootProcId) {
612621
this.rootProcId = rootProcId;
613622
}

hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureExecutor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,6 +1975,7 @@ private Procedure<TEnvironment>[] initializeChildren(RootProcedureState<TEnviron
19751975
subproc.setParentProcId(procedure.getProcId());
19761976
subproc.setRootProcId(rootProcId);
19771977
subproc.setProcId(nextProcId());
1978+
subproc.setCriticalSystemTable(procedure.isCriticalSystemTable());
19781979
procStack.addSubProcedure(subproc);
19791980
}
19801981

hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureUtil.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ public static ProcedureProtos.Procedure convertToProtoProcedure(Procedure<?> pro
175175
builder.setParentId(proc.getParentProcId());
176176
}
177177

178+
if (proc.isCriticalSystemTable()) {
179+
builder.setIsCryticalSystemTable(true);
180+
}
181+
178182
if (proc.hasTimeout()) {
179183
builder.setTimeout(proc.getTimeout());
180184
}
@@ -244,6 +248,10 @@ public static Procedure<?> convertToProcedure(ProcedureProtos.Procedure proto)
244248
proc.setParentProcId(proto.getParentId());
245249
}
246250

251+
if (proto.hasIsCryticalSystemTable()) {
252+
proc.setCriticalSystemTable(proto.getIsCryticalSystemTable());
253+
}
254+
247255
if (proto.hasOwner()) {
248256
proc.setOwner(proto.getOwner());
249257
}

hbase-protocol-shaded/src/main/protobuf/server/Procedure.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ message Procedure {
7373
// whether the procedure has been executed
7474
// since we do not always maintain the stack_id now, we need a separated flag
7575
optional bool executed = 18 [default = false];
76+
77+
// Indicates that the procedure belongs to a crytical system table.
78+
optional bool is_crytical_system_table = 19 [default = false];
7679
}
7780

7881
/**

hbase-server/src/main/java/org/apache/hadoop/hbase/keymeta/KeymetaAdminImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public boolean rotateSTK() throws IOException {
9494

9595
LOG.info("System Key is rotated, initiating cache refresh on all region servers");
9696
try {
97-
FutureUtils.get(getAsyncAdmin(master).refreshSystemKeyCacheOnAllServers(regionServers));
97+
FutureUtils.get(getAsyncAdmin(master).refreshSystemKeyCacheOnServers(regionServers));
9898
} catch (Exception e) {
9999
throw new IOException(
100100
"Failed to initiate System Key cache refresh on one or more region servers", e);

0 commit comments

Comments
 (0)