HBASE-16532 Procedure-V2: Enforce procedure ownership at submission

This commit is contained in:
tedyu 2016-08-31 12:55:54 -07:00
parent 605af95132
commit 5376106d05
2 changed files with 15 additions and 1 deletions

View File

@ -246,6 +246,9 @@ public class ProcedureExecutor<TEnvironment> {
private final ProcedureStore store;
private final Configuration conf;
private static final String CHECK_OWNER_SET_CONF_KEY = "hbase.procedure.check.owner.set";
private final boolean checkOwnerSet;
private Thread[] threads;
public ProcedureExecutor(final Configuration conf, final TEnvironment environment,
@ -259,6 +262,7 @@ public class ProcedureExecutor<TEnvironment> {
this.runnables = runqueue;
this.store = store;
this.conf = conf;
this.checkOwnerSet = conf.getBoolean(CHECK_OWNER_SET_CONF_KEY, true);
}
private void load(final boolean abortOnCorruption) throws IOException {
@ -640,6 +644,9 @@ public class ProcedureExecutor<TEnvironment> {
Preconditions.checkArgument(isRunning());
Preconditions.checkArgument(lastProcId.get() >= 0);
Preconditions.checkArgument(!proc.hasParent());
if (this.checkOwnerSet) {
Preconditions.checkArgument(proc.hasOwner());
}
// Initialize the Procedure ID
long currentProcId = nextProcId();

View File

@ -21,8 +21,15 @@
*/
-->
<configuration>
<property>
<property>
<name>hbase.procedure.store.wal.use.hsync</name>
<value>false</value>
</property>
<property>
<name>hbase.procedure.check.owner.set</name>
<value>false</value>
<description>Whether ProcedureExecutor should enforce that each
procedure to have an owner
</description>
</property>
</configuration>