-
Notifications
You must be signed in to change notification settings - Fork 621
HDDS-6541. [Merge rocksdb in datanode] Per-disk DB location management. #3292
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 4 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
58f8351
Add necessary LayoutFeature utils so as to init per-disk db instances…
f0be606
Define new DbVolume for optional dedicated volumes for db instances.
3ce72b8
DB instance format and load for HddsVolume.
6d8273f
Fix TestDatanodeUpgradeToScmHA.
9e4d34c
Fix acceptance test of non-rolling-upgrade.
c0a20d9
Refine the description of a new config item.
dabeb10
Shutdown dbVolumeSet and add dbVolume info to node reports.
4fb9a97
Add VERSION file for DbVolume and refactor db instance create & load …
dd1c2a3
Add a config switch for schema v3 and a helper function.
3e67e87
Add dedicated tests to verify that no odd db instance is created.
8d0ec74
Make chooseSchemaVersion use isFinalizedAndEnabled.
60924ee
Fix findbugs.
40a457b
Some renames.
57bb860
Log level warn -> error.
c976aa4
Check state NORMAL instead of clusterID.
b986c6e
DbVolume Set -> Map.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| package org.apache.hadoop.ozone.container.common.states.endpoint; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.concurrent.Callable; | ||
|
|
||
|
|
@@ -25,10 +26,13 @@ | |
| import org.apache.hadoop.ozone.OzoneConsts; | ||
| import org.apache.hadoop.ozone.container.common.statemachine.EndpointStateMachine; | ||
| import org.apache.hadoop.ozone.container.common.utils.HddsVolumeUtil; | ||
| import org.apache.hadoop.ozone.container.common.utils.StorageVolumeUtil; | ||
| import org.apache.hadoop.ozone.container.common.volume.DbVolume; | ||
| import org.apache.hadoop.ozone.container.common.volume.HddsVolume; | ||
| import org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet; | ||
| import org.apache.hadoop.ozone.container.common.volume.StorageVolume; | ||
| import org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer; | ||
| import org.apache.hadoop.ozone.container.upgrade.VersionedDatanodeFeatures; | ||
| import org.apache.hadoop.ozone.protocol.VersionResponse; | ||
| import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; | ||
|
|
||
|
|
@@ -78,24 +82,27 @@ public EndpointStateMachine.EndPointStates call() throws Exception { | |
| String scmId = response.getValue(OzoneConsts.SCM_ID); | ||
| String clusterId = response.getValue(OzoneConsts.CLUSTER_ID); | ||
|
|
||
| Preconditions.checkNotNull(scmId, | ||
| "Reply from SCM: scmId cannot be null"); | ||
| Preconditions.checkNotNull(clusterId, | ||
| "Reply from SCM: clusterId cannot be null"); | ||
|
|
||
| formatDbVolumesIfNeeded(scmId, clusterId); | ||
|
|
||
| // Check volumes | ||
| MutableVolumeSet volumeSet = ozoneContainer.getVolumeSet(); | ||
| volumeSet.writeLock(); | ||
| try { | ||
| Map<String, StorageVolume> volumeMap = volumeSet.getVolumeMap(); | ||
|
|
||
| Preconditions.checkNotNull(scmId, | ||
| "Reply from SCM: scmId cannot be null"); | ||
| Preconditions.checkNotNull(clusterId, | ||
| "Reply from SCM: clusterId cannot be null"); | ||
|
|
||
| // If version file does not exist | ||
| // create version file and also set scm ID or cluster ID. | ||
| for (Map.Entry<String, StorageVolume> entry | ||
| : volumeMap.entrySet()) { | ||
| StorageVolume volume = entry.getValue(); | ||
| boolean result = HddsVolumeUtil.checkVolume((HddsVolume) volume, | ||
| scmId, clusterId, configuration, LOG); | ||
| scmId, clusterId, configuration, LOG, | ||
| ozoneContainer.getDbVolumeSet()); | ||
| if (!result) { | ||
| volumeSet.failVolume(volume.getStorageDir().getPath()); | ||
| } | ||
|
|
@@ -129,4 +136,31 @@ public EndpointStateMachine.EndPointStates call() throws Exception { | |
| } | ||
| return rpcEndPoint.getState(); | ||
| } | ||
|
|
||
| private void formatDbVolumesIfNeeded(String scmId, String clusterId) { | ||
| if (!VersionedDatanodeFeatures.SchemaV3.chooseSchemaVersion() | ||
| .equals(OzoneConsts.SCHEMA_V3)) { | ||
| return; | ||
| } | ||
|
|
||
| MutableVolumeSet dbVolumeSet = ozoneContainer.getDbVolumeSet(); | ||
|
|
||
| if (dbVolumeSet != null) { | ||
| dbVolumeSet.writeLock(); | ||
| try { | ||
| List<DbVolume> dbVolumeList = StorageVolumeUtil | ||
| .getDbVolumesList(dbVolumeSet.getVolumesList()); | ||
|
|
||
| dbVolumeList.parallelStream().forEach(dbVolume -> { | ||
| String id = VersionedDatanodeFeatures.ScmHA | ||
| .chooseContainerPathID(configuration, scmId, clusterId); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this statement out of the stream.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, makes sense. |
||
| if (!dbVolume.format(id)) { | ||
| dbVolumeSet.failVolume(dbVolume.getStorageDir().getPath()); | ||
| } | ||
| }); | ||
| } finally { | ||
| dbVolumeSet.writeUnlock(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Defaults to empty if not specified -> This setting is optional. If unspecified