@Override public void execProcedure(ProcedureDescription desc) throws IOException { TableName tableName = TableName.valueOf(desc.getInstance()); ForeignExceptionDispatcher monitor = new ForeignExceptionDispatcher(desc.getInstance()); Procedure proc = coordinator.startProcedure(monitor, desc.getInstance(), new byte[0], Lists.newArrayList(regionServers)); monitor.rethrowException(); if (proc == null) { String msg = "Failed to submit distributed procedure " + desc.getSignature() + " for '" + desc.getInstance() + "'. " + "Another flush procedure is running?"; LOG.error(msg); throw new IOException(msg); LOG.info("Done waiting - exec procedure " + desc.getSignature() + " for '" + desc.getInstance() + "'"); LOG.info("Master flush table procedure is successful!"); } catch (InterruptedException e) {
ForeignExceptionDispatcher monitor = new ForeignExceptionDispatcher(desc.getInstance()); List<ServerName> serverNames = master.getServerManager().getOnlineServersList(); List<String> servers = new ArrayList<>(); List<NameStringPair> conf = desc.getConfigurationList(); byte[] data = new byte[0]; if (conf.size() > 0) { Procedure proc = coordinator.startProcedure(monitor, desc.getInstance(), data, servers); if (proc == null) { String msg = "Failed to submit distributed procedure for '" + desc.getInstance() + "'"; LOG.error(msg); throw new IOException(msg); LOG.info("Done waiting - exec procedure for " + desc.getInstance()); LOG.info("Distributed roll log procedure is successful!"); this.done = true;
public static ProcedureDescription buildProcedureDescription(String signature, String instance, Map<String, String> props) { ProcedureDescription.Builder builder = ProcedureDescription.newBuilder().setSignature(signature).setInstance(instance); if (props != null && !props.isEmpty()) { props.entrySet().forEach(entry -> builder.addConfiguration( NameStringPair.newBuilder().setName(entry.getKey()).setValue(entry.getValue()).build())); } return builder.build(); }
public Builder mergeFrom(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription other) { if (other == org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription.getDefaultInstance()) return this; if (other.hasSignature()) { bitField0_ |= 0x00000001; signature_ = other.signature_; onChanged(); if (other.hasInstance()) { bitField0_ |= 0x00000002; instance_ = other.instance_; onChanged(); if (other.hasCreationTime()) { setCreationTime(other.getCreationTime());
this.done = false; ForeignExceptionDispatcher monitor = new ForeignExceptionDispatcher(desc.getInstance()); servers.add(sn.toString()); Procedure proc = coordinator.startProcedure(monitor, desc.getInstance(), new byte[0], servers); if (proc == null) { String msg = "Failed to submit distributed procedure for '" LOG.info("Done waiting - exec procedure for " + desc.getInstance()); this.done = true; } catch (InterruptedException e) {
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription)) { return super.equals(obj); } org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription other = (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription) obj; boolean result = true; result = result && (hasSignature() == other.hasSignature()); if (hasSignature()) { result = result && getSignature() .equals(other.getSignature()); } result = result && (hasInstance() == other.hasInstance()); if (hasInstance()) { result = result && getInstance() .equals(other.getInstance()); } result = result && (hasCreationTime() == other.hasCreationTime()); if (hasCreationTime()) { result = result && (getCreationTime() == other.getCreationTime()); } result = result && getConfigurationList() .equals(other.getConfigurationList()); result = result && unknownFields.equals(other.unknownFields); return result; }
public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription buildPartial() { org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription result = new org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.signature_ = signature_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.instance_ = instance_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.creationTime_ = creationTime_; if (configurationBuilder_ == null) { if (((bitField0_ & 0x00000008) == 0x00000008)) { configuration_ = java.util.Collections.unmodifiableList(configuration_); bitField0_ = (bitField0_ & ~0x00000008); } result.configuration_ = configuration_; } else { result.configuration_ = configurationBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasSignature()) { hash = (37 * hash) + SIGNATURE_FIELD_NUMBER; hash = (53 * hash) + getSignature().hashCode(); } if (hasInstance()) { hash = (37 * hash) + INSTANCE_FIELD_NUMBER; hash = (53 * hash) + getInstance().hashCode(); } if (hasCreationTime()) { hash = (37 * hash) + CREATION_TIME_FIELD_NUMBER; hash = (53 * hash) + org.apache.hbase.thirdparty.com.google.protobuf.Internal.hashLong( getCreationTime()); } if (getConfigurationCount() > 0) { hash = (37 * hash) + CONFIGURATION_FIELD_NUMBER; hash = (53 * hash) + getConfigurationList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; if (!hasSignature()) { memoizedIsInitialized = 0; return false; } for (int i = 0; i < getConfigurationCount(); i++) { if (!getConfiguration(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }
/** * <pre> * the unique signature of the procedure * </pre> * * <code>required string signature = 1;</code> */ public Builder clearSignature() { bitField0_ = (bitField0_ & ~0x00000001); signature_ = getDefaultInstance().getSignature(); onChanged(); return this; } /**
/** * <pre> * the procedure instance name * </pre> * * <code>optional string instance = 2;</code> */ public Builder clearInstance() { bitField0_ = (bitField0_ & ~0x00000002); instance_ = getDefaultInstance().getInstance(); onChanged(); return this; } /**
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
public static ProcedureDescription buildProcedureDescription(String signature, String instance, Map<String, String> props) { ProcedureDescription.Builder builder = ProcedureDescription.newBuilder().setSignature(signature).setInstance(instance); if (props != null && !props.isEmpty()) { props.entrySet().forEach(entry -> builder.addConfiguration( NameStringPair.newBuilder().setName(entry.getKey()).setValue(entry.getValue()).build())); } return builder.build(); }
public static ProcedureDescription buildProcedureDescription(String signature, String instance, Map<String, String> props) { ProcedureDescription.Builder builder = ProcedureDescription.newBuilder().setSignature(signature).setInstance(instance); if (props != null && !props.isEmpty()) { props.entrySet().forEach(entry -> builder.addConfiguration( NameStringPair.newBuilder().setName(entry.getKey()).setValue(entry.getValue()).build())); } return builder.build(); }
public Builder mergeFrom(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription other) { if (other == org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription.getDefaultInstance()) return this; if (other.hasSignature()) { bitField0_ |= 0x00000001; signature_ = other.signature_; onChanged(); if (other.hasInstance()) { bitField0_ |= 0x00000002; instance_ = other.instance_; onChanged(); if (other.hasCreationTime()) { setCreationTime(other.getCreationTime());
this.done = false; ForeignExceptionDispatcher monitor = new ForeignExceptionDispatcher(desc.getInstance()); servers.add(sn.toString()); Procedure proc = coordinator.startProcedure(monitor, desc.getInstance(), new byte[0], servers); if (proc == null) { String msg = "Failed to submit distributed procedure for '" LOG.info("Done waiting - exec procedure for " + desc.getInstance()); this.done = true; } catch (InterruptedException e) {
/** * Triggers an asynchronous attempt to run a distributed procedure. * {@inheritDoc} */ @Override public ExecProcedureResponse execProcedure(RpcController controller, ExecProcedureRequest request) throws ServiceException { try { master.checkInitialized(); ProcedureDescription desc = request.getProcedure(); MasterProcedureManager mpm = master.getMasterProcedureManagerHost().getProcedureManager( desc.getSignature()); if (mpm == null) { throw new ServiceException(new DoNotRetryIOException("The procedure is not registered: " + desc.getSignature())); } LOG.info(master.getClientIdAuditPrefix() + " procedure request for: " + desc.getSignature()); mpm.checkPermissions(desc, accessChecker, RpcServer.getRequestUser().orElse(null)); mpm.execProcedure(desc); // send back the max amount of time the client should wait for the procedure // to complete long waitTime = SnapshotDescriptionUtils.DEFAULT_MAX_WAIT_TIME; return ExecProcedureResponse.newBuilder().setExpectedTimeout( waitTime).build(); } catch (ForeignException e) { throw new ServiceException(e.getCause()); } catch (IOException e) { throw new ServiceException(e); } }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription)) { return super.equals(obj); } org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription other = (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription) obj; boolean result = true; result = result && (hasSignature() == other.hasSignature()); if (hasSignature()) { result = result && getSignature() .equals(other.getSignature()); } result = result && (hasInstance() == other.hasInstance()); if (hasInstance()) { result = result && getInstance() .equals(other.getInstance()); } result = result && (hasCreationTime() == other.hasCreationTime()); if (hasCreationTime()) { result = result && (getCreationTime() == other.getCreationTime()); } result = result && getConfigurationList() .equals(other.getConfigurationList()); result = result && unknownFields.equals(other.unknownFields); return result; }
public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription buildPartial() { org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription result = new org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.signature_ = signature_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.instance_ = instance_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.creationTime_ = creationTime_; if (configurationBuilder_ == null) { if (((bitField0_ & 0x00000008) == 0x00000008)) { configuration_ = java.util.Collections.unmodifiableList(configuration_); bitField0_ = (bitField0_ & ~0x00000008); } result.configuration_ = configuration_; } else { result.configuration_ = configurationBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; }
/** * Checks if the specified procedure is done. * @return true if the procedure is done, false if the procedure is in the process of completing * @throws ServiceException if invalid procedure or failed procedure with progress failure reason. */ @Override public IsProcedureDoneResponse isProcedureDone(RpcController controller, IsProcedureDoneRequest request) throws ServiceException { try { master.checkInitialized(); ProcedureDescription desc = request.getProcedure(); MasterProcedureManager mpm = master.getMasterProcedureManagerHost().getProcedureManager( desc.getSignature()); if (mpm == null) { throw new ServiceException("The procedure is not registered: " + desc.getSignature()); } LOG.debug("Checking to see if procedure from request:" + desc.getSignature() + " is done"); IsProcedureDoneResponse.Builder builder = IsProcedureDoneResponse.newBuilder(); boolean done = mpm.isProcedureDone(desc); builder.setDone(done); return builder.build(); } catch (ForeignException e) { throw new ServiceException(e.getCause()); } catch (IOException e) { throw new ServiceException(e); } }