|
|
@ -70,7 +70,7 @@ const std::string kDummyValue(10000, 'o'); |
|
|
|
// DummyPropertiesCollector used to test BlockBasedTableProperties
|
|
|
|
// DummyPropertiesCollector used to test BlockBasedTableProperties
|
|
|
|
class DummyPropertiesCollector : public TablePropertiesCollector { |
|
|
|
class DummyPropertiesCollector : public TablePropertiesCollector { |
|
|
|
public: |
|
|
|
public: |
|
|
|
const char* Name() const override { return ""; } |
|
|
|
const char* Name() const override { return "DummyPropertiesCollector"; } |
|
|
|
|
|
|
|
|
|
|
|
Status Finish(UserCollectedProperties* /*properties*/) override { |
|
|
|
Status Finish(UserCollectedProperties* /*properties*/) override { |
|
|
|
return Status::OK(); |
|
|
|
return Status::OK(); |
|
|
@ -92,7 +92,9 @@ class DummyPropertiesCollectorFactory1 |
|
|
|
TablePropertiesCollectorFactory::Context /*context*/) override { |
|
|
|
TablePropertiesCollectorFactory::Context /*context*/) override { |
|
|
|
return new DummyPropertiesCollector(); |
|
|
|
return new DummyPropertiesCollector(); |
|
|
|
} |
|
|
|
} |
|
|
|
const char* Name() const override { return "DummyPropertiesCollector1"; } |
|
|
|
const char* Name() const override { |
|
|
|
|
|
|
|
return "DummyPropertiesCollectorFactory1"; |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class DummyPropertiesCollectorFactory2 |
|
|
|
class DummyPropertiesCollectorFactory2 |
|
|
@ -102,7 +104,9 @@ class DummyPropertiesCollectorFactory2 |
|
|
|
TablePropertiesCollectorFactory::Context /*context*/) override { |
|
|
|
TablePropertiesCollectorFactory::Context /*context*/) override { |
|
|
|
return new DummyPropertiesCollector(); |
|
|
|
return new DummyPropertiesCollector(); |
|
|
|
} |
|
|
|
} |
|
|
|
const char* Name() const override { return "DummyPropertiesCollector2"; } |
|
|
|
const char* Name() const override { |
|
|
|
|
|
|
|
return "DummyPropertiesCollectorFactory2"; |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Return reverse of "key".
|
|
|
|
// Return reverse of "key".
|
|
|
@ -1498,7 +1502,8 @@ TEST_P(BlockBasedTableTest, BlockBasedTableProperties2) { |
|
|
|
ASSERT_EQ("rocksdb.ReverseBytewiseComparator", props.comparator_name); |
|
|
|
ASSERT_EQ("rocksdb.ReverseBytewiseComparator", props.comparator_name); |
|
|
|
ASSERT_EQ("UInt64AddOperator", props.merge_operator_name); |
|
|
|
ASSERT_EQ("UInt64AddOperator", props.merge_operator_name); |
|
|
|
ASSERT_EQ("rocksdb.Noop", props.prefix_extractor_name); |
|
|
|
ASSERT_EQ("rocksdb.Noop", props.prefix_extractor_name); |
|
|
|
ASSERT_EQ("[DummyPropertiesCollector1,DummyPropertiesCollector2]", |
|
|
|
ASSERT_EQ( |
|
|
|
|
|
|
|
"[DummyPropertiesCollectorFactory1,DummyPropertiesCollectorFactory2]", |
|
|
|
props.property_collectors_names); |
|
|
|
props.property_collectors_names); |
|
|
|
ASSERT_EQ("", props.filter_policy_name); // no filter policy is used
|
|
|
|
ASSERT_EQ("", props.filter_policy_name); // no filter policy is used
|
|
|
|
c.ResetTableReader(); |
|
|
|
c.ResetTableReader(); |
|
|
@ -2186,7 +2191,8 @@ class CustomFlushBlockPolicy : public FlushBlockPolicyFactory, |
|
|
|
explicit CustomFlushBlockPolicy(std::vector<int> keys_per_block) |
|
|
|
explicit CustomFlushBlockPolicy(std::vector<int> keys_per_block) |
|
|
|
: keys_per_block_(keys_per_block) {} |
|
|
|
: keys_per_block_(keys_per_block) {} |
|
|
|
|
|
|
|
|
|
|
|
const char* Name() const override { return "table_test"; } |
|
|
|
const char* Name() const override { return "CustomFlushBlockPolicy"; } |
|
|
|
|
|
|
|
|
|
|
|
FlushBlockPolicy* NewFlushBlockPolicy(const BlockBasedTableOptions&, |
|
|
|
FlushBlockPolicy* NewFlushBlockPolicy(const BlockBasedTableOptions&, |
|
|
|
const BlockBuilder&) const override { |
|
|
|
const BlockBuilder&) const override { |
|
|
|
return new CustomFlushBlockPolicy(keys_per_block_); |
|
|
|
return new CustomFlushBlockPolicy(keys_per_block_); |
|
|
|