Class MasterProcedureUtil
java.lang.Object
org.apache.hadoop.hbase.master.procedure.MasterProcedureUtil
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Helper Runnable used in conjunction with submitProcedure() to deal with submitting procs with nonce.static interface
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic RSGroupInfo
checkGroupExists
(MasterProcedureUtil.RSGroupGetter getter, Optional<String> optGroupName, Supplier<String> forWhom) static void
checkGroupNotEmpty
(RSGroupInfo rsGroupInfo, Supplier<String> forWhom) Do not allow creating new tables/namespaces which has an empty rs group, expect the default rs group.getNamespaceGroup
(NamespaceDescriptor namespaceDesc) static int
Return the priority for the given procedure.static int
getTablePriority
(TableName tableName) Return the priority for the given table.static long
Helper used to deal with submitting procs with nonce.static org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.UserInformation
toProtoUserInfo
(User user) static User
toUserInfo
(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.UserInformation userInfoProto) static IOException
unwrapRemoteIOException
(Procedure<?> proc) This is a version of unwrapRemoteIOException that can do DoNotRetryIOE.static boolean
validateProcedureWALFilename
(String filename) A Procedure WAL file name is of the format: pv-<wal-id>.log where wal-id is 20 digits.
-
Field Details
-
PATTERN
Deprecated.Since 2.3.0, will be removed in 4.0.0. We do not use this style of procedure wal file name any more.Pattern used to validate a Procedure WAL file name seevalidateProcedureWALFilename(String)
for description.
-
-
Constructor Details
-
MasterProcedureUtil
private MasterProcedureUtil()
-
-
Method Details
-
toProtoUserInfo
public static org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.UserInformation toProtoUserInfo(User user) -
toUserInfo
public static User toUserInfo(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.UserInformation userInfoProto) -
submitProcedure
public static long submitProcedure(MasterProcedureUtil.NonceProcedureRunnable runnable) throws IOException Helper used to deal with submitting procs with nonce. Internally the NonceProcedureRunnable.run() will be called only if no one else registered the nonce. any Exception thrown by the run() method will be collected/handled and rethrown.long procId = MasterProcedureUtil.submitProcedure( new NonceProcedureRunnable(procExec, nonceGroup, nonce) { @Override public void run() { cpHost.preOperation(); submitProcedure(new MyProc()); cpHost.postOperation(); } });
- Throws:
IOException
-
validateProcedureWALFilename
A Procedure WAL file name is of the format: pv-<wal-id>.log where wal-id is 20 digits.- Parameters:
filename
- name of the file to validate- Returns:
- true if the filename matches a Procedure WAL, false otherwise
-
getTablePriority
Return the priority for the given table. Now meta table is 3, other system tables are 2, and user tables are 1. -
getServerPriority
Return the priority for the given procedure. For now we only have two priorities, 100 for server carrying meta, and 1 for others. -
unwrapRemoteIOException
This is a version of unwrapRemoteIOException that can do DoNotRetryIOE. We need to throw DNRIOE to clients if a failed Procedure else they will keep trying. The default proc.getException().unwrapRemoteException doesn't have access to DNRIOE from the procedure2 module. -
checkGroupNotEmpty
public static void checkGroupNotEmpty(RSGroupInfo rsGroupInfo, Supplier<String> forWhom) throws ConstraintException Do not allow creating new tables/namespaces which has an empty rs group, expect the default rs group. Notice that we do not check for online servers, as this is not stable because region servers can die at any time.- Throws:
ConstraintException
-
checkGroupExists
public static RSGroupInfo checkGroupExists(MasterProcedureUtil.RSGroupGetter getter, Optional<String> optGroupName, Supplier<String> forWhom) throws IOException - Throws:
IOException
-
getNamespaceGroup
-