Bugfixes
This commit is contained in:
parent
654a62d7b8
commit
88a1add102
@ -938,8 +938,8 @@ public sealed abstract class AbstractRocksDBColumn<T extends RocksDB> implements
|
||||
return newData;
|
||||
}
|
||||
|
||||
protected int getLastLevel() {
|
||||
return RocksDBUtils.getLastLevel(db, cfh);
|
||||
protected int getLevels() {
|
||||
return RocksDBUtils.getLevels(db, cfh);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -270,9 +270,9 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
|
||||
.map(v -> v.compression().getType())
|
||||
.toList());
|
||||
} else {
|
||||
columnFamilyOptions.setNumLevels(6);
|
||||
List<CompressionType> compressionTypes = new ArrayList<>(6);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
columnFamilyOptions.setNumLevels(7);
|
||||
List<CompressionType> compressionTypes = new ArrayList<>(7);
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (i < 2) {
|
||||
compressionTypes.add(CompressionType.NO_COMPRESSION);
|
||||
} else {
|
||||
@ -561,17 +561,8 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
|
||||
return paths.size() - 1;
|
||||
}
|
||||
|
||||
public int getLastLevel(Column column) {
|
||||
return databaseOptions
|
||||
.columnOptions()
|
||||
.stream()
|
||||
.filter(namedColumnOptions -> namedColumnOptions.columnName().equals(column.name()))
|
||||
.findFirst()
|
||||
.map(NamedColumnOptions::levels)
|
||||
.filter(levels -> !levels.isEmpty())
|
||||
.or(() -> Optional.of(databaseOptions.defaultColumnOptions().levels()).filter(levels -> !levels.isEmpty()))
|
||||
.map(List::size)
|
||||
.orElse(6);
|
||||
public int getLevels(Column column) {
|
||||
return RocksDBUtils.getLevels(db, handles.get(column));
|
||||
}
|
||||
|
||||
public List<String> getColumnFiles(Column column, boolean excludeLastLevel) {
|
||||
|
@ -21,21 +21,16 @@ import reactor.core.scheduler.Schedulers;
|
||||
|
||||
public class RocksDBUtils {
|
||||
|
||||
public static int getLastLevel(RocksDB db, ColumnFamilyHandle cfh) {
|
||||
var lastLevel = db.numberLevels(cfh);
|
||||
if (lastLevel == 0) {
|
||||
return 6;
|
||||
} else {
|
||||
return lastLevel;
|
||||
}
|
||||
public static int getLevels(RocksDB db, ColumnFamilyHandle cfh) {
|
||||
return db.numberLevels(cfh);
|
||||
}
|
||||
|
||||
public static List<String> getColumnFiles(RocksDB db, ColumnFamilyHandle cfh, boolean excludeLastLevel) {
|
||||
List<String> files = new ArrayList<>();
|
||||
var meta = db.getColumnFamilyMetaData(cfh);
|
||||
var lastLevel = excludeLastLevel ? getLastLevel(db, cfh) : -1;
|
||||
var lastLevelId = excludeLastLevel ? (getLevels(db, cfh) - 1) : -1;
|
||||
for (LevelMetaData level : meta.levels()) {
|
||||
if (!excludeLastLevel || level.level() < lastLevel) {
|
||||
if (!excludeLastLevel || level.level() < lastLevelId) {
|
||||
for (SstFileMetaData file : level.files()) {
|
||||
if (file.fileName().endsWith(".sst")) {
|
||||
files.add(file.fileName());
|
||||
@ -65,23 +60,23 @@ public class RocksDBUtils {
|
||||
} else {
|
||||
partitions = List.of(filesToCompact);
|
||||
}
|
||||
int finalBottommostLevel = getLastLevel(db, cfh);
|
||||
int finalBottommostLevelId = getLevels(db, cfh) - 1;
|
||||
Mono.whenDelayError(partitions.stream().map(partition -> Mono.<Void>fromCallable(() -> {
|
||||
logger.info("Compacting {} files in database {} in column family {} to level {}",
|
||||
partition.size(),
|
||||
logDbName,
|
||||
new String(cfh.getName(), StandardCharsets.UTF_8),
|
||||
finalBottommostLevel
|
||||
finalBottommostLevelId
|
||||
);
|
||||
if (!partition.isEmpty()) {
|
||||
var coi = new CompactionJobInfo();
|
||||
try {
|
||||
db.compactFiles(co, cfh, partition, finalBottommostLevel, volumeId, coi);
|
||||
db.compactFiles(co, cfh, partition, finalBottommostLevelId, volumeId, coi);
|
||||
logger.info("Compacted {} files in database {} in column family {} to level {}: {}",
|
||||
partition.size(),
|
||||
logDbName,
|
||||
new String(cfh.getName(), StandardCharsets.UTF_8),
|
||||
finalBottommostLevel,
|
||||
finalBottommostLevelId,
|
||||
coi.status().getCodeString()
|
||||
);
|
||||
} catch (Throwable ex) {
|
||||
@ -89,7 +84,7 @@ public class RocksDBUtils {
|
||||
partition.size(),
|
||||
logDbName,
|
||||
new String(cfh.getName(), StandardCharsets.UTF_8),
|
||||
finalBottommostLevel,
|
||||
finalBottommostLevelId,
|
||||
ex
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user