Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ameziane H <[email protected]>
  • Loading branch information
ahamlat committed Jan 5, 2024
1 parent 0081a0d commit b6966ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ public RocksDBColumnarKeyValueStorage(
this.rocksDBMetricsFactory = rocksDBMetricsFactory;

try {
final ColumnFamilyOptions columnFamilyOptions = new ColumnFamilyOptions();
trimmedSegments = new ArrayList<>(defaultSegments);
final List<byte[]> existingColumnFamilies =
RocksDB.listColumnFamilies(new Options(), configuration.getDatabaseDir().toString());
Expand All @@ -162,15 +161,6 @@ public RocksDBColumnarKeyValueStorage(
trimmedSegments.stream()
.map(segment -> createColumnDescriptor(segment, configuration))
.collect(Collectors.toList());
columnDescriptors.add(
new ColumnFamilyDescriptor(
KeyValueSegmentIdentifier.DEFAULT.getId(),
columnFamilyOptions
.setTtl(0)
.setCompressionType(CompressionType.LZ4_COMPRESSION)
.setTableFormatConfig(
createBlockBasedTableConfig(
configuration, KeyValueSegmentIdentifier.DEFAULT))));

setGlobalOptions(configuration, stats);

Expand All @@ -192,7 +182,7 @@ public RocksDBColumnarKeyValueStorage(
private ColumnFamilyDescriptor createColumnDescriptor(
final SegmentIdentifier segment, final RocksDBConfiguration configuration) {

BlockBasedTableConfig basedTableConfig = createBlockBasedTableConfig(configuration, segment);
BlockBasedTableConfig basedTableConfig = createBlockBasedTableConfig(segment, configuration);

final var options =
new ColumnFamilyOptions()
Expand All @@ -219,12 +209,11 @@ private ColumnFamilyDescriptor createColumnDescriptor(
* Create a Block Base Table configuration for each segment, depending on the configuration in place
* and the segment itself
*
* @param config RocksDB configuration
* @param segment The segment related to the column family
* @param config RocksDB configuration
* @return Block Base Table configuration
*/
private BlockBasedTableConfig createBlockBasedTableConfig(
final RocksDBConfiguration config, final SegmentIdentifier segment) {
private BlockBasedTableConfig createBlockBasedTableConfig(final SegmentIdentifier segment, final RocksDBConfiguration config) {
final LRUCache cache =
new LRUCache(
config.isHighSpec() && segment.isEligibleToHighSpecFlag()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,20 +347,22 @@ public enum TestSegment implements SegmentIdentifier {
BAR(new byte[] {2}),
EXPERIMENTAL(new byte[] {3}),

STATIC_DATA(new byte[] {4}, true);
STATIC_DATA(new byte[] {4}, true, false);

private final byte[] id;
private final String nameAsUtf8;
private final boolean containsStaticData;
private final boolean eligibleToHighSpecFlag;

TestSegment(final byte[] id) {
this(id, false);
this(id, false, false);
}

TestSegment(final byte[] id, final boolean containsStaticData) {
TestSegment(final byte[] id, final boolean containsStaticData, final boolean eligibleToHighSpecFlag) {
this.id = id;
this.nameAsUtf8 = new String(id, StandardCharsets.UTF_8);
this.containsStaticData = containsStaticData;
this.eligibleToHighSpecFlag = eligibleToHighSpecFlag;
}

@Override
Expand All @@ -377,6 +379,13 @@ public byte[] getId() {
public boolean containsStaticData() {
return containsStaticData;
}

@Override
public boolean isEligibleToHighSpecFlag() {
return eligibleToHighSpecFlag;
}


}

protected abstract SegmentedKeyValueStorage createSegmentedStore() throws Exception;
Expand Down

0 comments on commit b6966ea

Please sign in to comment.