commitlog: add commitlog entry move constructor
Default move constructor and assignment didn't handle reference to mutation (_mutation) properly. Fixes #935. Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com> Message-Id: <1456760905-23478-1-git-send-email-pdziepak@scylladb.com>
This commit is contained in:
committed by
Pekka Enberg
parent
0de8f6d24f
commit
dec63eac6e
@@ -44,6 +44,22 @@ commitlog_entry::commitlog_entry(stdx::optional<column_mapping> mapping, const f
|
||||
, _mutation(mutation)
|
||||
{ }
|
||||
|
||||
commitlog_entry::commitlog_entry(commitlog_entry&& ce)
|
||||
: _mapping(std::move(ce._mapping))
|
||||
, _mutation_storage(std::move(ce._mutation_storage))
|
||||
, _mutation(_mutation_storage ? *_mutation_storage : ce._mutation)
|
||||
{
|
||||
}
|
||||
|
||||
commitlog_entry& commitlog_entry::operator=(commitlog_entry&& ce)
|
||||
{
|
||||
if (this != &ce) {
|
||||
this->~commitlog_entry();
|
||||
new (this) commitlog_entry(std::move(ce));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
commitlog_entry commitlog_entry_writer::get_entry() const {
|
||||
if (_with_schema) {
|
||||
return commitlog_entry(_schema->get_column_mapping(), _mutation);
|
||||
|
||||
Reference in New Issue
Block a user