Remove IGNORE_ERASE_HACK.

GitOrigin-RevId: 7b26a5c8ad5a978c47f873f397cfa27500e8df08
This commit is contained in:
levlam 2020-01-19 03:05:36 +03:00
parent 728d8d79f6
commit e4bfb5bcb8
2 changed files with 7 additions and 15 deletions

View File

@ -163,8 +163,6 @@ static int64 file_size(CSlice path) {
} }
} // namespace detail } // namespace detail
bool Binlog::IGNORE_ERASE_HACK = false;
Binlog::Binlog() = default; Binlog::Binlog() = default;
Binlog::~Binlog() { Binlog::~Binlog() {
@ -522,10 +520,6 @@ Status Binlog::load_binlog(const Callback &callback, const Callback &debug_callb
auto need_size = r_need_size.move_as_ok(); auto need_size = r_need_size.move_as_ok();
// LOG(ERROR) << "Need size = " << need_size; // LOG(ERROR) << "Need size = " << need_size;
if (need_size == 0) { 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) { if (debug_callback) {
debug_callback(event); debug_callback(event);
} }
@ -533,7 +527,6 @@ Status Binlog::load_binlog(const Callback &callback, const Callback &debug_callb
if (info_.wrong_password) { if (info_.wrong_password) {
return Status::OK(); return Status::OK();
} }
}
} else { } else {
TRY_STATUS(fd_.flush_read(max(need_size, static_cast<size_t>(4096)))); TRY_STATUS(fd_.flush_read(max(need_size, static_cast<size_t>(4096))));
buffer_reader_.sync_with_writer(); buffer_reader_.sync_with_writer();
@ -561,7 +554,7 @@ Status Binlog::load_binlog(const Callback &callback, const Callback &debug_callb
fd_.truncate_to_current_position(offset).ensure(); fd_.truncate_to_current_position(offset).ensure();
db_key_used_ = false; // force reindex 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; binlog_reader_ptr_ = nullptr;
state_ = State::Run; state_ = State::Run;

View File

@ -41,7 +41,6 @@ class BinlogEventsBuffer;
class Binlog { class Binlog {
public: public:
enum Error : int { WrongPassword = -1 }; enum Error : int { WrongPassword = -1 };
static bool IGNORE_ERASE_HACK;
Binlog(); Binlog();
Binlog(const Binlog &other) = delete; Binlog(const Binlog &other) = delete;
Binlog &operator=(const Binlog &other) = delete; Binlog &operator=(const Binlog &other) = delete;