mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-24 02:20:37 +00:00
sstable features indicate that an sstable has some extension, or that some bug was fixed. They allow us to know if we can rely on certain properties in a read sstables. Currently, sstable features are set early in the read path (when we read the scylla metadata file) and very late in the write path (when we write the scylla metadata file just before sealing the sstable). However, we happen to read features before we set them in the write path - when we resize the bloom filter for a newly written sstable we instantiate an index reader, and that depends on some features. As a result, we read a disengaged optional (for the scylla metadata component) as if it was engaged. This somehow worked so far, but fails with libstdc++ hash table implementation. Fix it by moving storage of the features to the sstable itself, and setting it early in the write path. Fixes #23484 Closes scylladb/scylladb#23485
55 lines
1.7 KiB
C++
55 lines
1.7 KiB
C++
/*
|
|
* Copyright (C) 2018-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "sstable_writer.hh"
|
|
#include "sstables_manager.hh"
|
|
#include "schema/schema_fwd.hh"
|
|
#include "mutation/mutation_fragment.hh"
|
|
#include "metadata_collector.hh"
|
|
#include "mutation/mutation_fragment_stream_validator.hh"
|
|
|
|
namespace sstables {
|
|
|
|
struct sstable_writer::writer_impl {
|
|
sstable& _sst;
|
|
const schema& _schema;
|
|
const sstable_writer_config _cfg;
|
|
// NOTE: _collector and _c_stats are used to generation of statistics file
|
|
// when writing a new sstable.
|
|
metadata_collector _collector;
|
|
column_stats _c_stats;
|
|
mutation_fragment_stream_validating_filter _validator;
|
|
sstable_enabled_features _features = sstable_enabled_features::all();
|
|
|
|
writer_impl(sstable& sst, const schema& schema, const sstable_writer_config& cfg)
|
|
: _sst(sst)
|
|
, _schema(schema)
|
|
, _cfg(cfg)
|
|
, _collector(_schema, sst.get_filename(), sst.manager().get_local_host_id())
|
|
, _validator(format("sstable writer {}", _sst.get_filename()), _schema, _cfg.validation_level)
|
|
{
|
|
if (!cfg.correct_pi_block_width) {
|
|
_features.disable(CorrectLastPiBlockWidth);
|
|
}
|
|
sst.set_features(_features);
|
|
}
|
|
|
|
virtual void consume_new_partition(const dht::decorated_key& dk) = 0;
|
|
virtual void consume(tombstone t) = 0;
|
|
virtual stop_iteration consume(static_row&& sr) = 0;
|
|
virtual stop_iteration consume(clustering_row&& cr) = 0;
|
|
virtual stop_iteration consume(range_tombstone_change&& rtc) = 0;
|
|
virtual stop_iteration consume_end_of_partition() = 0;
|
|
virtual void consume_end_of_stream() = 0;
|
|
virtual ~writer_impl() {}
|
|
};
|
|
|
|
}
|