HBASE-12607 TestHBaseFsck#testParallelHbck fails running against hadoop 2.6.0

This commit is contained in:
tedyu 2014-12-30 09:33:54 -08:00
parent 7310fa2ba7
commit 57b1efaabe
1 changed files with 10 additions and 1 deletions

View File

@ -129,6 +129,7 @@ import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import org.apache.zookeeper.KeeperException;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
@ -321,7 +322,7 @@ public class HBaseFsck extends Configured {
errors = getErrorReporter(getConf());
this.executor = exec;
}
/**
* This method maintains a lock using a file. If the creation fails we return null
*
@ -329,6 +330,7 @@ public class HBaseFsck extends Configured {
* @throws IOException
*/
private FSDataOutputStream checkAndMarkRunningHbck() throws IOException {
long start = EnvironmentEdgeManager.currentTime();
try {
FileSystem fs = FSUtils.getCurrentFileSystem(getConf());
FsPermission defaultPerms = FSUtils.getFilePermissions(fs, getConf(),
@ -346,6 +348,13 @@ public class HBaseFsck extends Configured {
} else {
throw e;
}
} finally {
long duration = EnvironmentEdgeManager.currentTime() - start;
if (duration > 30000) {
LOG.warn("Took " + duration + " milliseconds to obtain lock");
// took too long to obtain lock
return null;
}
}
}