Skip to content

Commit

Permalink
add function
Browse files Browse the repository at this point in the history
  • Loading branch information
guohao-rosicky committed Nov 8, 2023
1 parent 2e6732b commit c5fef92
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,8 @@ public static void loadAllHddsVolumeDbStore(MutableVolumeSet hddsVolumeSet,
hddsVolumeSet.getVolumesList());
long start = System.currentTimeMillis();
for (HddsVolume volume : hddsVolumes) {
futures.add(CompletableFuture.runAsync(() -> {
try {
volume.loadDbStore(readOnly);
} catch (IOException e) {
onFailure(volume);
if (logger != null) {
logger.error("Load db store for HddsVolume {} failed",
volume.getStorageDir().getAbsolutePath(), e);
}
}
}));
futures.add(CompletableFuture.runAsync(
() -> loadVolume(volume, readOnly, logger)));
}
for (CompletableFuture<Void> future : futures) {
future.join();
Expand All @@ -114,6 +105,19 @@ public static void loadAllHddsVolumeDbStore(MutableVolumeSet hddsVolumeSet,
}
}

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);
}
}
}

private static void mapDbVolumesToDataVolumesIfNeeded(
MutableVolumeSet hddsVolumeSet, MutableVolumeSet dbVolumeSet) {
if (dbVolumeSet == null || dbVolumeSet.getVolumesList().isEmpty()) {
Expand Down

0 comments on commit c5fef92

Please sign in to comment.