From 9ad13468a0cc48567b0224eba5b0a53e833a2530 Mon Sep 17 00:00:00 2001 From: Elliott Clark Date: Tue, 1 Mar 2016 15:34:02 -0800 Subject: [PATCH] HBASE-15315 Remove always set super user call as high priority (Yong Zhang) --- .../AnnotationReadingPriorityFunction.java | 14 ------------ .../hbase/regionserver/TestPriorityRpc.java | 22 ------------------- 2 files changed, 36 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.java index 84383785c82..1eacc7572d0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.java @@ -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); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestPriorityRpc.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestPriorityRpc.java index 446d5897211..edad05940d2 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestPriorityRpc.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestPriorityRpc.java @@ -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();