Skip to content

Commit

Permalink
HBASE-7720 Improve logging messages of failed snapshot attempts.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-7290@1445867 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
jmhsieh committed Feb 13, 2013
1 parent f60820c commit 81a4387
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
Expand Up @@ -51,6 +51,7 @@
import org.apache.hadoop.hbase.master.SnapshotSentinel;
import org.apache.hadoop.hbase.master.cleaner.HFileCleaner;
import org.apache.hadoop.hbase.master.cleaner.HFileLinkCleaner;
import org.apache.hadoop.hbase.procedure.Procedure;
import org.apache.hadoop.hbase.procedure.ProcedureCoordinator;
import org.apache.hadoop.hbase.procedure.ProcedureCoordinatorRpcs;
import org.apache.hadoop.hbase.procedure.ZKProcedureCoordinatorRpcs;
Expand Down Expand Up @@ -322,7 +323,15 @@ public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
try {
handler.rethrowException();
} catch (ForeignException e) {
throw new HBaseSnapshotException("Snapshot " + ssString + " had an error from RS", e,
// Give some procedure info on an exception.
String status;
Procedure p = coordinator.getProcedure(expected.getName());
if (p != null) {
status = p.getStatus();
} else {
status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
}
throw new HBaseSnapshotException("Snapshot " + ssString + " had an error. " + status, e,
expected);
}

Expand Down
Expand Up @@ -164,6 +164,19 @@ public String getName() {
return procName;
}

/**
* Returns a copy of the procedure members still trying to enter the barrier.
* @return
*/
public String getStatus() {
String waiting, done;
synchronized (joinBarrierLock) {
waiting = acquiringMembers.toString();
done = inBarrierMembers.toString();
}
return "Procedure " + procName + " { waiting=" + waiting + " done="+ done + " }";
}

/**
* Get the ExternalErrorDispatcher
* @return the Procedure's monitor.
Expand Down
Expand Up @@ -19,7 +19,9 @@

import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
Expand Down Expand Up @@ -246,4 +248,21 @@ void memberFinishedBarrier(String procName, final String member) {
ProcedureCoordinatorRpcs getRpcs() {
return rpcs;
}

/**
* Returns the procedure. This Procedure is a live instance so should not be modified but can
* be inspected.
* @param name Name of the procedure
* @return Procedure or null if not present any more
*/
public Procedure getProcedure(String name) {
return procedures.get(name);
}

/**
* @return Return set of all procedure names.
*/
public Set<String> getProcedureNames() {
return new HashSet<String>(procedures.keySet());
}
}
Expand Up @@ -76,7 +76,7 @@ public static ThreadPoolExecutor defaultPool(long wakeFrequency, long keepAlive,
int procThreads, String memberName) {
return new ThreadPoolExecutor(1, procThreads, keepAlive, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(),
new DaemonThreadFactory("( member-" + memberName + ") subprocedure-pool"));
new DaemonThreadFactory("member: '" + memberName + "' subprocedure-pool"));
}

/**
Expand Down

0 comments on commit 81a4387

Please sign in to comment.