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
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<size_t>(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;

View File

@ -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;