mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-27 20:05:10 +00:00
do not calculate serialized size of commitlog_entry_writer before final format is knows
Currently commitlog_entry_writer constructor calculates serialized size before it is knows if a schema should be included into the entry. The result is never used since it is recalculated when schema information is supplied. The patch removes needless calculation. Message-Id: <20170614114607.GA21915@scylladb.com>
This commit is contained in:
@@ -42,7 +42,7 @@ class commitlog_entry_writer {
|
||||
schema_ptr _schema;
|
||||
const frozen_mutation& _mutation;
|
||||
bool _with_schema = true;
|
||||
size_t _size;
|
||||
size_t _size = std::numeric_limits<size_t>::max();
|
||||
private:
|
||||
template<typename Output>
|
||||
void serialize(Output&) const;
|
||||
@@ -50,9 +50,7 @@ private:
|
||||
public:
|
||||
commitlog_entry_writer(schema_ptr s, const frozen_mutation& fm)
|
||||
: _schema(std::move(s)), _mutation(fm)
|
||||
{
|
||||
compute_size();
|
||||
}
|
||||
{}
|
||||
|
||||
void set_with_schema(bool value) {
|
||||
_with_schema = value;
|
||||
@@ -66,6 +64,7 @@ public:
|
||||
}
|
||||
|
||||
size_t size() const {
|
||||
assert(_size != std::numeric_limits<size_t>::max());
|
||||
return _size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user