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 HBASE-3781 hbase shell cannot start "NoMethodError: undefined method
`close' for nil:NilClass" (Mikael Sitruk) `close' for nil:NilClass" (Mikael Sitruk)
HBASE-3802 Redundant list creation in HRegion HBASE-3802 Redundant list creation in HRegion
HBASE-3800 HMaster is not able to start due to AlreadyCreatedException
IMPROVEMENTS IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack) 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, public static void setVersion(FileSystem fs, Path rootdir, String version,
int wait) throws IOException { int wait) throws IOException {
while (true) try { Path versionFile = new Path(rootdir, HConstants.VERSION_FILE_NAME);
FSDataOutputStream s = while (true) {
fs.create(new Path(rootdir, HConstants.VERSION_FILE_NAME)); try {
FSDataOutputStream s = fs.create(versionFile);
s.writeUTF(version); s.writeUTF(version);
s.close();
LOG.debug("Created version file at " + rootdir.toString() + LOG.debug("Created version file at " + rootdir.toString() +
" set its version at:" + version); " set its version at:" + version);
s.close();
return; return;
} catch (IOException e) { } catch (IOException e) {
if (wait > 0) { if (wait > 0) {
LOG.warn("Unable to create version file at " + rootdir.toString() + LOG.warn("Unable to create version file at " + rootdir.toString() +
", retrying: " + StringUtils.stringifyException(e)); ", retrying: " + e.getMessage());
fs.delete(versionFile, false);
try { try {
Thread.sleep(wait); Thread.sleep(wait);
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
// ignore // ignore
} }
} else { }
// rethrow
throw e;
} }
} }
} }