sumitagrawl commented on code in PR #6113:
URL: https://github.com/apache/ozone/pull/6113#discussion_r1470959503
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/HddsVolume.java:
##########
@@ -343,35 +357,41 @@ public void loadDbStore(boolean readOnly) throws
IOException {
File clusterIdDir = new File(dbVolume == null ?
getStorageDir() : dbVolume.getStorageDir(),
getClusterID());
- if (!clusterIdDir.exists()) {
- throw new IOException("Working dir " + clusterIdDir.getAbsolutePath() +
- " not created for HddsVolume: " + getStorageDir().getAbsolutePath());
- }
+ try {
+ if (!clusterIdDir.exists()) {
+ throw new IOException("Working dir " + clusterIdDir.getAbsolutePath() +
+ " not created for HddsVolume: " +
getStorageDir().getAbsolutePath());
+ }
- File storageIdDir = new File(clusterIdDir, getStorageID());
- if (!storageIdDir.exists()) {
- throw new IOException("Db parent dir " + storageIdDir.getAbsolutePath() +
- " not found for HddsVolume: " + getStorageDir().getAbsolutePath());
- }
+ File storageIdDir = new File(clusterIdDir, getStorageID());
+ if (!storageIdDir.exists()) {
+ throw new IOException("Db parent dir " +
storageIdDir.getAbsolutePath() +
+ " not found for HddsVolume: " + getStorageDir().getAbsolutePath());
+ }
- File containerDBFile = new File(storageIdDir, CONTAINER_DB_NAME);
- if (!containerDBFile.exists()) {
- throw new IOException("Db dir " + storageIdDir.getAbsolutePath() +
- " not found for HddsVolume: " + getStorageDir().getAbsolutePath());
- }
+ File containerDBFile = new File(storageIdDir, CONTAINER_DB_NAME);
+ if (!containerDBFile.exists()) {
+ throw new IOException("Db dir " + storageIdDir.getAbsolutePath() +
+ " not found for HddsVolume: " + getStorageDir().getAbsolutePath());
+ }
- String containerDBPath = containerDBFile.getAbsolutePath();
- try {
- initPerDiskDBStore(containerDBPath, getConf(), readOnly);
+ String containerDBPath = containerDBFile.getAbsolutePath();
+ try {
+ initPerDiskDBStore(containerDBPath, getConf(), readOnly);
+ } catch (IOException e) {
+ throw new IOException("Can't init db instance under path "
+ + containerDBPath + " for volume " + getStorageID(), e);
+ }
+
+ dbParentDir = storageIdDir;
+ dbLoaded.set(true);
+ dbLoadFailure.set(false);
+ LOG.info("SchemaV3 db is loaded at {} for volume {}", containerDBPath,
+ getStorageID());
} catch (IOException e) {
- throw new IOException("Can't init db instance under path "
- + containerDBPath + " for volume " + getStorageID(), e);
+ dbLoadFailure.set(true);
Review Comment:
I have observed another impact when volume metadata path is `removed
incorrectly in test env`. But at that point of time, container was getting
loaded having NPE in other flow.
NPE was handled with https://github.com/apache/ozone/pull/5921 avoiding
loading of container.
Since it was test script issue where cleanup was not proper, referring
similar case.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]