Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public BackgroundTaskResult call() throws Exception {
dbName, true);
RocksDatabase db = rdbStore.getDb();
db.deleteFilesNotMatchingPrefix(prefixPairs, filterFunction);
rdbStore.close();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use try-with-resources to ensure close happens even in face of exceptions.

          try (RDBStore rdbStore = (RDBStore) OmMetadataManagerImpl
              .loadDB(ozoneManager.getConfiguration(), new File(snapshotDir),
                  dbName, true)) {
            RocksDatabase db = rdbStore.getDb();
            db.deleteFilesNotMatchingPrefix(prefixPairs, filterFunction);
          }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. @DaveTeng0 Would you post another PR to address this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! yeah i'll do that!


// mark the snapshot as filtered by writing to the file
String content = snapshotInfo.getSnapshotID() + "\n";
Expand Down