|
|
@ -26,616 +26,386 @@ public class ColumnFamilyOptionsTest { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void getColumnFamilyOptionsFromProps() { |
|
|
|
public void getColumnFamilyOptionsFromProps() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
Properties properties = new Properties(); |
|
|
|
try { |
|
|
|
properties.put("write_buffer_size", "112"); |
|
|
|
|
|
|
|
properties.put("max_write_buffer_number", "13"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try (final ColumnFamilyOptions opt = ColumnFamilyOptions. |
|
|
|
|
|
|
|
getColumnFamilyOptionsFromProps(properties)) { |
|
|
|
// setup sample properties
|
|
|
|
// setup sample properties
|
|
|
|
Properties properties = new Properties(); |
|
|
|
|
|
|
|
properties.put("write_buffer_size", "112"); |
|
|
|
|
|
|
|
properties.put("max_write_buffer_number", "13"); |
|
|
|
|
|
|
|
opt = ColumnFamilyOptions. |
|
|
|
|
|
|
|
getColumnFamilyOptionsFromProps(properties); |
|
|
|
|
|
|
|
assertThat(opt).isNotNull(); |
|
|
|
assertThat(opt).isNotNull(); |
|
|
|
assertThat(String.valueOf(opt.writeBufferSize())). |
|
|
|
assertThat(String.valueOf(opt.writeBufferSize())). |
|
|
|
isEqualTo(properties.get("write_buffer_size")); |
|
|
|
isEqualTo(properties.get("write_buffer_size")); |
|
|
|
assertThat(String.valueOf(opt.maxWriteBufferNumber())). |
|
|
|
assertThat(String.valueOf(opt.maxWriteBufferNumber())). |
|
|
|
isEqualTo(properties.get("max_write_buffer_number")); |
|
|
|
isEqualTo(properties.get("max_write_buffer_number")); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void failColumnFamilyOptionsFromPropsWithIllegalValue() { |
|
|
|
public void failColumnFamilyOptionsFromPropsWithIllegalValue() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
// setup sample properties
|
|
|
|
try { |
|
|
|
final Properties properties = new Properties(); |
|
|
|
// setup sample properties
|
|
|
|
properties.put("tomato", "1024"); |
|
|
|
Properties properties = new Properties(); |
|
|
|
properties.put("burger", "2"); |
|
|
|
properties.put("tomato", "1024"); |
|
|
|
|
|
|
|
properties.put("burger", "2"); |
|
|
|
try (final ColumnFamilyOptions opt = |
|
|
|
opt = ColumnFamilyOptions. |
|
|
|
ColumnFamilyOptions.getColumnFamilyOptionsFromProps(properties)) { |
|
|
|
getColumnFamilyOptionsFromProps(properties); |
|
|
|
|
|
|
|
assertThat(opt).isNull(); |
|
|
|
assertThat(opt).isNull(); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
public void failColumnFamilyOptionsFromPropsWithNullValue() { |
|
|
|
public void failColumnFamilyOptionsFromPropsWithNullValue() { |
|
|
|
ColumnFamilyOptions.getColumnFamilyOptionsFromProps(null); |
|
|
|
try (final ColumnFamilyOptions opt = |
|
|
|
|
|
|
|
ColumnFamilyOptions.getColumnFamilyOptionsFromProps(null)) { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
public void failColumnFamilyOptionsFromPropsWithEmptyProps() { |
|
|
|
public void failColumnFamilyOptionsFromPropsWithEmptyProps() { |
|
|
|
ColumnFamilyOptions.getColumnFamilyOptionsFromProps( |
|
|
|
try (final ColumnFamilyOptions opt = |
|
|
|
new Properties()); |
|
|
|
ColumnFamilyOptions.getColumnFamilyOptionsFromProps( |
|
|
|
|
|
|
|
new Properties())) { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void writeBufferSize() throws RocksDBException { |
|
|
|
public void writeBufferSize() throws RocksDBException { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final long longValue = rand.nextLong(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
long longValue = rand.nextLong(); |
|
|
|
|
|
|
|
opt.setWriteBufferSize(longValue); |
|
|
|
opt.setWriteBufferSize(longValue); |
|
|
|
assertThat(opt.writeBufferSize()).isEqualTo(longValue); |
|
|
|
assertThat(opt.writeBufferSize()).isEqualTo(longValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void maxWriteBufferNumber() { |
|
|
|
public void maxWriteBufferNumber() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setMaxWriteBufferNumber(intValue); |
|
|
|
opt.setMaxWriteBufferNumber(intValue); |
|
|
|
assertThat(opt.maxWriteBufferNumber()).isEqualTo(intValue); |
|
|
|
assertThat(opt.maxWriteBufferNumber()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void minWriteBufferNumberToMerge() { |
|
|
|
public void minWriteBufferNumberToMerge() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setMinWriteBufferNumberToMerge(intValue); |
|
|
|
opt.setMinWriteBufferNumberToMerge(intValue); |
|
|
|
assertThat(opt.minWriteBufferNumberToMerge()).isEqualTo(intValue); |
|
|
|
assertThat(opt.minWriteBufferNumberToMerge()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void numLevels() { |
|
|
|
public void numLevels() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setNumLevels(intValue); |
|
|
|
opt.setNumLevels(intValue); |
|
|
|
assertThat(opt.numLevels()).isEqualTo(intValue); |
|
|
|
assertThat(opt.numLevels()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void levelZeroFileNumCompactionTrigger() { |
|
|
|
public void levelZeroFileNumCompactionTrigger() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setLevelZeroFileNumCompactionTrigger(intValue); |
|
|
|
opt.setLevelZeroFileNumCompactionTrigger(intValue); |
|
|
|
assertThat(opt.levelZeroFileNumCompactionTrigger()).isEqualTo(intValue); |
|
|
|
assertThat(opt.levelZeroFileNumCompactionTrigger()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void levelZeroSlowdownWritesTrigger() { |
|
|
|
public void levelZeroSlowdownWritesTrigger() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setLevelZeroSlowdownWritesTrigger(intValue); |
|
|
|
opt.setLevelZeroSlowdownWritesTrigger(intValue); |
|
|
|
assertThat(opt.levelZeroSlowdownWritesTrigger()).isEqualTo(intValue); |
|
|
|
assertThat(opt.levelZeroSlowdownWritesTrigger()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void levelZeroStopWritesTrigger() { |
|
|
|
public void levelZeroStopWritesTrigger() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setLevelZeroStopWritesTrigger(intValue); |
|
|
|
opt.setLevelZeroStopWritesTrigger(intValue); |
|
|
|
assertThat(opt.levelZeroStopWritesTrigger()).isEqualTo(intValue); |
|
|
|
assertThat(opt.levelZeroStopWritesTrigger()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void targetFileSizeBase() { |
|
|
|
public void targetFileSizeBase() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final long longValue = rand.nextLong(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
long longValue = rand.nextLong(); |
|
|
|
|
|
|
|
opt.setTargetFileSizeBase(longValue); |
|
|
|
opt.setTargetFileSizeBase(longValue); |
|
|
|
assertThat(opt.targetFileSizeBase()).isEqualTo(longValue); |
|
|
|
assertThat(opt.targetFileSizeBase()).isEqualTo(longValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void targetFileSizeMultiplier() { |
|
|
|
public void targetFileSizeMultiplier() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setTargetFileSizeMultiplier(intValue); |
|
|
|
opt.setTargetFileSizeMultiplier(intValue); |
|
|
|
assertThat(opt.targetFileSizeMultiplier()).isEqualTo(intValue); |
|
|
|
assertThat(opt.targetFileSizeMultiplier()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void maxBytesForLevelBase() { |
|
|
|
public void maxBytesForLevelBase() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final long longValue = rand.nextLong(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
long longValue = rand.nextLong(); |
|
|
|
|
|
|
|
opt.setMaxBytesForLevelBase(longValue); |
|
|
|
opt.setMaxBytesForLevelBase(longValue); |
|
|
|
assertThat(opt.maxBytesForLevelBase()).isEqualTo(longValue); |
|
|
|
assertThat(opt.maxBytesForLevelBase()).isEqualTo(longValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void levelCompactionDynamicLevelBytes() { |
|
|
|
public void levelCompactionDynamicLevelBytes() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
|
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
final boolean boolValue = rand.nextBoolean(); |
|
|
|
final boolean boolValue = rand.nextBoolean(); |
|
|
|
opt.setLevelCompactionDynamicLevelBytes(boolValue); |
|
|
|
opt.setLevelCompactionDynamicLevelBytes(boolValue); |
|
|
|
assertThat(opt.levelCompactionDynamicLevelBytes()) |
|
|
|
assertThat(opt.levelCompactionDynamicLevelBytes()) |
|
|
|
.isEqualTo(boolValue); |
|
|
|
.isEqualTo(boolValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void maxBytesForLevelMultiplier() { |
|
|
|
public void maxBytesForLevelMultiplier() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setMaxBytesForLevelMultiplier(intValue); |
|
|
|
opt.setMaxBytesForLevelMultiplier(intValue); |
|
|
|
assertThat(opt.maxBytesForLevelMultiplier()).isEqualTo(intValue); |
|
|
|
assertThat(opt.maxBytesForLevelMultiplier()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void expandedCompactionFactor() { |
|
|
|
public void expandedCompactionFactor() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setExpandedCompactionFactor(intValue); |
|
|
|
opt.setExpandedCompactionFactor(intValue); |
|
|
|
assertThat(opt.expandedCompactionFactor()).isEqualTo(intValue); |
|
|
|
assertThat(opt.expandedCompactionFactor()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void sourceCompactionFactor() { |
|
|
|
public void sourceCompactionFactor() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setSourceCompactionFactor(intValue); |
|
|
|
opt.setSourceCompactionFactor(intValue); |
|
|
|
assertThat(opt.sourceCompactionFactor()).isEqualTo(intValue); |
|
|
|
assertThat(opt.sourceCompactionFactor()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void maxGrandparentOverlapFactor() { |
|
|
|
public void maxGrandparentOverlapFactor() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setMaxGrandparentOverlapFactor(intValue); |
|
|
|
opt.setMaxGrandparentOverlapFactor(intValue); |
|
|
|
assertThat(opt.maxGrandparentOverlapFactor()).isEqualTo(intValue); |
|
|
|
assertThat(opt.maxGrandparentOverlapFactor()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void softRateLimit() { |
|
|
|
public void softRateLimit() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final double doubleValue = rand.nextDouble(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
double doubleValue = rand.nextDouble(); |
|
|
|
|
|
|
|
opt.setSoftRateLimit(doubleValue); |
|
|
|
opt.setSoftRateLimit(doubleValue); |
|
|
|
assertThat(opt.softRateLimit()).isEqualTo(doubleValue); |
|
|
|
assertThat(opt.softRateLimit()).isEqualTo(doubleValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hardRateLimit() { |
|
|
|
public void hardRateLimit() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final double doubleValue = rand.nextDouble(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
double doubleValue = rand.nextDouble(); |
|
|
|
|
|
|
|
opt.setHardRateLimit(doubleValue); |
|
|
|
opt.setHardRateLimit(doubleValue); |
|
|
|
assertThat(opt.hardRateLimit()).isEqualTo(doubleValue); |
|
|
|
assertThat(opt.hardRateLimit()).isEqualTo(doubleValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void rateLimitDelayMaxMilliseconds() { |
|
|
|
public void rateLimitDelayMaxMilliseconds() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setRateLimitDelayMaxMilliseconds(intValue); |
|
|
|
opt.setRateLimitDelayMaxMilliseconds(intValue); |
|
|
|
assertThat(opt.rateLimitDelayMaxMilliseconds()).isEqualTo(intValue); |
|
|
|
assertThat(opt.rateLimitDelayMaxMilliseconds()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void arenaBlockSize() throws RocksDBException { |
|
|
|
public void arenaBlockSize() throws RocksDBException { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final long longValue = rand.nextLong(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
long longValue = rand.nextLong(); |
|
|
|
|
|
|
|
opt.setArenaBlockSize(longValue); |
|
|
|
opt.setArenaBlockSize(longValue); |
|
|
|
assertThat(opt.arenaBlockSize()).isEqualTo(longValue); |
|
|
|
assertThat(opt.arenaBlockSize()).isEqualTo(longValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void disableAutoCompactions() { |
|
|
|
public void disableAutoCompactions() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final boolean boolValue = rand.nextBoolean(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
boolean boolValue = rand.nextBoolean(); |
|
|
|
|
|
|
|
opt.setDisableAutoCompactions(boolValue); |
|
|
|
opt.setDisableAutoCompactions(boolValue); |
|
|
|
assertThat(opt.disableAutoCompactions()).isEqualTo(boolValue); |
|
|
|
assertThat(opt.disableAutoCompactions()).isEqualTo(boolValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void purgeRedundantKvsWhileFlush() { |
|
|
|
public void purgeRedundantKvsWhileFlush() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final boolean boolValue = rand.nextBoolean(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
boolean boolValue = rand.nextBoolean(); |
|
|
|
|
|
|
|
opt.setPurgeRedundantKvsWhileFlush(boolValue); |
|
|
|
opt.setPurgeRedundantKvsWhileFlush(boolValue); |
|
|
|
assertThat(opt.purgeRedundantKvsWhileFlush()).isEqualTo(boolValue); |
|
|
|
assertThat(opt.purgeRedundantKvsWhileFlush()).isEqualTo(boolValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void verifyChecksumsInCompaction() { |
|
|
|
public void verifyChecksumsInCompaction() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final boolean boolValue = rand.nextBoolean(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
boolean boolValue = rand.nextBoolean(); |
|
|
|
|
|
|
|
opt.setVerifyChecksumsInCompaction(boolValue); |
|
|
|
opt.setVerifyChecksumsInCompaction(boolValue); |
|
|
|
assertThat(opt.verifyChecksumsInCompaction()).isEqualTo(boolValue); |
|
|
|
assertThat(opt.verifyChecksumsInCompaction()).isEqualTo(boolValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void filterDeletes() { |
|
|
|
public void filterDeletes() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final boolean boolValue = rand.nextBoolean(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
boolean boolValue = rand.nextBoolean(); |
|
|
|
|
|
|
|
opt.setFilterDeletes(boolValue); |
|
|
|
opt.setFilterDeletes(boolValue); |
|
|
|
assertThat(opt.filterDeletes()).isEqualTo(boolValue); |
|
|
|
assertThat(opt.filterDeletes()).isEqualTo(boolValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void maxSequentialSkipInIterations() { |
|
|
|
public void maxSequentialSkipInIterations() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final long longValue = rand.nextLong(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
long longValue = rand.nextLong(); |
|
|
|
|
|
|
|
opt.setMaxSequentialSkipInIterations(longValue); |
|
|
|
opt.setMaxSequentialSkipInIterations(longValue); |
|
|
|
assertThat(opt.maxSequentialSkipInIterations()).isEqualTo(longValue); |
|
|
|
assertThat(opt.maxSequentialSkipInIterations()).isEqualTo(longValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void inplaceUpdateSupport() { |
|
|
|
public void inplaceUpdateSupport() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final boolean boolValue = rand.nextBoolean(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
boolean boolValue = rand.nextBoolean(); |
|
|
|
|
|
|
|
opt.setInplaceUpdateSupport(boolValue); |
|
|
|
opt.setInplaceUpdateSupport(boolValue); |
|
|
|
assertThat(opt.inplaceUpdateSupport()).isEqualTo(boolValue); |
|
|
|
assertThat(opt.inplaceUpdateSupport()).isEqualTo(boolValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void inplaceUpdateNumLocks() throws RocksDBException { |
|
|
|
public void inplaceUpdateNumLocks() throws RocksDBException { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final long longValue = rand.nextLong(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
long longValue = rand.nextLong(); |
|
|
|
|
|
|
|
opt.setInplaceUpdateNumLocks(longValue); |
|
|
|
opt.setInplaceUpdateNumLocks(longValue); |
|
|
|
assertThat(opt.inplaceUpdateNumLocks()).isEqualTo(longValue); |
|
|
|
assertThat(opt.inplaceUpdateNumLocks()).isEqualTo(longValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void memtablePrefixBloomBits() { |
|
|
|
public void memtablePrefixBloomBits() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt.setMemtablePrefixBloomBits(intValue); |
|
|
|
opt.setMemtablePrefixBloomBits(intValue); |
|
|
|
assertThat(opt.memtablePrefixBloomBits()).isEqualTo(intValue); |
|
|
|
assertThat(opt.memtablePrefixBloomBits()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void memtablePrefixBloomProbes() { |
|
|
|
public void memtablePrefixBloomProbes() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
opt.setMemtablePrefixBloomProbes(intValue); |
|
|
|
opt.setMemtablePrefixBloomProbes(intValue); |
|
|
|
assertThat(opt.memtablePrefixBloomProbes()).isEqualTo(intValue); |
|
|
|
assertThat(opt.memtablePrefixBloomProbes()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void bloomLocality() { |
|
|
|
public void bloomLocality() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
opt.setBloomLocality(intValue); |
|
|
|
opt.setBloomLocality(intValue); |
|
|
|
assertThat(opt.bloomLocality()).isEqualTo(intValue); |
|
|
|
assertThat(opt.bloomLocality()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void maxSuccessiveMerges() throws RocksDBException { |
|
|
|
public void maxSuccessiveMerges() throws RocksDBException { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final long longValue = rand.nextLong(); |
|
|
|
long longValue = rand.nextLong(); |
|
|
|
|
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
opt.setMaxSuccessiveMerges(longValue); |
|
|
|
opt.setMaxSuccessiveMerges(longValue); |
|
|
|
assertThat(opt.maxSuccessiveMerges()).isEqualTo(longValue); |
|
|
|
assertThat(opt.maxSuccessiveMerges()).isEqualTo(longValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void minPartialMergeOperands() { |
|
|
|
public void minPartialMergeOperands() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final int intValue = rand.nextInt(); |
|
|
|
int intValue = rand.nextInt(); |
|
|
|
|
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
opt.setMinPartialMergeOperands(intValue); |
|
|
|
opt.setMinPartialMergeOperands(intValue); |
|
|
|
assertThat(opt.minPartialMergeOperands()).isEqualTo(intValue); |
|
|
|
assertThat(opt.minPartialMergeOperands()).isEqualTo(intValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void optimizeFiltersForHits() { |
|
|
|
public void optimizeFiltersForHits() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
final boolean aBoolean = rand.nextBoolean(); |
|
|
|
boolean aBoolean = rand.nextBoolean(); |
|
|
|
|
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
opt.setOptimizeFiltersForHits(aBoolean); |
|
|
|
opt.setOptimizeFiltersForHits(aBoolean); |
|
|
|
assertThat(opt.optimizeFiltersForHits()).isEqualTo(aBoolean); |
|
|
|
assertThat(opt.optimizeFiltersForHits()).isEqualTo(aBoolean); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void memTable() throws RocksDBException { |
|
|
|
public void memTable() throws RocksDBException { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
|
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
opt.setMemTableConfig(new HashLinkedListMemTableConfig()); |
|
|
|
opt.setMemTableConfig(new HashLinkedListMemTableConfig()); |
|
|
|
assertThat(opt.memTableFactoryName()). |
|
|
|
assertThat(opt.memTableFactoryName()). |
|
|
|
isEqualTo("HashLinkedListRepFactory"); |
|
|
|
isEqualTo("HashLinkedListRepFactory"); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void comparator() throws RocksDBException { |
|
|
|
public void comparator() throws RocksDBException { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
|
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
opt.setComparator(BuiltinComparator.BYTEWISE_COMPARATOR); |
|
|
|
opt.setComparator(BuiltinComparator.BYTEWISE_COMPARATOR); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void linkageOfPrepMethods() { |
|
|
|
public void linkageOfPrepMethods() { |
|
|
|
ColumnFamilyOptions options = null; |
|
|
|
try (final ColumnFamilyOptions options = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
|
|
|
|
options = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
options.optimizeUniversalStyleCompaction(); |
|
|
|
options.optimizeUniversalStyleCompaction(); |
|
|
|
options.optimizeUniversalStyleCompaction(4000); |
|
|
|
options.optimizeUniversalStyleCompaction(4000); |
|
|
|
options.optimizeLevelStyleCompaction(); |
|
|
|
options.optimizeLevelStyleCompaction(); |
|
|
|
options.optimizeLevelStyleCompaction(3000); |
|
|
|
options.optimizeLevelStyleCompaction(3000); |
|
|
|
options.optimizeForPointLookup(10); |
|
|
|
options.optimizeForPointLookup(10); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (options != null) { |
|
|
|
|
|
|
|
options.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void shouldSetTestPrefixExtractor() { |
|
|
|
public void shouldSetTestPrefixExtractor() { |
|
|
|
ColumnFamilyOptions options = null; |
|
|
|
try (final ColumnFamilyOptions options = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
|
|
|
|
options = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
options.useFixedLengthPrefixExtractor(100); |
|
|
|
options.useFixedLengthPrefixExtractor(100); |
|
|
|
options.useFixedLengthPrefixExtractor(10); |
|
|
|
options.useFixedLengthPrefixExtractor(10); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (options != null) { |
|
|
|
|
|
|
|
options.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void shouldSetTestCappedPrefixExtractor() { |
|
|
|
public void shouldSetTestCappedPrefixExtractor() { |
|
|
|
ColumnFamilyOptions options = null; |
|
|
|
try (final ColumnFamilyOptions options = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
|
|
|
|
options = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
options.useCappedPrefixExtractor(100); |
|
|
|
options.useCappedPrefixExtractor(100); |
|
|
|
options.useCappedPrefixExtractor(10); |
|
|
|
options.useCappedPrefixExtractor(10); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (options != null) { |
|
|
|
|
|
|
|
options.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void compressionTypes() { |
|
|
|
public void compressionTypes() { |
|
|
|
ColumnFamilyOptions columnFamilyOptions = null; |
|
|
|
try (final ColumnFamilyOptions columnFamilyOptions |
|
|
|
try { |
|
|
|
= new ColumnFamilyOptions()) { |
|
|
|
columnFamilyOptions = new ColumnFamilyOptions(); |
|
|
|
for (final CompressionType compressionType : |
|
|
|
for (CompressionType compressionType : |
|
|
|
|
|
|
|
CompressionType.values()) { |
|
|
|
CompressionType.values()) { |
|
|
|
columnFamilyOptions.setCompressionType(compressionType); |
|
|
|
columnFamilyOptions.setCompressionType(compressionType); |
|
|
|
assertThat(columnFamilyOptions.compressionType()). |
|
|
|
assertThat(columnFamilyOptions.compressionType()). |
|
|
@ -643,21 +413,16 @@ public class ColumnFamilyOptionsTest { |
|
|
|
assertThat(CompressionType.valueOf("NO_COMPRESSION")). |
|
|
|
assertThat(CompressionType.valueOf("NO_COMPRESSION")). |
|
|
|
isEqualTo(CompressionType.NO_COMPRESSION); |
|
|
|
isEqualTo(CompressionType.NO_COMPRESSION); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (columnFamilyOptions != null) { |
|
|
|
|
|
|
|
columnFamilyOptions.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void compressionPerLevel() { |
|
|
|
public void compressionPerLevel() { |
|
|
|
ColumnFamilyOptions columnFamilyOptions = null; |
|
|
|
try (final ColumnFamilyOptions columnFamilyOptions |
|
|
|
try { |
|
|
|
= new ColumnFamilyOptions()) { |
|
|
|
columnFamilyOptions = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
assertThat(columnFamilyOptions.compressionPerLevel()).isEmpty(); |
|
|
|
assertThat(columnFamilyOptions.compressionPerLevel()).isEmpty(); |
|
|
|
List<CompressionType> compressionTypeList = new ArrayList<>(); |
|
|
|
List<CompressionType> compressionTypeList = new ArrayList<>(); |
|
|
|
for (int i=0; i < columnFamilyOptions.numLevels(); i++) { |
|
|
|
for (int i = 0; i < columnFamilyOptions.numLevels(); i++) { |
|
|
|
compressionTypeList.add(CompressionType.NO_COMPRESSION); |
|
|
|
compressionTypeList.add(CompressionType.NO_COMPRESSION); |
|
|
|
} |
|
|
|
} |
|
|
|
columnFamilyOptions.setCompressionPerLevel(compressionTypeList); |
|
|
|
columnFamilyOptions.setCompressionPerLevel(compressionTypeList); |
|
|
@ -666,18 +431,13 @@ public class ColumnFamilyOptionsTest { |
|
|
|
assertThat(compressionType).isEqualTo( |
|
|
|
assertThat(compressionType).isEqualTo( |
|
|
|
CompressionType.NO_COMPRESSION); |
|
|
|
CompressionType.NO_COMPRESSION); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (columnFamilyOptions != null) { |
|
|
|
|
|
|
|
columnFamilyOptions.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void differentCompressionsPerLevel() { |
|
|
|
public void differentCompressionsPerLevel() { |
|
|
|
ColumnFamilyOptions columnFamilyOptions = null; |
|
|
|
try (final ColumnFamilyOptions columnFamilyOptions |
|
|
|
try { |
|
|
|
= new ColumnFamilyOptions()) { |
|
|
|
columnFamilyOptions = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
columnFamilyOptions.setNumLevels(3); |
|
|
|
columnFamilyOptions.setNumLevels(3); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(columnFamilyOptions.compressionPerLevel()).isEmpty(); |
|
|
|
assertThat(columnFamilyOptions.compressionPerLevel()).isEmpty(); |
|
|
@ -697,38 +457,27 @@ public class ColumnFamilyOptionsTest { |
|
|
|
CompressionType.SNAPPY_COMPRESSION, |
|
|
|
CompressionType.SNAPPY_COMPRESSION, |
|
|
|
CompressionType.LZ4_COMPRESSION); |
|
|
|
CompressionType.LZ4_COMPRESSION); |
|
|
|
|
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
if (columnFamilyOptions != null) { |
|
|
|
|
|
|
|
columnFamilyOptions.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void compactionStyles() { |
|
|
|
public void compactionStyles() { |
|
|
|
ColumnFamilyOptions ColumnFamilyOptions = null; |
|
|
|
try (final ColumnFamilyOptions columnFamilyOptions |
|
|
|
try { |
|
|
|
= new ColumnFamilyOptions()) { |
|
|
|
ColumnFamilyOptions = new ColumnFamilyOptions(); |
|
|
|
for (final CompactionStyle compactionStyle : |
|
|
|
for (CompactionStyle compactionStyle : |
|
|
|
|
|
|
|
CompactionStyle.values()) { |
|
|
|
CompactionStyle.values()) { |
|
|
|
ColumnFamilyOptions.setCompactionStyle(compactionStyle); |
|
|
|
columnFamilyOptions.setCompactionStyle(compactionStyle); |
|
|
|
assertThat(ColumnFamilyOptions.compactionStyle()). |
|
|
|
assertThat(columnFamilyOptions.compactionStyle()). |
|
|
|
isEqualTo(compactionStyle); |
|
|
|
isEqualTo(compactionStyle); |
|
|
|
assertThat(CompactionStyle.valueOf("FIFO")). |
|
|
|
assertThat(CompactionStyle.valueOf("FIFO")). |
|
|
|
isEqualTo(CompactionStyle.FIFO); |
|
|
|
isEqualTo(CompactionStyle.FIFO); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (ColumnFamilyOptions != null) { |
|
|
|
|
|
|
|
ColumnFamilyOptions.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void maxTableFilesSizeFIFO() { |
|
|
|
public void maxTableFilesSizeFIFO() { |
|
|
|
ColumnFamilyOptions opt = null; |
|
|
|
try (final ColumnFamilyOptions opt = new ColumnFamilyOptions()) { |
|
|
|
try { |
|
|
|
|
|
|
|
opt = new ColumnFamilyOptions(); |
|
|
|
|
|
|
|
long longValue = rand.nextLong(); |
|
|
|
long longValue = rand.nextLong(); |
|
|
|
// Size has to be positive
|
|
|
|
// Size has to be positive
|
|
|
|
longValue = (longValue < 0) ? -longValue : longValue; |
|
|
|
longValue = (longValue < 0) ? -longValue : longValue; |
|
|
@ -736,10 +485,6 @@ public class ColumnFamilyOptionsTest { |
|
|
|
opt.setMaxTableFilesSizeFIFO(longValue); |
|
|
|
opt.setMaxTableFilesSizeFIFO(longValue); |
|
|
|
assertThat(opt.maxTableFilesSizeFIFO()). |
|
|
|
assertThat(opt.maxTableFilesSizeFIFO()). |
|
|
|
isEqualTo(longValue); |
|
|
|
isEqualTo(longValue); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (opt != null) { |
|
|
|
|
|
|
|
opt.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|