Revert "commitlog: fix size of a write used to zero a segment"

This reverts commit df2f67626b. The fix
is correct, but has an unfortunate side effect with O_DSYNC: each
128k write also needs to flush the XFS log. This translates to
32MB/128k = 256 flushes, compared to one flush with the original code.

A better fix would be to prezero without O_DSYNC, then reopen the file
with O_DSYNC, but we can do that later.

Reopens #5857.
This commit is contained in:
Avi Kivity
2021-01-19 19:42:11 +02:00
parent 586f16bf79
commit 114da51d73

View File

@@ -1342,7 +1342,7 @@ future<db::commitlog::segment_manager::sseg_ptr> db::commitlog::segment_manager:
std::vector<iovec> v;
v.reserve(n);
size_t m = 0;
while (m < rem && n--) {
while (m < rem && n < max_write) {
auto s = std::min(rem - m, buf_size);
v.emplace_back(iovec{ buf.get_write(), s});
m += s;