Skip to content
Merged
Show file tree
Hide file tree
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 @@ -217,6 +217,9 @@ public OmSnapshotManager(OzoneManager ozoneManager) {
OZONE_OM_SNAPSHOT_DB_MAX_OPEN_FILES,
OZONE_OM_SNAPSHOT_DB_MAX_OPEN_FILES_DEFAULT
);
Preconditions.checkArgument(this.maxOpenSstFilesInSnapshotDb > 0,
Copy link
Contributor

@swamirishi swamirishi Jul 17, 2025

Choose a reason for hiding this comment

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

@jojochuang even 0 & -1 should be allowed. Rocksdb allows these values.
-1: Use unlimited number of open files (not recommended unless you manage file descriptors externally).

0: RocksDB will open file descriptors on demand, and cache only a small number (like table readers) — suitable for low file descriptor environments.

Greater than 0: RocksDB will keep up to this number of files open at once. The typical value is in the hundreds or thousands, depending on your OS limits.

OZONE_OM_SNAPSHOT_DB_MAX_OPEN_FILES + " must be positive.");

ColumnFamilyHandle snapDiffJobCf;
ColumnFamilyHandle snapDiffReportCf;
ColumnFamilyHandle snapDiffPurgedJobCf;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,4 +749,14 @@ private SnapshotInfo createSnapshotInfo(String volumeName,
UUID.randomUUID(),
Time.now());
}

@Test
void testNegativeMaxOpenFiles(@TempDir File tempDir) throws Exception {
OzoneConfiguration conf = new OzoneConfiguration();
conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempDir.getAbsolutePath());
conf.setInt(OMConfigKeys.OZONE_OM_SNAPSHOT_DB_MAX_OPEN_FILES, 0);
conf.setBoolean(OMConfigKeys.OZONE_FILESYSTEM_SNAPSHOT_ENABLED_KEY, true);

assertThrows(IllegalArgumentException.class, () -> new OmTestManagers(conf));
}
}