mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 12:06:44 +00:00
commitlog: avoid copying column_mapping
It is safe to copy column_mapping accros shards. Such guarantee comes at
the cost of performance.
This patch makes commitlog_entry_writer use IDL generated writer to
serialise commitlog_entry so that column_mapping is not copied. This
also simplifies commitlog_entry itself.
Performance difference tested with:
perf_simple_query -c4 --write --duration 60
(medians)
before after diff
write 79434.35 89247.54 +12.3%
(cherry picked from commit 374c8a56ac)
Also: Fixes #2468.
This commit is contained in:
committed by
Avi Kivity
parent
57d602fdd6
commit
7bb41b50f9
@@ -31,15 +31,10 @@ namespace stdx = std::experimental;
|
||||
|
||||
class commitlog_entry {
|
||||
stdx::optional<column_mapping> _mapping;
|
||||
stdx::optional<frozen_mutation> _mutation_storage;
|
||||
const frozen_mutation& _mutation;
|
||||
frozen_mutation _mutation;
|
||||
public:
|
||||
commitlog_entry(stdx::optional<column_mapping> mapping, frozen_mutation&& mutation);
|
||||
commitlog_entry(stdx::optional<column_mapping> mapping, const frozen_mutation& mutation);
|
||||
commitlog_entry(commitlog_entry&&);
|
||||
commitlog_entry(const commitlog_entry&) = delete;
|
||||
commitlog_entry& operator=(commitlog_entry&&);
|
||||
commitlog_entry& operator=(const commitlog_entry&) = delete;
|
||||
commitlog_entry(stdx::optional<column_mapping> mapping, frozen_mutation&& mutation)
|
||||
: _mapping(std::move(mapping)), _mutation(std::move(mutation)) { }
|
||||
const stdx::optional<column_mapping>& mapping() const { return _mapping; }
|
||||
const frozen_mutation& mutation() const { return _mutation; }
|
||||
};
|
||||
@@ -50,8 +45,9 @@ class commitlog_entry_writer {
|
||||
bool _with_schema = true;
|
||||
size_t _size;
|
||||
private:
|
||||
template<typename Output>
|
||||
void serialize(Output&) const;
|
||||
void compute_size();
|
||||
commitlog_entry get_entry() const;
|
||||
public:
|
||||
commitlog_entry_writer(schema_ptr s, const frozen_mutation& fm)
|
||||
: _schema(std::move(s)), _mutation(fm)
|
||||
@@ -88,4 +84,4 @@ public:
|
||||
|
||||
const stdx::optional<column_mapping>& get_column_mapping() const { return _ce.mapping(); }
|
||||
const frozen_mutation& mutation() const { return _ce.mutation(); }
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user