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 @@ -19,6 +19,7 @@
package org.apache.flink.state.rocksdb.sstmerge;

import org.rocksdb.ColumnFamilyHandle;
import org.rocksdb.ColumnFamilyOptions;
import org.rocksdb.CompactionJobInfo;
import org.rocksdb.CompactionOptions;
import org.rocksdb.RocksDB;
Expand Down Expand Up @@ -51,7 +52,13 @@ public Compactor(CompactionTarget target, long targetOutputFileSize) {
}

void compact(ColumnFamilyHandle cfName, int level, List<String> files) throws RocksDBException {
int outputLevel = Math.min(level + 1, cfName.getDescriptor().getOptions().numLevels() - 1);
// FLINK-39753: getDescriptor() allocates a new native ColumnFamilyOptions on every call.
// Closing it is required to release the native object and its reference to the shared
// block cache; leaking it keeps the LRUCache alive and grows native memory until OOM.
final int outputLevel;
try (ColumnFamilyOptions cfOptions = cfName.getDescriptor().getOptions()) {
Comment thread
leekeiabstraction marked this conversation as resolved.
outputLevel = Math.min(level + 1, cfOptions.numLevels() - 1);
}
LOG.debug(
"Manually compacting {} files from level {} to {}: {}",
files.size(),
Expand Down