Java Code Examples for org.apache.hadoop.hbase.HConstants#PRIORITY_UNSET

The following examples show how to use org.apache.hadoop.hbase.HConstants#PRIORITY_UNSET . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleRpcScheduler.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Override
public boolean dispatch(CallRunner callTask) throws InterruptedException {
  RpcCall call = callTask.getRpcCall();
  int level = priority.getPriority(call.getHeader(), call.getParam(),
      call.getRequestUser().orElse(null));
  if (level == HConstants.PRIORITY_UNSET) {
    level = HConstants.NORMAL_QOS;
  }
  if (metaTransitionExecutor != null &&
    level == MasterAnnotationReadingPriorityFunction.META_TRANSITION_QOS) {
    return metaTransitionExecutor.dispatch(callTask);
  } else if (priorityExecutor != null && level > highPriorityLevel) {
    return priorityExecutor.dispatch(callTask);
  } else if (replicationExecutor != null && level == HConstants.REPLICATION_QOS) {
    return replicationExecutor.dispatch(callTask);
  } else {
    return callExecutor.dispatch(callTask);
  }
}
 
Example 2
Source File: IPCUtil.java    From hbase with Apache License 2.0 6 votes vote down vote up
static RequestHeader buildRequestHeader(Call call, CellBlockMeta cellBlockMeta) {
  RequestHeader.Builder builder = RequestHeader.newBuilder();
  builder.setCallId(call.id);
  //TODO handle htrace API change, see HBASE-18895
  /*if (call.span != null) {
    builder.setTraceInfo(RPCTInfo.newBuilder().setParentId(call.span.getSpanId())
        .setTraceId(call.span.getTracerId()));
  }*/
  builder.setMethodName(call.md.getName());
  builder.setRequestParam(call.param != null);
  if (cellBlockMeta != null) {
    builder.setCellBlockMeta(cellBlockMeta);
  }
  // Only pass priority if there is one set.
  if (call.priority != HConstants.PRIORITY_UNSET) {
    builder.setPriority(call.priority);
  }
  builder.setTimeout(call.timeout);

  return builder.build();
}
 
Example 3
Source File: RegionCoprocessorRpcChannel.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
protected Message callExecService(RpcController controller, final Descriptors.MethodDescriptor method, final Message request, Message responsePrototype) throws IOException {
    if(LOG.isTraceEnabled()) {
        LOG.trace("Call: " + method.getName() + ", " + request.toString());
    }

    if(this.row == null) {
        throw new NullPointerException("Can\'t be null!");
    } else {
        int priority = HConstants.PRIORITY_UNSET;
        if (controller instanceof SpliceRpcController) {
            priority = ((SpliceRpcController)controller).getPriority();
        }
        ClientServiceCallable callable = new ClientServiceCallable(this.conn, this.table, this.row, this.conn.getRpcControllerFactory().newController(), priority) {
            protected ClientProtos.CoprocessorServiceResponse rpcCall() throws Exception {
                byte[] regionName = this.getLocation().getRegionInfo().getRegionName();
                ClientProtos.CoprocessorServiceRequest csr = CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request, RegionCoprocessorRpcChannel.this.row, regionName);
                return ((ClientProtos.ClientService.BlockingInterface)this.getStub()).execService(this.getRpcController(), csr);
            }
        };
        ClientProtos.CoprocessorServiceResponse result = (ClientProtos.CoprocessorServiceResponse)this.rpcCallerFactory.newCaller().callWithRetries(callable, this.operationTimeout);
        this.lastRegion = result.getRegion().getValue().toByteArray();
        return CoprocessorRpcUtils.getResponse(result, responsePrototype);
    }
}
 
Example 4
Source File: Action.java    From hbase with Apache License 2.0 4 votes vote down vote up
public Action(Row action, int originalIndex) {
  this(action, originalIndex, HConstants.PRIORITY_UNSET);
}
 
Example 5
Source File: MultiAction.java    From hbase with Apache License 2.0 4 votes vote down vote up
public int getPriority() {
  Optional<Action> result = actions.values().stream().flatMap(List::stream)
      .max((action1, action2) -> Math.max(action1.getPriority(), action2.getPriority()));
  return result.isPresent() ? result.get().getPriority() : HConstants.PRIORITY_UNSET;
}
 
Example 6
Source File: ConnectionUtils.java    From hbase with Apache License 2.0 3 votes vote down vote up
/**
 * Select the priority for the rpc call.
 * <p/>
 * The rules are:
 * <ol>
 * <li>If user set a priority explicitly, then just use it.</li>
 * <li>For system table, use {@link HConstants#SYSTEMTABLE_QOS}.</li>
 * <li>For other tables, use {@link HConstants#NORMAL_QOS}.</li>
 * </ol>
 * @param priority the priority set by user, can be {@link HConstants#PRIORITY_UNSET}.
 * @param tableName the table we operate on
 */
static int calcPriority(int priority, TableName tableName) {
  if (priority != HConstants.PRIORITY_UNSET) {
    return priority;
  } else {
    return getPriority(tableName);
  }
}