HBASE-3800 HMaster is not able to start due to AlreadyCreatedException

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1095485 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2011-04-20 19:07:43 +00:00
parent 22c70b26a1
commit e5d76ad261
2 changed files with 20 additions and 19 deletions

View File

@ -79,6 +79,7 @@ Release 0.91.0 - Unreleased
HBASE-3781 hbase shell cannot start "NoMethodError: undefined method
`close' for nil:NilClass" (Mikael Sitruk)
HBASE-3802 Redundant list creation in HRegion
HBASE-3800 HMaster is not able to start due to AlreadyCreatedException
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -250,26 +250,26 @@ public class FSUtils {
*/
public static void setVersion(FileSystem fs, Path rootdir, String version,
int wait) throws IOException {
while (true) try {
FSDataOutputStream s =
fs.create(new Path(rootdir, HConstants.VERSION_FILE_NAME));
s.writeUTF(version);
s.close();
LOG.debug("Created version file at " + rootdir.toString() +
" set its version at:" + version);
return;
} catch (IOException e) {
if (wait > 0) {
LOG.warn("Unable to create version file at " + rootdir.toString() +
", retrying: " + StringUtils.stringifyException(e));
try {
Thread.sleep(wait);
} catch (InterruptedException ex) {
// ignore
Path versionFile = new Path(rootdir, HConstants.VERSION_FILE_NAME);
while (true) {
try {
FSDataOutputStream s = fs.create(versionFile);
s.writeUTF(version);
LOG.debug("Created version file at " + rootdir.toString() +
" set its version at:" + version);
s.close();
return;
} catch (IOException e) {
if (wait > 0) {
LOG.warn("Unable to create version file at " + rootdir.toString() +
", retrying: " + e.getMessage());
fs.delete(versionFile, false);
try {
Thread.sleep(wait);
} catch (InterruptedException ex) {
// ignore
}
}
} else {
// rethrow
throw e;
}
}
}