Skip to content

Commit b71972c

Browse files
committed
Implemented resending of data when performing a flash in buffered output
1 parent 2a49a25 commit b71972c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clickhouse/base/output.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,14 @@ void BufferedOutput::Reset() {
8181

8282
void BufferedOutput::DoFlush() {
8383
if (array_output_.Data() != buffer_.data()) {
84-
destination_->Write(buffer_.data(), array_output_.Data() - buffer_.data());
84+
size_t len = array_output_.Data() - buffer_.data();
85+
const uint8_t* buf = buffer_.data();
86+
while (len > 0) {
87+
const size_t written = destination_->Write(buf, len);
88+
buf += written;
89+
len -= written;
90+
}
91+
8592
destination_->Flush();
8693

8794
array_output_.Reset(buffer_.data(), buffer_.size());

0 commit comments

Comments
 (0)