HBASE-7720 Improve logging messages of failed snapshot attempts.

git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-7290@1445867 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Hsieh 2013-02-13 19:14:15 +00:00
parent 4405698ee9
commit 465ea7f99e
4 changed files with 43 additions and 2 deletions

View File

@ -51,6 +51,7 @@ import org.apache.hadoop.hbase.master.MasterServices;
import org.apache.hadoop.hbase.master.SnapshotSentinel; import org.apache.hadoop.hbase.master.SnapshotSentinel;
import org.apache.hadoop.hbase.master.cleaner.HFileCleaner; import org.apache.hadoop.hbase.master.cleaner.HFileCleaner;
import org.apache.hadoop.hbase.master.cleaner.HFileLinkCleaner; 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.ProcedureCoordinator;
import org.apache.hadoop.hbase.procedure.ProcedureCoordinatorRpcs; import org.apache.hadoop.hbase.procedure.ProcedureCoordinatorRpcs;
import org.apache.hadoop.hbase.procedure.ZKProcedureCoordinatorRpcs; import org.apache.hadoop.hbase.procedure.ZKProcedureCoordinatorRpcs;
@ -322,7 +323,15 @@ public class SnapshotManager implements Stoppable {
try { try {
handler.rethrowException(); handler.rethrowException();
} catch (ForeignException e) { } 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); expected);
} }

View File

@ -164,6 +164,19 @@ public class Procedure implements Callable<Void>, ForeignExceptionListener {
return procName; 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 * Get the ExternalErrorDispatcher
* @return the Procedure's monitor. * @return the Procedure's monitor.

View File

@ -19,7 +19,9 @@ package org.apache.hadoop.hbase.procedure;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future; import java.util.concurrent.Future;
@ -246,4 +248,21 @@ public class ProcedureCoordinator {
ProcedureCoordinatorRpcs getRpcs() { ProcedureCoordinatorRpcs getRpcs() {
return rpcs; 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());
}
} }

View File

@ -76,7 +76,7 @@ public class ProcedureMember implements Closeable {
int procThreads, String memberName) { int procThreads, String memberName) {
return new ThreadPoolExecutor(1, procThreads, keepAlive, TimeUnit.SECONDS, return new ThreadPoolExecutor(1, procThreads, keepAlive, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(), new SynchronousQueue<Runnable>(),
new DaemonThreadFactory("( member-" + memberName + ") subprocedure-pool")); new DaemonThreadFactory("member: '" + memberName + "' subprocedure-pool"));
} }
/** /**