diff options
| author | levlam <levlam@telegram.org> | 2023-02-10 15:21:43 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2023-02-10 15:21:43 +0300 |
| commit | 1c9efb4283e0055ee7eb4836fe61141fb3271918 (patch) | |
| tree | f3521c78f6a9390c9020ef2aec0d5e5f6b71763f | |
| parent | 852a1640b098a0945b0c3549b2358078c1f292c9 (diff) | |
Binlog: avoid sync on Binlog creation.
| -rw-r--r-- | tddb/td/db/binlog/Binlog.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tddb/td/db/binlog/Binlog.cpp b/tddb/td/db/binlog/Binlog.cpp index 410f5b0e7..10fd947e5 100644 --- a/tddb/td/db/binlog/Binlog.cpp +++ b/tddb/td/db/binlog/Binlog.cpp @@ -650,8 +650,11 @@ void Binlog::do_reindex() { }); { flush(); - auto status = fd_.sync_barrier(); - LOG_IF(FATAL, status.is_error()) << "Failed to sync binlog: " << status; + if (start_size != 0) { // must sync creation of the file if it is non-empty + auto status = fd_.sync_barrier(); + LOG_IF(FATAL, status.is_error()) << "Failed to sync binlog: " << status; + } + need_sync_ = false; } // finish_reindex |
