I have code
file_output_ =
std::make_unique<google::protobuf::io::FileOutputStream>(fd, kDefaultFileBlockSize);
google::protobuf::io::CodedOutputStream coded_output(file_output_.get());
coded_output.WriteLittleEndian32(kProtoSeparator);
int64_t nbytes = message.ByteSizeLong();
coded_output.WriteLittleEndian32(static_cast<int32_t>(nbytes));
CHECK(message.SerializeToCodedStream(&coded_output));
coded_output.Trim();
CHECK(file_output_->Flush());
I write 100,000 messages and comment out Flush, the execution result will be faster.
I want to know whether Flush will trigger fsync to write the Page cache to disk?