HDFS-7042. Upgrade fails for Windows HA cluster due to file locks held during rename in JournalNode. Contributed by Chris Nauroth.

(cherry picked from commit 80ac6aabce)
This commit is contained in:
cnauroth 2014-09-11 12:16:19 -07:00
parent 6f8b2a8e2e
commit ac296f9522
3 changed files with 11 additions and 1 deletions

View File

@ -493,6 +493,9 @@ Release 2.6.0 - UNRELEASED
HDFS-6776. Using distcp to copy data between insecure and secure cluster via webdhfs
doesn't work. (yzhangal via tucu)
HDFS-7042. Upgrade fails for Windows HA cluster due to file locks held during
rename in JournalNode. (cnauroth)
Release 2.5.1 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -994,6 +994,9 @@ public class Journal implements Closeable {
}
public synchronized void doPreUpgrade() throws IOException {
// Do not hold file lock on committedTxnId, because the containing
// directory will be renamed. It will be reopened lazily on next access.
committedTxnId.close();
storage.getJournalManager().doPreUpgrade();
}
@ -1043,7 +1046,10 @@ public class Journal implements Closeable {
targetLayoutVersion);
}
public void doRollback() throws IOException {
public synchronized void doRollback() throws IOException {
// Do not hold file lock on committedTxnId, because the containing
// directory will be renamed. It will be reopened lazily on next access.
committedTxnId.close();
storage.getJournalManager().doRollback();
}

View File

@ -112,6 +112,7 @@ public class BestEffortLongFile implements Closeable {
public void close() throws IOException {
if (ch != null) {
ch.close();
ch = null;
}
}
}