memtable: remove _schema from memtable_entry
After adding a _schema field to each partition version, the field in memtable_entry is redundant. It can be always recovered from the latest version. Remove it.
This commit is contained in:
@@ -696,7 +696,7 @@ public:
|
||||
};
|
||||
|
||||
partition_snapshot_ptr memtable_entry::snapshot(memtable& mtbl) {
|
||||
return _pe.read(mtbl.region(), mtbl.cleaner(), _schema, no_cache_tracker);
|
||||
return _pe.read(mtbl.region(), mtbl.cleaner(), schema(), no_cache_tracker);
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2_opt
|
||||
@@ -821,8 +821,7 @@ mutation_source memtable::as_data_source() {
|
||||
}
|
||||
|
||||
memtable_entry::memtable_entry(memtable_entry&& o) noexcept
|
||||
: _schema(std::move(o._schema))
|
||||
, _key(std::move(o._key))
|
||||
: _key(std::move(o._key))
|
||||
, _pe(std::move(o._pe))
|
||||
, _flags(o._flags)
|
||||
{ }
|
||||
@@ -840,14 +839,13 @@ bool memtable::is_flushed() const noexcept {
|
||||
}
|
||||
|
||||
void memtable_entry::upgrade_schema(const schema_ptr& s, mutation_cleaner& cleaner) {
|
||||
if (_schema != s) {
|
||||
partition().upgrade(_schema, s, cleaner, no_cache_tracker);
|
||||
_schema = s;
|
||||
if (schema() != s) {
|
||||
partition().upgrade(schema(), s, cleaner, no_cache_tracker);
|
||||
}
|
||||
}
|
||||
|
||||
void memtable::upgrade_entry(memtable_entry& e) {
|
||||
if (e._schema != _schema) {
|
||||
if (e.schema() != _schema) {
|
||||
assert(!reclaiming_enabled());
|
||||
with_allocator(allocator(), [this, &e] {
|
||||
e.upgrade_schema(_schema, cleaner());
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace bi = boost::intrusive;
|
||||
namespace replica {
|
||||
|
||||
class memtable_entry {
|
||||
schema_ptr _schema;
|
||||
dht::decorated_key _key;
|
||||
partition_entry _pe;
|
||||
struct {
|
||||
@@ -52,9 +51,8 @@ public:
|
||||
friend class memtable;
|
||||
|
||||
memtable_entry(schema_ptr s, dht::decorated_key key, mutation_partition p)
|
||||
: _schema(std::move(s))
|
||||
, _key(std::move(key))
|
||||
, _pe(*_schema, std::move(p))
|
||||
: _key(std::move(key))
|
||||
, _pe(*s, std::move(p))
|
||||
{ }
|
||||
|
||||
memtable_entry(memtable_entry&& o) noexcept;
|
||||
@@ -65,8 +63,7 @@ public:
|
||||
dht::decorated_key& key() { return _key; }
|
||||
const partition_entry& partition() const { return _pe; }
|
||||
partition_entry& partition() { return _pe; }
|
||||
const schema_ptr& schema() const { return _schema; }
|
||||
schema_ptr& schema() { return _schema; }
|
||||
const schema_ptr& schema() const { return _pe.get_schema(); }
|
||||
partition_snapshot_ptr snapshot(memtable& mtbl);
|
||||
|
||||
// Makes the entry conform to given schema.
|
||||
|
||||
Reference in New Issue
Block a user