From e4bfb5bcb80206dd57eaeafb8f8df6bf02e2add4 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 19 Jan 2020 03:05:36 +0300 Subject: [PATCH] Remove IGNORE_ERASE_HACK. GitOrigin-RevId: 7b26a5c8ad5a978c47f873f397cfa27500e8df08 --- tddb/td/db/binlog/Binlog.cpp | 21 +++++++-------------- tddb/td/db/binlog/Binlog.h | 1 - 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/tddb/td/db/binlog/Binlog.cpp b/tddb/td/db/binlog/Binlog.cpp index 69d6bc41..ae3cde0a 100644 --- a/tddb/td/db/binlog/Binlog.cpp +++ b/tddb/td/db/binlog/Binlog.cpp @@ -163,8 +163,6 @@ static int64 file_size(CSlice path) { } } // namespace detail -bool Binlog::IGNORE_ERASE_HACK = false; - Binlog::Binlog() = default; Binlog::~Binlog() { @@ -522,17 +520,12 @@ Status Binlog::load_binlog(const Callback &callback, const Callback &debug_callb auto need_size = r_need_size.move_as_ok(); // LOG(ERROR) << "Need size = " << need_size; if (need_size == 0) { - if (IGNORE_ERASE_HACK && event.type_ == BinlogEvent::ServiceTypes::Empty && - (event.flags_ & BinlogEvent::Flags::Rewrite) != 0) { - // skip erase - } else { - if (debug_callback) { - debug_callback(event); - } - do_add_event(std::move(event)); - if (info_.wrong_password) { - return Status::OK(); - } + if (debug_callback) { + debug_callback(event); + } + do_add_event(std::move(event)); + if (info_.wrong_password) { + return Status::OK(); } } else { TRY_STATUS(fd_.flush_read(max(need_size, static_cast(4096)))); @@ -561,7 +554,7 @@ Status Binlog::load_binlog(const Callback &callback, const Callback &debug_callb fd_.truncate_to_current_position(offset).ensure(); db_key_used_ = false; // force reindex } - LOG_CHECK(IGNORE_ERASE_HACK || fd_size_ == offset) << fd_size << " " << fd_size_ << " " << offset; + LOG_CHECK(fd_size_ == offset) << fd_size << " " << fd_size_ << " " << offset; binlog_reader_ptr_ = nullptr; state_ = State::Run; diff --git a/tddb/td/db/binlog/Binlog.h b/tddb/td/db/binlog/Binlog.h index 99b74e81..5a6221e3 100644 --- a/tddb/td/db/binlog/Binlog.h +++ b/tddb/td/db/binlog/Binlog.h @@ -41,7 +41,6 @@ class BinlogEventsBuffer; class Binlog { public: enum Error : int { WrongPassword = -1 }; - static bool IGNORE_ERASE_HACK; Binlog(); Binlog(const Binlog &other) = delete; Binlog &operator=(const Binlog &other) = delete;