smengcl commented on code in PR #4692:
URL: https://github.com/apache/ozone/pull/4692#discussion_r1190332922
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -372,22 +372,28 @@ private OmMetadataManagerImpl(OzoneConfiguration conf,
File dir, String name)
// metadata constructor for snapshots
OmMetadataManagerImpl(OzoneConfiguration conf, String snapshotDirName,
boolean isSnapshotInCache) throws IOException {
- lock = new OmReadOnlyLock();
- omEpoch = 0;
- String snapshotDir = OMStorage.getOmDbDir(conf) +
- OM_KEY_PREFIX + OM_SNAPSHOT_CHECKPOINT_DIR;
- File metaDir = new File(snapshotDir);
- String dbName = OM_DB_NAME + snapshotDirName;
- // The check is only to prevent every snapshot read to perform a disk IO
- // and check if a checkpoint dir exists. If entry is present in cache,
- // it is most likely DB entries will get flushed in this wait time.
- if (isSnapshotInCache) {
- File checkpoint = Paths.get(metaDir.toPath().toString(),
dbName).toFile();
- RDBCheckpointUtils.waitForCheckpointDirectoryExist(checkpoint);
+ try {
+ lock = new OmReadOnlyLock();
+ omEpoch = 0;
+ String snapshotDir = OMStorage.getOmDbDir(conf) +
+ OM_KEY_PREFIX + OM_SNAPSHOT_CHECKPOINT_DIR;
+ File metaDir = new File(snapshotDir);
+ String dbName = OM_DB_NAME + snapshotDirName;
+ // The check is only to prevent every snapshot read to perform a disk IO
+ // and check if a checkpoint dir exists. If entry is present in cache,
+ // it is most likely DB entries will get flushed in this wait time.
+ if (isSnapshotInCache) {
+ File checkpoint =
+ Paths.get(metaDir.toPath().toString(), dbName).toFile();
+ RDBCheckpointUtils.waitForCheckpointDirectoryExist(checkpoint);
+ }
+ setStore(loadDB(conf, metaDir, dbName, false,
+ java.util.Optional.of(Boolean.TRUE), false));
+ initializeOmTables(false);
+ } catch (Exception e) {
+ stop();
+ throw new IOException(e.getCause());
Review Comment:
Just wrap and throw the whole exception?
```suggestion
throw new IOException(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]