Skip to content

Commit d7f6943

Browse files
author
Danny Becker
committed
Address comments
1 parent 04a35a2 commit d7f6943

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolTranslatorPB.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,10 @@ public long getMostRecentCheckpointTxId() throws IOException {
138138

139139
@Override
140140
public long getMostRecentNameNodeFileTxId(NNStorage.NameNodeFile nnf) throws IOException {
141-
try {
142-
return rpcProxy.getMostRecentNameNodeFileTxId(NULL_CONTROLLER,
143-
GetMostRecentNameNodeFileTxIdRequestProto.newBuilder()
144-
.setNameNodeFile(nnf.toString()).build()).getTxId();
145-
} catch (ServiceException e) {
146-
throw ProtobufHelper.getRemoteException(e);
147-
}
141+
return rpcProxy.getMostRecentNameNodeFileTxId(NULL_CONTROLLER,
142+
GetMostRecentNameNodeFileTxIdRequestProto.newBuilder()
143+
.setNameNodeFile(nnf.toString()).build()).getTxId();
144+
148145
}
149146

150147
@Override

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/FSImageTestUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,11 @@ public static void assertNNHasRollbackCheckpoints(MiniDFSCluster cluster,
523523
int nnIdx, List<Integer> txids) {
524524

525525
for (File nameDir : getNameNodeCurrentDirs(cluster, nnIdx)) {
526-
LOG.info("examining name dir with files: " +
526+
LOG.info("examining name dir with files: {}",
527527
Joiner.on(",").join(nameDir.listFiles()));
528528
// Should have fsimage_N for the three checkpoints
529-
LOG.info("Examining storage dir " + nameDir + " with contents: "
530-
+ StringUtils.join(nameDir.listFiles(), ", "));
529+
LOG.info("Examining storage dir {} with contents: {}", nameDir,
530+
StringUtils.join(nameDir.listFiles(), ", "));
531531
for (long checkpointTxId : txids) {
532532
File image = new File(nameDir,
533533
NNStorage.getRollbackImageFileName(checkpointTxId));

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestBootstrapStandby.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.apache.hadoop.hdfs.server.namenode.FSImage;
4242
import org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion;
4343
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
44+
import org.apache.hadoop.test.LambdaTestUtils;
4445
import org.slf4j.Logger;
4546
import org.slf4j.LoggerFactory;
4647
import org.apache.hadoop.conf.Configuration;
@@ -216,11 +217,8 @@ public void testRollingUpgradeBootstrapStandby() throws Exception {
216217

217218
// Start rolling upgrade
218219
fs.rollingUpgrade(RollingUpgradeAction.PREPARE);
219-
RollingUpgradeInfo info = fs.rollingUpgrade(RollingUpgradeAction.QUERY);
220-
while (!info.createdRollbackImages()) {
221-
Thread.sleep(1000);
222-
info = fs.rollingUpgrade(RollingUpgradeAction.QUERY);
223-
}
220+
LambdaTestUtils.await(60000, 1000, () ->
221+
fs.rollingUpgrade(RollingUpgradeAction.QUERY).createdRollbackImages());
224222
// After the rollback image is created the standby is not needed
225223
cluster.shutdownNameNode(1);
226224
removeStandbyNameDirs();
@@ -270,10 +268,11 @@ public void testRollingUpgradeBootstrapStandby() throws Exception {
270268
restartNameNodesFromIndex(1, "-rollingUpgrade", "started");
271269

272270
for (int i = 1; i < maxNNCount; i++) {
271+
NameNode nn = cluster.getNameNode(i);
273272
assertTrue("NameNodes should all have the rollback FSImage",
274-
cluster.getNameNode(i).getFSImage().hasRollbackFSImage());
273+
nn.getFSImage().hasRollbackFSImage());
275274
assertTrue("NameNodes should all be inRollingUpgrade",
276-
cluster.getNameNode(i).getNamesystem().isRollingUpgrade());
275+
nn.getNamesystem().isRollingUpgrade());
277276
}
278277

279278
// Cleanup standby dirs

0 commit comments

Comments
 (0)