A few improvements to encoding_stats structure.
- Use the same default epoch as Origin - Use default value for the encoding_stats parameter in sstable::write_components() Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com> Message-Id: <846c6d2cbb97d2dd25968cb00b8557c86ff5e35c.1524854727.git.vladimir@scylladb.com>
This commit is contained in:
committed by
Avi Kivity
parent
2fb1bcfd13
commit
b3572acd6e
@@ -24,13 +24,24 @@
|
||||
#include "timestamp.hh"
|
||||
|
||||
// Stores statistics on all the updates done to a memtable
|
||||
// The collected statistics is used for flushing memtable to the disk
|
||||
// The collected statistics are used for flushing memtable to the disk
|
||||
struct encoding_stats {
|
||||
|
||||
// The fixed epoch corresponds to 2018-03-22, 00:00:00 GMT-0.
|
||||
// The fixed epoch corresponds to the one used by Origin - 22/09/2015, 00:00:00, GMT-0:
|
||||
// Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT-0"), Locale.US);
|
||||
// c.set(Calendar.YEAR, 2015);
|
||||
// c.set(Calendar.MONTH, Calendar.SEPTEMBER);
|
||||
// c.set(Calendar.DAY_OF_MONTH, 22);
|
||||
// c.set(Calendar.HOUR_OF_DAY, 0);
|
||||
// c.set(Calendar.MINUTE, 0);
|
||||
// c.set(Calendar.SECOND, 0);
|
||||
// c.set(Calendar.MILLISECOND, 0);
|
||||
//
|
||||
// long TIMESTAMP_EPOCH = c.getTimeInMillis() * 1000; // timestamps should be in microseconds by convention
|
||||
// int DELETION_TIME_EPOCH = (int)(c.getTimeInMillis() / 1000); // local deletion times are in seconds
|
||||
// Encoding stats are used for delta-encoding, so we want some default values
|
||||
// that are just good enough so we take some recent date in the past
|
||||
static constexpr uint32_t deletion_time_epoch = 1521676800;
|
||||
static constexpr uint32_t deletion_time_epoch = 1442880000;
|
||||
static constexpr api::timestamp_type timestamp_epoch = deletion_time_epoch * 1000 * 1000;
|
||||
static constexpr uint32_t ttl_epoch = 0;
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
uint64_t estimated_partitions,
|
||||
schema_ptr schema,
|
||||
const sstable_writer_config&,
|
||||
encoding_stats stats,
|
||||
encoding_stats stats = {},
|
||||
const io_priority_class& pc = default_priority_class());
|
||||
|
||||
sstable_writer get_writer(const schema& s,
|
||||
|
||||
@@ -3686,7 +3686,7 @@ static
|
||||
shared_sstable make_sstable_easy(sstring path, flat_mutation_reader rd, sstable_writer_config cfg, const sstables::sstable::version_types version) {
|
||||
auto s = rd.schema();
|
||||
auto sst = make_sstable(s, path, 1, version, big);
|
||||
sst->write_components(std::move(rd), 1, s, cfg, encoding_stats{}).get();
|
||||
sst->write_components(std::move(rd), 1, s, cfg).get();
|
||||
sst->load().get();
|
||||
return sst;
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ void test_mutation_source(sstable_writer_config cfg, sstables::sstable::version_
|
||||
mt->apply(m);
|
||||
}
|
||||
|
||||
sst->write_components(mt->make_flat_reader(s), partitions.size(), s, cfg, encoding_stats{}).get();
|
||||
sst->write_components(mt->make_flat_reader(s), partitions.size(), s, cfg).get();
|
||||
sst->load().get();
|
||||
|
||||
return as_mutation_source(sst);
|
||||
@@ -848,7 +848,7 @@ SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic) {
|
||||
sstables::sstable::format_types::big);
|
||||
sstable_writer_config cfg;
|
||||
cfg.promoted_index_block_size = 1;
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg, encoding_stats{}).get();
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg).get();
|
||||
sst->load().get();
|
||||
assert_that(get_index_reader(sst)).has_monotonic_positions(*s);
|
||||
});
|
||||
@@ -899,7 +899,7 @@ SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic_compound_dense) {
|
||||
sstables::sstable::format_types::big);
|
||||
sstable_writer_config cfg;
|
||||
cfg.promoted_index_block_size = 1;
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg, encoding_stats{}).get();
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg).get();
|
||||
sst->load().get();
|
||||
|
||||
{
|
||||
@@ -957,7 +957,7 @@ SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic_non_compound_dense) {
|
||||
sstables::sstable::format_types::big);
|
||||
sstable_writer_config cfg;
|
||||
cfg.promoted_index_block_size = 1;
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg, encoding_stats{}).get();
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg).get();
|
||||
sst->load().get();
|
||||
|
||||
{
|
||||
@@ -1012,7 +1012,7 @@ SEASTAR_TEST_CASE(test_promoted_index_repeats_open_tombstones) {
|
||||
sstables::sstable::format_types::big);
|
||||
sstable_writer_config cfg;
|
||||
cfg.promoted_index_block_size = 1;
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg, encoding_stats{}).get();
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg).get();
|
||||
sst->load().get();
|
||||
|
||||
{
|
||||
@@ -1056,7 +1056,7 @@ SEASTAR_TEST_CASE(test_range_tombstones_are_correctly_seralized_for_non_compound
|
||||
version,
|
||||
sstables::sstable::format_types::big);
|
||||
sstable_writer_config cfg;
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg, encoding_stats{}).get();
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg).get();
|
||||
sst->load().get();
|
||||
|
||||
{
|
||||
@@ -1095,7 +1095,7 @@ SEASTAR_TEST_CASE(test_promoted_index_is_absent_for_schemas_without_clustering_k
|
||||
sstables::sstable::format_types::big);
|
||||
sstable_writer_config cfg;
|
||||
cfg.promoted_index_block_size = 1;
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg, encoding_stats{}).get();
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg).get();
|
||||
sst->load().get();
|
||||
|
||||
assert_that(get_index_reader(sst)).is_empty(*s);
|
||||
@@ -1134,7 +1134,7 @@ SEASTAR_TEST_CASE(test_can_write_and_read_non_compound_range_tombstone_as_compou
|
||||
sstables::sstable::format_types::big);
|
||||
sstable_writer_config cfg;
|
||||
cfg.correctly_serialize_non_compound_range_tombstones = false;
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg, encoding_stats{}).get();
|
||||
sst->write_components(mt->make_flat_reader(s), 1, s, cfg).get();
|
||||
sst->load().get();
|
||||
|
||||
{
|
||||
@@ -1187,7 +1187,7 @@ SEASTAR_TEST_CASE(test_writing_combined_stream_with_tombstones_at_the_same_posit
|
||||
sstable_writer_config cfg;
|
||||
sst->write_components(make_combined_reader(s,
|
||||
mt1->make_flat_reader(s),
|
||||
mt2->make_flat_reader(s)), 1, s, cfg, encoding_stats{}).get();
|
||||
mt2->make_flat_reader(s)), 1, s, cfg).get();
|
||||
sst->load().get();
|
||||
|
||||
assert_that(sst->as_mutation_source().make_reader(s))
|
||||
|
||||
Reference in New Issue
Block a user