Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
Signed-off-by: Ameziane H. <[email protected]>
  • Loading branch information
ahamlat committed Dec 17, 2024
1 parent 52446c4 commit 7e944b9
Showing 1 changed file with 31 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,14 @@ public RocksDBColumnarKeyValueStorage(
.forEach(trimmedSegments::remove);
columnDescriptors =
trimmedSegments.stream()
.map(segment -> {
try {
.map(
segment -> {
try {
return createColumnDescriptor(segment, configuration);
} catch (RocksDBException e) {
} catch (RocksDBException e) {
throw new RuntimeException(e);
}
})
}
})
.collect(Collectors.toList());

setGlobalOptions(configuration, stats);
Expand All @@ -190,41 +191,46 @@ public RocksDBColumnarKeyValueStorage(
* @return a column family descriptor
*/
private ColumnFamilyDescriptor createColumnDescriptor(
final SegmentIdentifier segment, final RocksDBConfiguration configuration) throws RocksDBException {
final SegmentIdentifier segment, final RocksDBConfiguration configuration)
throws RocksDBException {

ConfigOptions configOptions = new ConfigOptions();
DBOptions dbOptions = new DBOptions();
List<ColumnFamilyDescriptor> cfDescriptors = new ArrayList<>();

String latestOptionsFileName = OptionsUtil.getLatestOptionsFileName(configuration.getDatabaseDir().toString(), Env.getDefault());
LOG.trace("Latest OPTIONS file detected: " + latestOptionsFileName);
String latestOptionsFileName =
OptionsUtil.getLatestOptionsFileName(
configuration.getDatabaseDir().toString(), Env.getDefault());
LOG.trace("Latest OPTIONS file detected: " + latestOptionsFileName);

String optionsFilePath = configuration.getDatabaseDir().toString() + "/" + latestOptionsFileName;
OptionsUtil.loadOptionsFromFile(configOptions, optionsFilePath, dbOptions, cfDescriptors);
String optionsFilePath =
configuration.getDatabaseDir().toString() + "/" + latestOptionsFileName;
OptionsUtil.loadOptionsFromFile(configOptions, optionsFilePath, dbOptions, cfDescriptors);

LOG.trace("RocksDB options loaded successfully from: " + optionsFilePath);
LOG.trace("RocksDB options loaded successfully from: " + optionsFilePath);

boolean dynamicLevelBytes = true;
if (!cfDescriptors.isEmpty()) {
Optional<ColumnFamilyOptions> matchedCfOptions = Optional.empty();
for (ColumnFamilyDescriptor descriptor : cfDescriptors) {
if (Arrays.equals(descriptor.getName(), segment.getId())) {
matchedCfOptions = Optional.of(descriptor.getOptions());
break;
}
boolean dynamicLevelBytes = true;
if (!cfDescriptors.isEmpty()) {
Optional<ColumnFamilyOptions> matchedCfOptions = Optional.empty();
for (ColumnFamilyDescriptor descriptor : cfDescriptors) {
if (Arrays.equals(descriptor.getName(), segment.getId())) {
matchedCfOptions = Optional.of(descriptor.getOptions());
break;
}
if (matchedCfOptions.isPresent()) {
dynamicLevelBytes = matchedCfOptions.get().levelCompactionDynamicLevelBytes();
LOG.trace("dynamicLevelBytes is set to an existing value : " + dynamicLevelBytes);
}
}
BlockBasedTableConfig basedTableConfig = createBlockBasedTableConfig(segment, configuration);
if (matchedCfOptions.isPresent()) {
dynamicLevelBytes = matchedCfOptions.get().levelCompactionDynamicLevelBytes();
LOG.trace("dynamicLevelBytes is set to an existing value : " + dynamicLevelBytes);
}
}
BlockBasedTableConfig basedTableConfig = createBlockBasedTableConfig(segment, configuration);

final var options =
new ColumnFamilyOptions()
.setTtl(0)
.setCompressionType(CompressionType.LZ4_COMPRESSION)
.setTableFormatConfig(basedTableConfig).setLevelCompactionDynamicLevelBytes(dynamicLevelBytes);
.setTableFormatConfig(basedTableConfig)
.setLevelCompactionDynamicLevelBytes(dynamicLevelBytes);
if (segment.containsStaticData()) {
options
.setEnableBlobFiles(true)
Expand Down

0 comments on commit 7e944b9

Please sign in to comment.