HBASE-21928 Deprecated HConstants.META_QOS
Signed-off-by: Zheng Hu <openinx@gmail.com>
This commit is contained in:
parent
e257f4698c
commit
e984515b74
|
@ -612,9 +612,7 @@ public final class ConnectionUtils {
|
|||
}
|
||||
|
||||
static int getPriority(TableName tableName) {
|
||||
if (TableName.isMetaTableName(tableName)) {
|
||||
return HConstants.META_QOS;
|
||||
} else if (tableName.isSystemTable()) {
|
||||
if (tableName.isSystemTable()) {
|
||||
return HConstants.SYSTEMTABLE_QOS;
|
||||
} else {
|
||||
return HConstants.NORMAL_QOS;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import static org.apache.hadoop.hbase.HConstants.HIGH_QOS;
|
||||
import static org.apache.hadoop.hbase.HConstants.META_QOS;
|
||||
import static org.apache.hadoop.hbase.HConstants.NORMAL_QOS;
|
||||
import static org.apache.hadoop.hbase.HConstants.SYSTEMTABLE_QOS;
|
||||
import static org.apache.hadoop.hbase.NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR;
|
||||
|
@ -197,7 +196,7 @@ public class TestAsyncAdminRpcPriority {
|
|||
public void testCreateMetaTable() {
|
||||
conn.getAdmin().createTable(TableDescriptorBuilder.newBuilder(TableName.META_TABLE_NAME)
|
||||
.setColumnFamily(ColumnFamilyDescriptorBuilder.of("cf")).build()).join();
|
||||
verify(masterStub, times(1)).createTable(assertPriority(META_QOS),
|
||||
verify(masterStub, times(1)).createTable(assertPriority(SYSTEMTABLE_QOS),
|
||||
any(CreateTableRequest.class), any());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
*/
|
||||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import static org.apache.hadoop.hbase.HConstants.META_QOS;
|
||||
import static org.apache.hadoop.hbase.HConstants.NORMAL_QOS;
|
||||
import static org.apache.hadoop.hbase.HConstants.SYSTEMTABLE_QOS;
|
||||
import static org.apache.hadoop.hbase.NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR;
|
||||
|
@ -242,7 +241,7 @@ public class TestAsyncTableRpcPriority {
|
|||
@Test
|
||||
public void testGetMetaTable() {
|
||||
conn.getTable(TableName.META_TABLE_NAME).get(new Get(Bytes.toBytes(0))).join();
|
||||
verify(stub, times(1)).get(assertPriority(META_QOS), any(GetRequest.class), any());
|
||||
verify(stub, times(1)).get(assertPriority(SYSTEMTABLE_QOS), any(GetRequest.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -274,7 +273,7 @@ public class TestAsyncTableRpcPriority {
|
|||
public void testPutMetaTable() {
|
||||
conn.getTable(TableName.META_TABLE_NAME).put(new Put(Bytes.toBytes(0))
|
||||
.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("cq"), Bytes.toBytes("v"))).join();
|
||||
verify(stub, times(1)).mutate(assertPriority(META_QOS), any(MutateRequest.class), any());
|
||||
verify(stub, times(1)).mutate(assertPriority(SYSTEMTABLE_QOS), any(MutateRequest.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -301,7 +300,7 @@ public class TestAsyncTableRpcPriority {
|
|||
@Test
|
||||
public void testDeleteMetaTable() {
|
||||
conn.getTable(TableName.META_TABLE_NAME).delete(new Delete(Bytes.toBytes(0))).join();
|
||||
verify(stub, times(1)).mutate(assertPriority(META_QOS), any(MutateRequest.class), any());
|
||||
verify(stub, times(1)).mutate(assertPriority(SYSTEMTABLE_QOS), any(MutateRequest.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -333,7 +332,7 @@ public class TestAsyncTableRpcPriority {
|
|||
public void testAppendMetaTable() {
|
||||
conn.getTable(TableName.META_TABLE_NAME).append(new Append(Bytes.toBytes(0))
|
||||
.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("cq"), Bytes.toBytes("v"))).join();
|
||||
verify(stub, times(1)).mutate(assertPriority(META_QOS), any(MutateRequest.class), any());
|
||||
verify(stub, times(1)).mutate(assertPriority(SYSTEMTABLE_QOS), any(MutateRequest.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -361,7 +360,7 @@ public class TestAsyncTableRpcPriority {
|
|||
public void testIncrementMetaTable() {
|
||||
conn.getTable(TableName.META_TABLE_NAME)
|
||||
.incrementColumnValue(Bytes.toBytes(0), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1).join();
|
||||
verify(stub, times(1)).mutate(assertPriority(META_QOS), any(MutateRequest.class), any());
|
||||
verify(stub, times(1)).mutate(assertPriority(SYSTEMTABLE_QOS), any(MutateRequest.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -401,7 +400,7 @@ public class TestAsyncTableRpcPriority {
|
|||
.qualifier(Bytes.toBytes("cq")).ifNotExists().thenPut(new Put(Bytes.toBytes(0))
|
||||
.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("cq"), Bytes.toBytes("v")))
|
||||
.join();
|
||||
verify(stub, times(1)).mutate(assertPriority(META_QOS), any(MutateRequest.class), any());
|
||||
verify(stub, times(1)).mutate(assertPriority(SYSTEMTABLE_QOS), any(MutateRequest.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -434,7 +433,7 @@ public class TestAsyncTableRpcPriority {
|
|||
.qualifier(Bytes.toBytes("cq")).ifNotExists().thenPut(new Put(Bytes.toBytes(0))
|
||||
.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("cq"), Bytes.toBytes("v")))
|
||||
.join();
|
||||
verify(stub, times(1)).mutate(assertPriority(META_QOS), any(MutateRequest.class), any());
|
||||
verify(stub, times(1)).mutate(assertPriority(SYSTEMTABLE_QOS), any(MutateRequest.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -475,8 +474,8 @@ public class TestAsyncTableRpcPriority {
|
|||
.qualifier(Bytes.toBytes("cq")).ifEquals(Bytes.toBytes("v"))
|
||||
.thenMutate(new RowMutations(Bytes.toBytes(0)).add((Mutation) new Delete(Bytes.toBytes(0))))
|
||||
.join();
|
||||
verify(stub, times(1)).multi(assertPriority(META_QOS), any(ClientProtos.MultiRequest.class),
|
||||
any());
|
||||
verify(stub, times(1)).multi(assertPriority(SYSTEMTABLE_QOS),
|
||||
any(ClientProtos.MultiRequest.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -525,7 +524,7 @@ public class TestAsyncTableRpcPriority {
|
|||
}
|
||||
Thread.sleep(1000);
|
||||
// open, next, several renew lease, and then close
|
||||
verify(stub, atLeast(4)).scan(assertPriority(META_QOS), any(ScanRequest.class), any());
|
||||
verify(stub, atLeast(4)).scan(assertPriority(SYSTEMTABLE_QOS), any(ScanRequest.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -548,7 +547,7 @@ public class TestAsyncTableRpcPriority {
|
|||
public void testBatchMetaTable() {
|
||||
conn.getTable(TableName.META_TABLE_NAME).batchAll(Arrays.asList(new Delete(Bytes.toBytes(0))))
|
||||
.join();
|
||||
verify(stub, times(1)).multi(assertPriority(META_QOS), any(ClientProtos.MultiRequest.class),
|
||||
any());
|
||||
verify(stub, times(1)).multi(assertPriority(SYSTEMTABLE_QOS),
|
||||
any(ClientProtos.MultiRequest.class), any());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1119,9 +1119,13 @@ public final class HConstants {
|
|||
public static final int ADMIN_QOS = 100;
|
||||
public static final int HIGH_QOS = 200;
|
||||
public static final int SYSTEMTABLE_QOS = HIGH_QOS;
|
||||
/**
|
||||
* @deprecated the name "META_QOS" is a bit ambiguous, actually only meta region transition can
|
||||
* use this priority, and you should not use this directly. Will be removed in 3.0.0.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final int META_QOS = 300;
|
||||
|
||||
|
||||
/** Directory under /hbase where archived hfiles are stored */
|
||||
public static final String HFILE_ARCHIVE_DIRECTORY = "archive";
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.hadoop.hbase.HConstants;
|
|||
import org.apache.yetus.audience.InterfaceAudience;
|
||||
import org.apache.yetus.audience.InterfaceStability;
|
||||
import org.apache.hadoop.hbase.conf.ConfigurationObserver;
|
||||
import org.apache.hadoop.hbase.master.MasterAnnotationReadingPriorityFunction;
|
||||
|
||||
/**
|
||||
* The default scheduler. Configurable. Maintains isolated handler pools for general ('default'),
|
||||
|
@ -189,7 +190,8 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs
|
|||
if (level == HConstants.PRIORITY_UNSET) {
|
||||
level = HConstants.NORMAL_QOS;
|
||||
}
|
||||
if (metaTransitionExecutor != null && level == HConstants.META_QOS) {
|
||||
if (metaTransitionExecutor != null &&
|
||||
level == MasterAnnotationReadingPriorityFunction.META_TRANSITION_QOS) {
|
||||
return metaTransitionExecutor.dispatch(callTask);
|
||||
} else if (priorityExecutor != null && level > highPriorityLevel) {
|
||||
return priorityExecutor.dispatch(callTask);
|
||||
|
|
|
@ -49,6 +49,9 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProto
|
|||
*/
|
||||
@InterfaceAudience.Private
|
||||
public class MasterAnnotationReadingPriorityFunction extends AnnotationReadingPriorityFunction {
|
||||
|
||||
public static final int META_TRANSITION_QOS = 300;
|
||||
|
||||
public MasterAnnotationReadingPriorityFunction(final RSRpcServices rpcServices) {
|
||||
this(rpcServices, rpcServices.getClass());
|
||||
}
|
||||
|
@ -66,29 +69,38 @@ public class MasterAnnotationReadingPriorityFunction extends AnnotationReadingPr
|
|||
// every single RPC request.
|
||||
int priorityByAnnotation = getAnnotatedPriority(header);
|
||||
if (priorityByAnnotation >= 0) {
|
||||
return priorityByAnnotation;
|
||||
// no one can have higher priority than meta transition.
|
||||
if (priorityByAnnotation >= META_TRANSITION_QOS) {
|
||||
return META_TRANSITION_QOS - 1;
|
||||
} else {
|
||||
return priorityByAnnotation;
|
||||
}
|
||||
}
|
||||
|
||||
// If meta is moving then all the other of reports of state transitions will be
|
||||
// un able to edit meta. Those blocked reports should not keep the report that opens meta from
|
||||
// running. Hence all reports of meta transitioning should always be in a different thread.
|
||||
// running. Hence all reports of meta transition should always be in a different thread.
|
||||
// This keeps from deadlocking the cluster.
|
||||
if (param instanceof RegionServerStatusProtos.ReportRegionStateTransitionRequest) {
|
||||
// Regions are moving. Lets see which ones.
|
||||
RegionServerStatusProtos.ReportRegionStateTransitionRequest
|
||||
tRequest = (RegionServerStatusProtos.ReportRegionStateTransitionRequest) param;
|
||||
RegionServerStatusProtos.ReportRegionStateTransitionRequest tRequest =
|
||||
(RegionServerStatusProtos.ReportRegionStateTransitionRequest) param;
|
||||
for (RegionServerStatusProtos.RegionStateTransition rst : tRequest.getTransitionList()) {
|
||||
if (rst.getRegionInfoList() != null) {
|
||||
for (HBaseProtos.RegionInfo info : rst.getRegionInfoList()) {
|
||||
TableName tn = ProtobufUtil.toTableName(info.getTableName());
|
||||
if (TableName.META_TABLE_NAME.equals(tn)) {
|
||||
return HConstants.META_QOS;
|
||||
return META_TRANSITION_QOS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return HConstants.HIGH_QOS;
|
||||
}
|
||||
// also use HIGH_QOS for region server report
|
||||
if (param instanceof RegionServerStatusProtos.RegionServerReportRequest) {
|
||||
return HConstants.HIGH_QOS;
|
||||
}
|
||||
|
||||
// Handle the rest of the different reasons to change priority.
|
||||
return getBasePriority(header, param);
|
||||
|
|
Loading…
Reference in New Issue