prashantpogde commented on a change in pull request #1720:
URL: https://github.com/apache/ozone/pull/1720#discussion_r551474954
##########
File path:
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/upgrade/DataNodeLayoutVersionManager.java
##########
@@ -69,41 +58,15 @@ public static synchronized LayoutVersionManager
getInstance() {
/**
* Initialize DataNode version manager from version file stored on the
* DataNode.
- * @param conf - Ozone Configuration
+ * @param dataNodeStorage - DataNode storage config
* @return version manager instance.
*/
+
public static synchronized DataNodeLayoutVersionManager initialize(
- ConfigurationSource conf)
- throws IOException {
+ Storage dataNodeStorage) throws IOException {
if (dataNodeLayoutVersionManager == null) {
dataNodeLayoutVersionManager = new DataNodeLayoutVersionManager();
- int layoutVersion = 0;
- Collection<String> rawLocations = getDatanodeStorageDirs(conf);
- for (String locationString : rawLocations) {
- StorageLocation location = StorageLocation.parse(locationString);
- File hddsRootDir = new File(location.getUri().getPath(),
- HDDS_VOLUME_DIR);
- // Read the version from VersionFile Stored on the data node.
- File versionFile = HddsVolumeUtil.getVersionFile(hddsRootDir);
- if (!versionFile.exists()) {
- // Volume Root is non empty but VERSION file does not exist.
- LOG.warn("VERSION file does not exist in volume {},"
- + " current volume state: {}.",
- hddsRootDir.getPath(), HddsVolume.VolumeState.INCONSISTENT);
- continue;
- } else {
- LOG.debug("Reading version file {} from disk.", versionFile);
- }
- Properties props = DatanodeVersionFile.readFrom(versionFile);
- if (props.isEmpty()) {
- continue;
- }
- int storedVersion = HddsVolumeUtil.getLayOutVersion(props,
versionFile);
- if (storedVersion > layoutVersion) {
- layoutVersion = storedVersion;
- }
- }
- dataNodeLayoutVersionManager.init(layoutVersion,
+ dataNodeLayoutVersionManager.init(dataNodeStorage.getLayoutVersion(),
Review comment:
As discussed in the last call. Let us keep it as it can be used to test
the upgrade feature itself when we role out this feature. It would be a self
validating upgrade.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]