-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-17396. BootstrapStandby should download rollback image during RollingUpgrade #6583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4edd305
BootstrapStandby should download the rollback fsimage
04a35a2
Add check for invalid txid
d7f6943
Address comments
ed0d884
Add ipc() wrapper
bf017bf
Fix javadoc
2079744
Fix checkstyle
9db198c
Address javadoc and checkstyle
2cbf8b9
Fix javadoc link reference typo
3bcfed3
Fix checkstyle
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ | |
| import java.util.function.Supplier; | ||
| import org.apache.hadoop.hdfs.DistributedFileSystem; | ||
| import org.apache.hadoop.hdfs.protocol.HdfsConstants.RollingUpgradeAction; | ||
| import org.apache.hadoop.hdfs.protocol.RollingUpgradeInfo; | ||
| import org.apache.hadoop.hdfs.server.common.HttpGetFailedException; | ||
| import org.apache.hadoop.hdfs.server.namenode.FSImage; | ||
| import org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion; | ||
|
|
@@ -189,7 +190,8 @@ public void testDownloadingLaterCheckpoint() throws Exception { | |
| */ | ||
| @Test | ||
| public void testRollingUpgradeBootstrapStandby() throws Exception { | ||
| removeStandbyNameDirs(); | ||
| // This node is needed to create the rollback fsimage | ||
| cluster.restartNameNode(1); | ||
|
|
||
| int futureVersion = NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION - 1; | ||
|
|
||
|
|
@@ -208,12 +210,21 @@ public void testRollingUpgradeBootstrapStandby() throws Exception { | |
|
|
||
| // BootstrapStandby should fail if the node has a future version | ||
| // and the cluster isn't in rolling upgrade | ||
| bs.setConf(cluster.getConfiguration(1)); | ||
| bs.setConf(cluster.getConfiguration(2)); | ||
| assertEquals("BootstrapStandby should return ERR_CODE_INVALID_VERSION", | ||
| ERR_CODE_INVALID_VERSION, bs.run(new String[]{"-force"})); | ||
|
|
||
| // Start rolling upgrade | ||
| fs.rollingUpgrade(RollingUpgradeAction.PREPARE); | ||
| RollingUpgradeInfo info = fs.rollingUpgrade(RollingUpgradeAction.QUERY); | ||
| while (!info.createdRollbackImages()) { | ||
|
||
| Thread.sleep(1000); | ||
| info = fs.rollingUpgrade(RollingUpgradeAction.QUERY); | ||
| } | ||
| // After the rollback image is created the standby is not needed | ||
| cluster.shutdownNameNode(1); | ||
| removeStandbyNameDirs(); | ||
|
|
||
| nn0 = spy(nn0); | ||
|
|
||
| // Make nn0 think it is a future version | ||
|
|
@@ -237,6 +248,9 @@ public void testRollingUpgradeBootstrapStandby() throws Exception { | |
|
|
||
| long expectedCheckpointTxId = NameNodeAdapter.getNamesystem(nn0) | ||
| .getFSImage().getMostRecentCheckpointTxId(); | ||
| long expectedRollbackTxId = NameNodeAdapter.getNamesystem(nn0) | ||
| .getFSImage().getMostRecentNameNodeFileTxId( | ||
| NNStorage.NameNodeFile.IMAGE_ROLLBACK); | ||
| assertEquals(11, expectedCheckpointTxId); | ||
|
|
||
| for (int i = 1; i < maxNNCount; i++) { | ||
|
|
@@ -245,6 +259,8 @@ public void testRollingUpgradeBootstrapStandby() throws Exception { | |
| bs.run(new String[]{"-force"}); | ||
| FSImageTestUtil.assertNNHasCheckpoints(cluster, i, | ||
| ImmutableList.of((int) expectedCheckpointTxId)); | ||
| FSImageTestUtil.assertNNHasRollbackCheckpoints(cluster, i, | ||
| ImmutableList.of((int) expectedRollbackTxId)); | ||
| } | ||
|
|
||
| // Make sure the bootstrap was successful | ||
|
|
@@ -253,6 +269,13 @@ public void testRollingUpgradeBootstrapStandby() throws Exception { | |
| // We should now be able to start the standby successfully | ||
| restartNameNodesFromIndex(1, "-rollingUpgrade", "started"); | ||
|
|
||
| for (int i = 1; i < maxNNCount; i++) { | ||
| assertTrue("NameNodes should all have the rollback FSImage", | ||
| cluster.getNameNode(i).getFSImage().hasRollbackFSImage()); | ||
|
||
| assertTrue("NameNodes should all be inRollingUpgrade", | ||
| cluster.getNameNode(i).getNamesystem().isRollingUpgrade()); | ||
| } | ||
|
|
||
| // Cleanup standby dirs | ||
| for (int i = 1; i < maxNNCount; i++) { | ||
| cluster.shutdownNameNode(i); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the logger format?