hemantk-12 commented on code in PR #5555:
URL: https://github.com/apache/ozone/pull/5555#discussion_r1385751153
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/HddsVolumeUtil.java:
##########
@@ -86,17 +88,29 @@ public static void
loadAllHddsVolumeDbStore(MutableVolumeSet hddsVolumeSet,
// between each HddsVolume -> DbVolume.
mapDbVolumesToDataVolumesIfNeeded(hddsVolumeSet, dbVolumeSet);
- for (HddsVolume volume : StorageVolumeUtil.getHddsVolumesList(
- hddsVolumeSet.getVolumesList())) {
- try {
- volume.loadDbStore(readOnly);
- } catch (IOException e) {
- onFailure(volume);
- if (logger != null) {
- logger.error("Load db store for HddsVolume {} failed",
- volume.getStorageDir().getAbsolutePath(), e);
+ List<CompletableFuture<Void>> futures = new ArrayList<>();
+ List<HddsVolume> hddsVolumes = StorageVolumeUtil.getHddsVolumesList(
+ hddsVolumeSet.getVolumesList());
+ long start = System.currentTimeMillis();
+ for (HddsVolume volume : hddsVolumes) {
+ futures.add(CompletableFuture.runAsync(() -> {
+ try {
Review Comment:
nit: it would be better if you extract out this try/catch to helper
function. Will remove too nesting.
```
private static void loadVolume(HddsVolume volume, boolean readOnly,
Logger logger) {
try {
volume.loadDbStore(readOnly);
} catch (IOException e) {
onFailure(volume);
if (logger != null) {
logger.error("Load db store for HddsVolume {} failed",
volume.getStorageDir().getAbsolutePath(), e);
}
}
}
```
--
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]