HDFS-7894. Rolling upgrade readiness is not updated in jmx until query command is issued. Contributed by Brahma Reddy Battula.

(cherry picked from commit 6f622672b6)
This commit is contained in:
Kihwal Lee 2015-05-08 09:32:44 -05:00
parent 1b95bf9e1b
commit bbb9f6aafe
2 changed files with 24 additions and 2 deletions

View File

@ -70,6 +70,9 @@ Release 2.7.1 - UNRELEASED
HDFS-8226. Non-HA rollback compatibility broken (J.Andreina via vinayakumarb)
HDFS-7894. Rolling upgrade readiness is not updated in jmx until query
command is issued. (Brahma Reddy Battula via kihwal)
Release 2.7.0 - 2015-04-20
INCOMPATIBLE CHANGES

View File

@ -7612,12 +7612,31 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
@Override // NameNodeMXBean
public RollingUpgradeInfo.Bean getRollingUpgradeStatus() {
if (!isRollingUpgrade()) {
return null;
}
RollingUpgradeInfo upgradeInfo = getRollingUpgradeInfo();
if (upgradeInfo != null) {
if (upgradeInfo.createdRollbackImages()) {
return new RollingUpgradeInfo.Bean(upgradeInfo);
}
readLock();
try {
// check again after acquiring the read lock.
upgradeInfo = getRollingUpgradeInfo();
if (upgradeInfo == null) {
return null;
}
if (!upgradeInfo.createdRollbackImages()) {
boolean hasRollbackImage = this.getFSImage().hasRollbackFSImage();
upgradeInfo.setCreatedRollbackImages(hasRollbackImage);
}
} catch (IOException ioe) {
LOG.warn("Encountered exception setting Rollback Image", ioe);
} finally {
readUnlock();
}
return new RollingUpgradeInfo.Bean(upgradeInfo);
}
/** Is rolling upgrade in progress? */
public boolean isRollingUpgrade() {