Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 335761886D for ; Tue, 8 Mar 2016 18:05:38 +0000 (UTC) Received: (qmail 50590 invoked by uid 500); 8 Mar 2016 18:05:37 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 50496 invoked by uid 500); 8 Mar 2016 18:05:36 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 50237 invoked by uid 99); 8 Mar 2016 18:05:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2016 18:05:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 84C32DF99E; Tue, 8 Mar 2016 18:05:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: misty@apache.org To: commits@hbase.apache.org Date: Tue, 08 Mar 2016 18:05:40 -0000 Message-Id: <8513ecf4327548ae9450fc034126e7b5@git.apache.org> In-Reply-To: <217926e3b5034dc0aeb5a884dcb03048@git.apache.org> References: <217926e3b5034dc0aeb5a884dcb03048@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [05/34] hbase-site git commit: Published site at 46cc3d4972d8db478c86e9848afed523cb6dc866. http://git-wip-us.apache.org/repos/asf/hbase-site/blob/58f51408/xref/org/apache/hadoop/hbase/ProcedureInfo.html ---------------------------------------------------------------------- diff --git a/xref/org/apache/hadoop/hbase/ProcedureInfo.html b/xref/org/apache/hadoop/hbase/ProcedureInfo.html index 2553918..66220e7 100644 --- a/xref/org/apache/hadoop/hbase/ProcedureInfo.html +++ b/xref/org/apache/hadoop/hbase/ProcedureInfo.html @@ -37,233 +37,273 @@ 27 import org.apache.hadoop.hbase.protobuf.generated.ProcedureProtos.ProcedureState; 28 import org.apache.hadoop.hbase.security.User; 29 import org.apache.hadoop.hbase.util.ByteStringer; -30 import org.apache.hadoop.hbase.util.ForeignExceptionUtil; -31 import org.apache.hadoop.hbase.util.NonceKey; -32 -33 /** -34 * Procedure information -35 */ -36 @InterfaceAudience.Public -37 @InterfaceStability.Evolving -38 public class ProcedureInfo implements Cloneable { -39 private final long procId; -40 private final String procName; -41 private final String procOwner; -42 private final ProcedureState procState; -43 private final long parentId; -44 private final NonceKey nonceKey; -45 private final ForeignExceptionMessage exception; -46 private final long lastUpdate; -47 private final long startTime; -48 private final byte[] result; -49 -50 private long clientAckTime = -1; +30 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; +31 import org.apache.hadoop.hbase.util.ForeignExceptionUtil; +32 import org.apache.hadoop.hbase.util.NonceKey; +33 import org.apache.hadoop.util.StringUtils; +34 +35 /** +36 * Procedure information +37 */ +38 @InterfaceAudience.Public +39 @InterfaceStability.Evolving +40 public class ProcedureInfo implements Cloneable { +41 private final long procId; +42 private final String procName; +43 private final String procOwner; +44 private final ProcedureState procState; +45 private final long parentId; +46 private final NonceKey nonceKey; +47 private final ForeignExceptionMessage exception; +48 private final long lastUpdate; +49 private final long startTime; +50 private final byte[] result; 51 -52 @InterfaceAudience.Private -53 public ProcedureInfo( -54 final long procId, -55 final String procName, -56 final String procOwner, -57 final ProcedureState procState, -58 final long parentId, -59 final NonceKey nonceKey, -60 final ForeignExceptionMessage exception, -61 final long lastUpdate, -62 final long startTime, -63 final byte[] result) { -64 this.procId = procId; -65 this.procName = procName; -66 this.procOwner = procOwner; -67 this.procState = procState; -68 this.parentId = parentId; -69 this.nonceKey = nonceKey; -70 this.lastUpdate = lastUpdate; -71 this.startTime = startTime; -72 -73 // If the procedure is completed, we should treat exception and result differently -74 this.exception = exception; -75 this.result = result; -76 } -77 -78 @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="CN_IDIOM_NO_SUPER_CALL", -79 justification="Intentional; calling super class clone doesn't make sense here.") -80 public ProcedureInfo clone() { -81 return new ProcedureInfo(procId, procName, procOwner, procState, parentId, nonceKey, -82 exception, lastUpdate, startTime, result); -83 } -84 -85 public long getProcId() { -86 return procId; -87 } -88 -89 public String getProcName() { -90 return procName; -91 } -92 -93 public String getProcOwner() { -94 return procOwner; -95 } -96 -97 public ProcedureState getProcState() { -98 return procState; -99 } -100 -101 public boolean hasParentId() { -102 return (parentId != -1); -103 } +52 private long clientAckTime = -1; +53 +54 @InterfaceAudience.Private +55 public ProcedureInfo( +56 final long procId, +57 final String procName, +58 final String procOwner, +59 final ProcedureState procState, +60 final long parentId, +61 final NonceKey nonceKey, +62 final ForeignExceptionMessage exception, +63 final long lastUpdate, +64 final long startTime, +65 final byte[] result) { +66 this.procId = procId; +67 this.procName = procName; +68 this.procOwner = procOwner; +69 this.procState = procState; +70 this.parentId = parentId; +71 this.nonceKey = nonceKey; +72 this.lastUpdate = lastUpdate; +73 this.startTime = startTime; +74 +75 // If the procedure is completed, we should treat exception and result differently +76 this.exception = exception; +77 this.result = result; +78 } +79 +80 @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="CN_IDIOM_NO_SUPER_CALL", +81 justification="Intentional; calling super class clone doesn't make sense here.") +82 public ProcedureInfo clone() { +83 return new ProcedureInfo(procId, procName, procOwner, procState, parentId, nonceKey, +84 exception, lastUpdate, startTime, result); +85 } +86 +87 @Override +88 public String toString() { +89 StringBuilder sb = new StringBuilder(); +90 sb.append("Procedure="); +91 sb.append(procName); +92 sb.append(" (id="); +93 sb.append(procId); +94 if (hasParentId()) { +95 sb.append(", parent="); +96 sb.append(parentId); +97 } +98 if (hasOwner()) { +99 sb.append(", owner="); +100 sb.append(procOwner); +101 } +102 sb.append(", state="); +103 sb.append(procState); 104 -105 public long getParentId() { -106 return parentId; -107 } -108 -109 public NonceKey getNonceKey() { -110 return nonceKey; -111 } -112 -113 public boolean isFailed() { -114 return exception != null; -115 } -116 -117 public IOException getException() { -118 if (isFailed()) { -119 return ForeignExceptionUtil.toIOException(exception); -120 } -121 return null; -122 } -123 -124 @InterfaceAudience.Private -125 public ForeignExceptionMessage getForeignExceptionMessage() { -126 return exception; +105 long now = EnvironmentEdgeManager.currentTime(); +106 sb.append(", startTime="); +107 sb.append(StringUtils.formatTime(now - startTime)); +108 sb.append(" ago, lastUpdate="); +109 sb.append(StringUtils.formatTime(now - startTime)); +110 sb.append(" ago"); +111 +112 if (isFailed()) { +113 sb.append(", exception=\""); +114 sb.append(getExceptionMessage()); +115 sb.append("\""); +116 } +117 sb.append(")"); +118 return sb.toString(); +119 } +120 +121 public long getProcId() { +122 return procId; +123 } +124 +125 public String getProcName() { +126 return procName; 127 } 128 -129 public String getExceptionCause() { -130 assert isFailed(); -131 return exception.getGenericException().getClassName(); -132 } -133 -134 public String getExceptionMessage() { -135 assert isFailed(); -136 return exception.getGenericException().getMessage(); -137 } -138 -139 public String getExceptionFullMessage() { -140 assert isFailed(); -141 return getExceptionCause() + " - " + getExceptionMessage(); -142 } -143 -144 public boolean hasResultData() { -145 return result != null; -146 } -147 -148 public byte[] getResult() { -149 return result; -150 } -151 -152 public long getStartTime() { -153 return startTime; -154 } -155 -156 public long getLastUpdate() { -157 return lastUpdate; -158 } -159 -160 public long executionTime() { -161 return lastUpdate - startTime; +129 private boolean hasOwner() { +130 return procOwner != null; +131 } +132 +133 public String getProcOwner() { +134 return procOwner; +135 } +136 +137 public ProcedureState getProcState() { +138 return procState; +139 } +140 +141 public boolean hasParentId() { +142 return (parentId != -1); +143 } +144 +145 public long getParentId() { +146 return parentId; +147 } +148 +149 public NonceKey getNonceKey() { +150 return nonceKey; +151 } +152 +153 public boolean isFailed() { +154 return exception != null; +155 } +156 +157 public IOException getException() { +158 if (isFailed()) { +159 return ForeignExceptionUtil.toIOException(exception); +160 } +161 return null; 162 } 163 164 @InterfaceAudience.Private -165 public boolean hasClientAckTime() { -166 return clientAckTime > 0; +165 public ForeignExceptionMessage getForeignExceptionMessage() { +166 return exception; 167 } 168 -169 @InterfaceAudience.Private -170 public long getClientAckTime() { -171 return clientAckTime; +169 public String getExceptionCause() { +170 assert isFailed(); +171 return exception.getGenericException().getClassName(); 172 } 173 -174 @InterfaceAudience.Private -175 public void setClientAckTime(final long timestamp) { -176 this.clientAckTime = timestamp; +174 public String getExceptionMessage() { +175 assert isFailed(); +176 return exception.getGenericException().getMessage(); 177 } 178 -179 /** -180 * @return Convert the current {@link ProcedureInfo} into a Protocol Buffers Procedure -181 * instance. -182 */ -183 @InterfaceAudience.Private -184 public static ProcedureProtos.Procedure convertToProcedureProto( -185 final ProcedureInfo procInfo) { -186 ProcedureProtos.Procedure.Builder builder = ProcedureProtos.Procedure.newBuilder(); +179 public String getExceptionFullMessage() { +180 assert isFailed(); +181 return getExceptionCause() + " - " + getExceptionMessage(); +182 } +183 +184 public boolean hasResultData() { +185 return result != null; +186 } 187 -188 builder.setClassName(procInfo.getProcName()); -189 builder.setProcId(procInfo.getProcId()); -190 builder.setStartTime(procInfo.getStartTime()); -191 builder.setState(procInfo.getProcState()); -192 builder.setLastUpdate(procInfo.getLastUpdate()); -193 -194 if (procInfo.hasParentId()) { -195 builder.setParentId(procInfo.getParentId()); -196 } -197 -198 if (procInfo.getProcOwner() != null) { -199 builder.setOwner(procInfo.getProcOwner()); -200 } -201 -202 if (procInfo.isFailed()) { -203 builder.setException(procInfo.getForeignExceptionMessage()); -204 } -205 -206 if (procInfo.hasResultData()) { -207 builder.setResult(ByteStringer.wrap(procInfo.getResult())); -208 } -209 -210 return builder.build(); -211 } -212 -213 /** -214 * Helper to convert the protobuf object. -215 * @return Convert the current Protocol Buffers Procedure to {@link ProcedureInfo} -216 * instance. -217 */ -218 @InterfaceAudience.Private -219 public static ProcedureInfo convert(final ProcedureProtos.Procedure procProto) { -220 NonceKey nonceKey = null; -221 if (procProto.getNonce() != HConstants.NO_NONCE) { -222 nonceKey = new NonceKey(procProto.getNonceGroup(), procProto.getNonce()); -223 } -224 -225 return new ProcedureInfo( -226 procProto.getProcId(), -227 procProto.getClassName(), -228 procProto.getOwner(), -229 procProto.getState(), -230 procProto.hasParentId() ? procProto.getParentId() : -1, -231 nonceKey, -232 procProto.hasException() ? procProto.getException() : null, -233 procProto.getLastUpdate(), -234 procProto.getStartTime(), -235 procProto.hasResult() ? procProto.getResult().toByteArray() : null); -236 } +188 public byte[] getResult() { +189 return result; +190 } +191 +192 public long getStartTime() { +193 return startTime; +194 } +195 +196 public long getLastUpdate() { +197 return lastUpdate; +198 } +199 +200 public long executionTime() { +201 return lastUpdate - startTime; +202 } +203 +204 @InterfaceAudience.Private +205 public boolean hasClientAckTime() { +206 return clientAckTime > 0; +207 } +208 +209 @InterfaceAudience.Private +210 public long getClientAckTime() { +211 return clientAckTime; +212 } +213 +214 @InterfaceAudience.Private +215 public void setClientAckTime(final long timestamp) { +216 this.clientAckTime = timestamp; +217 } +218 +219 /** +220 * @return Convert the current {@link ProcedureInfo} into a Protocol Buffers Procedure +221 * instance. +222 */ +223 @InterfaceAudience.Private +224 public static ProcedureProtos.Procedure convertToProcedureProto( +225 final ProcedureInfo procInfo) { +226 ProcedureProtos.Procedure.Builder builder = ProcedureProtos.Procedure.newBuilder(); +227 +228 builder.setClassName(procInfo.getProcName()); +229 builder.setProcId(procInfo.getProcId()); +230 builder.setStartTime(procInfo.getStartTime()); +231 builder.setState(procInfo.getProcState()); +232 builder.setLastUpdate(procInfo.getLastUpdate()); +233 +234 if (procInfo.hasParentId()) { +235 builder.setParentId(procInfo.getParentId()); +236 } 237 -238 /** -239 * Check if the user is this procedure's owner -240 * @param procInfo the procedure to check -241 * @param user the user -242 * @return true if the user is the owner of the procedure, -243 * false otherwise or the owner is unknown. -244 */ -245 @InterfaceAudience.Private -246 public static boolean isProcedureOwner(final ProcedureInfo procInfo, final User user) { -247 if (user == null) { -248 return false; -249 } -250 String procOwner = procInfo.getProcOwner(); -251 if (procOwner == null) { -252 return false; -253 } -254 return procOwner.equals(user.getShortName()); -255 } -256 } +238 if (procInfo.getProcOwner() != null) { +239 builder.setOwner(procInfo.getProcOwner()); +240 } +241 +242 if (procInfo.isFailed()) { +243 builder.setException(procInfo.getForeignExceptionMessage()); +244 } +245 +246 if (procInfo.hasResultData()) { +247 builder.setResult(ByteStringer.wrap(procInfo.getResult())); +248 } +249 +250 return builder.build(); +251 } +252 +253 /** +254 * Helper to convert the protobuf object. +255 * @return Convert the current Protocol Buffers Procedure to {@link ProcedureInfo} +256 * instance. +257 */ +258 @InterfaceAudience.Private +259 public static ProcedureInfo convert(final ProcedureProtos.Procedure procProto) { +260 NonceKey nonceKey = null; +261 if (procProto.getNonce() != HConstants.NO_NONCE) { +262 nonceKey = new NonceKey(procProto.getNonceGroup(), procProto.getNonce()); +263 } +264 +265 return new ProcedureInfo( +266 procProto.getProcId(), +267 procProto.getClassName(), +268 procProto.getOwner(), +269 procProto.getState(), +270 procProto.hasParentId() ? procProto.getParentId() : -1, +271 nonceKey, +272 procProto.hasException() ? procProto.getException() : null, +273 procProto.getLastUpdate(), +274 procProto.getStartTime(), +275 procProto.hasResult() ? procProto.getResult().toByteArray() : null); +276 } +277 +278 /** +279 * Check if the user is this procedure's owner +280 * @param procInfo the procedure to check +281 * @param user the user +282 * @return true if the user is the owner of the procedure, +283 * false otherwise or the owner is unknown. +284 */ +285 @InterfaceAudience.Private +286 public static boolean isProcedureOwner(final ProcedureInfo procInfo, final User user) { +287 if (user == null) { +288 return false; +289 } +290 String procOwner = procInfo.getProcOwner(); +291 if (procOwner == null) { +292 return false; +293 } +294 return procOwner.equals(user.getShortName()); +295 } +296 }
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/58f51408/xref/org/apache/hadoop/hbase/client/FastFailInterceptorContext.html ---------------------------------------------------------------------- diff --git a/xref/org/apache/hadoop/hbase/client/FastFailInterceptorContext.html b/xref/org/apache/hadoop/hbase/client/FastFailInterceptorContext.html index e4d666f..c0409d4 100644 --- a/xref/org/apache/hadoop/hbase/client/FastFailInterceptorContext.html +++ b/xref/org/apache/hadoop/hbase/client/FastFailInterceptorContext.html @@ -37,100 +37,111 @@ 27 28 // The variable that indicates whether we were able to connect with the server 29 // in the last run -30 private MutableBoolean couldNotCommunicateWithServer = new MutableBoolean( -31 false); -32 -33 // The variable which indicates whether this was a retry or the first time -34 private boolean didTry = false; -35 -36 // The failure info that is associated with the machine which we are trying to -37 // contact as part of this attempt. -38 private FailureInfo fInfo = null; -39 -40 // Variable indicating that the thread that is currently executing the -41 // operation is in a mode where it would retry instead of failing fast, so -42 // that we can figure out whether making contact with the server is -43 // possible or not. -44 private boolean retryDespiteFastFailMode = false; -45 -46 // The server that would be contacted to successfully complete this operation. -47 private ServerName server; -48 -49 // The number of the retry we are currenty doing. -50 private int tries; -51 -52 public MutableBoolean getCouldNotCommunicateWithServer() { -53 return couldNotCommunicateWithServer; -54 } -55 -56 public FailureInfo getFailureInfo() { -57 return fInfo; -58 } -59 -60 public ServerName getServer() { -61 return server; -62 } -63 -64 public int getTries() { -65 return tries; -66 } -67 -68 public boolean didTry() { -69 return didTry; -70 } -71 -72 public boolean isRetryDespiteFastFailMode() { -73 return retryDespiteFastFailMode; -74 } -75 -76 public void setCouldNotCommunicateWithServer( -77 MutableBoolean couldNotCommunicateWithServer) { -78 this.couldNotCommunicateWithServer = couldNotCommunicateWithServer; -79 } -80 -81 public void setDidTry(boolean didTry) { -82 this.didTry = didTry; -83 } -84 -85 public void setFailureInfo(FailureInfo fInfo) { -86 this.fInfo = fInfo; -87 } -88 -89 public void setRetryDespiteFastFailMode(boolean retryDespiteFastFailMode) { -90 this.retryDespiteFastFailMode = retryDespiteFastFailMode; -91 } -92 -93 public void setServer(ServerName server) { -94 this.server = server; -95 } -96 -97 public void setTries(int tries) { -98 this.tries = tries; -99 } -100 -101 public void clear() { -102 server = null; -103 fInfo = null; -104 didTry = false; -105 couldNotCommunicateWithServer.setValue(false); -106 retryDespiteFastFailMode = false; -107 tries = 0; -108 } -109 -110 public FastFailInterceptorContext prepare(RetryingCallable<?> callable) { -111 return prepare(callable, 0); -112 } -113 -114 public FastFailInterceptorContext prepare(RetryingCallable<?> callable, -115 int tries) { -116 if (callable instanceof RegionServerCallable) { -117 RegionServerCallable<?> retryingCallable = (RegionServerCallable<?>) callable; -118 server = retryingCallable.getLocation().getServerName(); -119 } -120 this.tries = tries; -121 return this; -122 } -123 } +30 private MutableBoolean couldNotCommunicateWithServer = new MutableBoolean(false); +31 +32 // If set, we guarantee that no modifications went to server +33 private MutableBoolean guaranteedClientSideOnly = new MutableBoolean(false); +34 +35 // The variable which indicates whether this was a retry or the first time +36 private boolean didTry = false; +37 +38 // The failure info that is associated with the machine which we are trying to +39 // contact as part of this attempt. +40 private FailureInfo fInfo = null; +41 +42 // Variable indicating that the thread that is currently executing the +43 // operation is in a mode where it would retry instead of failing fast, so +44 // that we can figure out whether making contact with the server is +45 // possible or not. +46 private boolean retryDespiteFastFailMode = false; +47 +48 // The server that would be contacted to successfully complete this operation. +49 private ServerName server; +50 +51 // The number of the retry we are currenty doing. +52 private int tries; +53 +54 public MutableBoolean getCouldNotCommunicateWithServer() { +55 return couldNotCommunicateWithServer; +56 } +57 +58 public MutableBoolean getGuaranteedClientSideOnly() { +59 return guaranteedClientSideOnly; +60 } +61 +62 public FailureInfo getFailureInfo() { +63 return fInfo; +64 } +65 +66 public ServerName getServer() { +67 return server; +68 } +69 +70 public int getTries() { +71 return tries; +72 } +73 +74 public boolean didTry() { +75 return didTry; +76 } +77 +78 public boolean isRetryDespiteFastFailMode() { +79 return retryDespiteFastFailMode; +80 } +81 +82 public void setCouldNotCommunicateWithServer( +83 MutableBoolean couldNotCommunicateWithServer) { +84 this.couldNotCommunicateWithServer = couldNotCommunicateWithServer; +85 } +86 +87 public void setGuaranteedClientSideOnly(MutableBoolean guaranteedClientSideOnly) { +88 this.guaranteedClientSideOnly = guaranteedClientSideOnly; +89 } +90 +91 public void setDidTry(boolean didTry) { +92 this.didTry = didTry; +93 } +94 +95 public void setFailureInfo(FailureInfo fInfo) { +96 this.fInfo = fInfo; +97 } +98 +99 public void setRetryDespiteFastFailMode(boolean retryDespiteFastFailMode) { +100 this.retryDespiteFastFailMode = retryDespiteFastFailMode; +101 } +102 +103 public void setServer(ServerName server) { +104 this.server = server; +105 } +106 +107 public void setTries(int tries) { +108 this.tries = tries; +109 } +110 +111 public void clear() { +112 server = null; +113 fInfo = null; +114 didTry = false; +115 couldNotCommunicateWithServer.setValue(false); +116 guaranteedClientSideOnly.setValue(false); +117 retryDespiteFastFailMode = false; +118 tries = 0; +119 } +120 +121 public FastFailInterceptorContext prepare(RetryingCallable<?> callable) { +122 return prepare(callable, 0); +123 } +124 +125 public FastFailInterceptorContext prepare(RetryingCallable<?> callable, +126 int tries) { +127 if (callable instanceof RegionServerCallable) { +128 RegionServerCallable<?> retryingCallable = (RegionServerCallable<?>) callable; +129 server = retryingCallable.getLocation().getServerName(); +130 } +131 this.tries = tries; +132 return this; +133 } +134 }