HBASE-15315 Remove always set super user call as high priority (Yong Zhang)

This commit is contained in:
Elliott Clark 2016-03-01 15:34:02 -08:00
parent 7c54525c89
commit 9ad13468a0
2 changed files with 0 additions and 36 deletions

View File

@ -43,7 +43,6 @@ import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RequestHeader;
import com.google.common.annotations.VisibleForTesting;
import com.google.protobuf.Message;
import com.google.protobuf.TextFormat;
import org.apache.hadoop.hbase.security.Superusers;
import org.apache.hadoop.hbase.security.User;
/**
@ -176,19 +175,6 @@ public class AnnotationReadingPriorityFunction implements PriorityFunction {
if (priorityByAnnotation >= 0) {
return priorityByAnnotation;
}
// all requests executed by super users have high QoS
try {
if (Superusers.isSuperUser(user)) {
return HConstants.ADMIN_QOS;
}
} catch (IllegalStateException ex) {
// Not good throwing an exception out of here, a runtime anyways. Let the query go into the
// server and have it throw the exception if still an issue. Just mark it normal priority.
if (LOG.isTraceEnabled()) LOG.trace("Marking normal priority after getting exception=" + ex);
return HConstants.NORMAL_QOS;
}
return getBasePriority(header, param);
}

View File

@ -115,28 +115,6 @@ public class TestPriorityRpc {
User.createUserForTesting(regionServer.conf, "someuser", new String[]{"somegroup"})));
}
@Test
public void testQosFunctionForRequestCalledBySuperUser() throws Exception {
RequestHeader.Builder headerBuilder = RequestHeader.newBuilder();
headerBuilder.setMethodName("foo");
RequestHeader header = headerBuilder.build();
PriorityFunction qosFunc = regionServer.rpcServices.getPriority();
//test superusers
regionServer.conf.set(Superusers.SUPERUSER_CONF_KEY, "samplesuperuser");
Superusers.initialize(regionServer.conf);
assertEquals(HConstants.ADMIN_QOS, qosFunc.getPriority(header, null,
User.createUserForTesting(regionServer.conf, "samplesuperuser",
new String[]{"somegroup"})));
//test supergroups
regionServer.conf.set(Superusers.SUPERUSER_CONF_KEY, "@samplesupergroup");
Superusers.initialize(regionServer.conf);
assertEquals(HConstants.ADMIN_QOS, qosFunc.getPriority(header, null,
User.createUserForTesting(regionServer.conf, "regularuser",
new String[]{"samplesupergroup"})));
}
@Test
public void testQosFunctionForScanMethod() throws IOException {
RequestHeader.Builder headerBuilder = RequestHeader.newBuilder();