@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Procedure(pid="); sb.append(proc.getProcId()); sb.append(", ppid="); sb.append(proc.hasParentId() ? proc.getParentId() : Procedure.NO_PROC_ID); sb.append(", class="); sb.append(proc.getClassName()); sb.append(")"); return sb.toString(); } }
size += 1 * getStackIdList().size(); .computeMessageSize(10, getException());
/** * @return True if this new procedure is 'richer' than the current one else false and we log this * incidence where it appears that the WAL has older entries appended after newer ones. * See HBASE-18152. */ private static boolean isIncreasing(ProcedureProtos.Procedure current, ProcedureProtos.Procedure candidate) { // Check that the procedures we see are 'increasing'. We used to compare // procedure id first and then update time but it can legitimately go backwards if the // procedure is failed or rolled back so that was unreliable. Was going to compare // state but lets see if comparing update time enough (unfortunately this issue only // seen under load...) boolean increasing = current.getLastUpdate() <= candidate.getLastUpdate(); if (!increasing) { LOG.warn("NOT INCREASING! current=" + current + ", candidate=" + candidate); } return increasing; }
size += 1 * getStackIdList().size(); .computeMessageSize(10, getException());
result = result && (hasClassName() == other.hasClassName()); if (hasClassName()) { result = result && getClassName() .equals(other.getClassName()); result = result && (hasParentId() == other.hasParentId()); if (hasParentId()) { result = result && (getParentId() == other.getParentId()); result = result && (hasProcId() == other.hasProcId()); if (hasProcId()) { result = result && (getProcId() == other.getProcId()); result = result && (hasSubmittedTime() == other.hasSubmittedTime()); if (hasSubmittedTime()) { result = result && (getSubmittedTime() == other.getSubmittedTime()); result = result && (hasOwner() == other.hasOwner()); if (hasOwner()) { result = result && getOwner() .equals(other.getOwner()); result = result && (hasState() == other.hasState()); if (hasState()) { result = result && state_ == other.state_;
public Builder mergeFrom(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure other) { if (other == org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure.getDefaultInstance()) return this; if (other.hasClassName()) { bitField0_ |= 0x00000001; className_ = other.className_; onChanged(); if (other.hasParentId()) { setParentId(other.getParentId()); if (other.hasProcId()) { setProcId(other.getProcId()); if (other.hasSubmittedTime()) { setSubmittedTime(other.getSubmittedTime()); if (other.hasOwner()) { bitField0_ |= 0x00000010; owner_ = other.owner_; onChanged(); if (other.hasState()) { setState(other.getState()); if (other.hasLastUpdate()) { setLastUpdate(other.getLastUpdate()); if (other.hasTimeout()) { setTimeout(other.getTimeout());
hash = (19 * hash) + getDescriptor().hashCode(); if (hasClassName()) { hash = (37 * hash) + CLASS_NAME_FIELD_NUMBER; hash = (53 * hash) + getClassName().hashCode(); if (hasParentId()) { hash = (37 * hash) + PARENT_ID_FIELD_NUMBER; hash = (53 * hash) + org.apache.hbase.thirdparty.com.google.protobuf.Internal.hashLong( getParentId()); if (hasProcId()) { hash = (37 * hash) + PROC_ID_FIELD_NUMBER; hash = (53 * hash) + org.apache.hbase.thirdparty.com.google.protobuf.Internal.hashLong( getProcId()); if (hasSubmittedTime()) { hash = (37 * hash) + SUBMITTED_TIME_FIELD_NUMBER; hash = (53 * hash) + org.apache.hbase.thirdparty.com.google.protobuf.Internal.hashLong( getSubmittedTime()); if (hasOwner()) { hash = (37 * hash) + OWNER_FIELD_NUMBER; hash = (53 * hash) + getOwner().hashCode(); if (hasState()) { hash = (37 * hash) + STATE_FIELD_NUMBER; hash = (53 * hash) + state_; if (getStackIdCount() > 0) {
output.writeMessage(10, getException());
validateClass(proc); final ProcedureProtos.Procedure.Builder builder = ProcedureProtos.Procedure.newBuilder() .setClassName(proc.getClass().getName()) .setProcId(proc.getProcId())
validateClass(proc); final ProcedureProtos.Procedure.Builder builder = ProcedureProtos.Procedure.newBuilder() .setClassName(proc.getClass().getName()) .setProcId(proc.getProcId())
Procedure<?> proc = newProcedure(proto.getClassName()); proc.setProcId(proto.getProcId()); proc.setState(proto.getState()); proc.setSubmittedTime(proto.getSubmittedTime()); proc.setLastUpdate(proto.getLastUpdate()); if (proto.hasParentId()) { proc.setParentProcId(proto.getParentId()); if (proto.hasOwner()) { proc.setOwner(proto.getOwner()); if (proto.hasTimeout()) { proc.setTimeout(proto.getTimeout()); if (proto.getStackIdCount() > 0) { proc.setStackIndexes(proto.getStackIdList()); if (proto.hasException()) { assert proc.getState() == ProcedureProtos.ProcedureState.FAILED || proc.getState() == ProcedureProtos.ProcedureState.ROLLEDBACK : "The procedure must be failed (waiting to rollback) or rolledback"; proc.setFailure(RemoteProcedureException.fromProto(proto.getException())); if (proto.hasResult()) { proc.setResult(proto.getResult().toByteArray()); if (proto.getNonce() != HConstants.NO_NONCE) {
final Procedure proc = newProcedure(proto.getClassName()); proc.setProcId(proto.getProcId()); proc.setState(proto.getState()); proc.setSubmittedTime(proto.getSubmittedTime()); proc.setLastUpdate(proto.getLastUpdate()); if (proto.hasParentId()) { proc.setParentProcId(proto.getParentId()); if (proto.hasOwner()) { proc.setOwner(proto.getOwner()); if (proto.hasTimeout()) { proc.setTimeout(proto.getTimeout()); if (proto.getStackIdCount() > 0) { proc.setStackIndexes(proto.getStackIdList()); if (proto.hasException()) { assert proc.getState() == ProcedureProtos.ProcedureState.FAILED || proc.getState() == ProcedureProtos.ProcedureState.ROLLEDBACK : "The procedure must be failed (waiting to rollback) or rolledback"; proc.setFailure(RemoteProcedureException.fromProto(proto.getException())); if (proto.hasResult()) { proc.setResult(proto.getResult().toByteArray()); if (proto.getNonce() != HConstants.NO_NONCE) {
/** * <code>optional .hbase.pb.Procedure exclusive_lock_owner_procedure = 4;</code> */ public Builder mergeExclusiveLockOwnerProcedure(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure value) { if (exclusiveLockOwnerProcedureBuilder_ == null) { if (((bitField0_ & 0x00000008) == 0x00000008) && exclusiveLockOwnerProcedure_ != null && exclusiveLockOwnerProcedure_ != org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure.getDefaultInstance()) { exclusiveLockOwnerProcedure_ = org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure.newBuilder(exclusiveLockOwnerProcedure_).mergeFrom(value).buildPartial(); } else { exclusiveLockOwnerProcedure_ = value; } onChanged(); } else { exclusiveLockOwnerProcedureBuilder_.mergeFrom(value); } bitField0_ |= 0x00000008; return this; } /**
public void add(ProcedureProtos.Procedure procProto) { trackProcIds(procProto.getProcId()); Entry entry = addToMap(procProto.getProcId(), procProto.hasParentId()); boolean newEntry = entry.proto == null; // We have seen procedure WALs where the entries are out of order; see HBASE-18152. // To compensate, only replace the Entry procedure if for sure this new procedure // is indeed an entry that came later. TODO: Fix the writing of procedure info so // it does not violate basic expectation, that WALs contain procedure changes going // from start to finish in sequence. if (newEntry || isIncreasing(entry.proto, procProto)) { entry.proto = procProto; } addToReplayList(entry); if(newEntry) { if (procProto.hasParentId()) { childUnlinkedHead = addToLinkList(entry, childUnlinkedHead); } else { rootHead = addToLinkList(entry, rootHead); } } }
/** * @return True if this new procedure is 'richer' than the current one else false and we log this * incidence where it appears that the WAL has older entries appended after newer ones. * See HBASE-18152. */ private static boolean isIncreasing(ProcedureProtos.Procedure current, ProcedureProtos.Procedure candidate) { // Check that the procedures we see are 'increasing'. We used to compare // procedure id first and then update time but it can legitimately go backwards if the // procedure is failed or rolled back so that was unreliable. Was going to compare // state but lets see if comparing update time enough (unfortunately this issue only // seen under load...) boolean increasing = current.getLastUpdate() <= candidate.getLastUpdate(); if (!increasing) { LOG.warn("NOT INCREASING! current=" + current + ", candidate=" + candidate); } return increasing; }
/** * @return True if this new procedure is 'richer' than the current one else * false and we log this incidence where it appears that the WAL has older entries * appended after newer ones. See HBASE-18152. */ private static boolean isIncreasing(ProcedureProtos.Procedure current, ProcedureProtos.Procedure candidate) { // Check that the procedures we see are 'increasing'. We used to compare // procedure id first and then update time but it can legitimately go backwards if the // procedure is failed or rolled back so that was unreliable. Was going to compare // state but lets see if comparing update time enough (unfortunately this issue only // seen under load...) boolean increasing = current.getLastUpdate() <= candidate.getLastUpdate(); if (!increasing) { LOG.warn("NOT INCREASING! current=" + current + ", candidate=" + candidate); } return increasing; }
private List<Entry> buildTree(Map<Long, Entry> procMap) { List<Entry> rootEntries = new ArrayList<>(); procMap.values().forEach(entry -> { if (!entry.proc.hasParentId()) { rootEntries.add(entry); } else { Entry parentEntry = procMap.get(entry.proc.getParentId()); // For a valid procedure this should not be null. We will log the error later if it is null, // as it will not be referenced by any root procedures. if (parentEntry != null) { parentEntry.subProcs.add(entry); } } }); return rootEntries; }
private void loadProcedure(final ProcedureWALEntry entry, final ProcedureProtos.Procedure proc) { maxProcId = Math.max(maxProcId, proc.getProcId()); if (isRequired(proc.getProcId())) { if (LOG.isTraceEnabled()) { LOG.trace("Read " + entry.getType() + " entry " + proc.getProcId()); } localProcedureMap.add(proc); if (tracker.isPartial()) { tracker.insert(proc.getProcId()); } } if (localTracker != null) { localTracker.insert(proc.getProcId()); } }
public long getParentId() { return proto.getParentId(); }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {