commitlog: cycle based on total size, not on mutation size
We calculate two sizes during the allocation: "size", which is the in-segment size of this mutation, and "s", which is that plus the overhead. cycle() must be called with the latter, not the former, as doing otherwise may lead to buffer overflows. Signed-off-by: Glauber Costa <glauber@scylladb.com> Message-Id: <ccf346d8d0ebb44a1ba9fd069653bab0d7be0a61.1477063157.git.glauber@scylladb.com>
This commit is contained in:
committed by
Avi Kivity
parent
d9875784a1
commit
a13c410749
@@ -734,7 +734,7 @@ public:
|
||||
return finish_and_get_new().then([id, writer = std::move(writer), permit = std::move(permit)] (auto new_seg) mutable {
|
||||
return new_seg->allocate(id, std::move(writer), std::move(permit));
|
||||
});
|
||||
} else if (!_buffer.empty() && (size > (_buffer.size() - _buf_pos))) { // enough data?
|
||||
} else if (!_buffer.empty() && (s > (_buffer.size() - _buf_pos))) { // enough data?
|
||||
if (_segment_manager->cfg.mode == sync_mode::BATCH) {
|
||||
// TODO: this could cause starvation if we're really unlucky.
|
||||
// If we run batch mode and find ourselves not fit in a non-empty
|
||||
|
||||
Reference in New Issue
Block a user