Skip to content

Commit

Permalink
Remove IGNORE_ERASE_HACK.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 7b26a5c8ad5a978c47f873f397cfa27500e8df08
  • Loading branch information
levlam committed Jan 19, 2020
1 parent 728d8d7 commit e4bfb5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
21 changes: 7 additions & 14 deletions tddb/td/db/binlog/Binlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ static int64 file_size(CSlice path) {
}
} // namespace detail

bool Binlog::IGNORE_ERASE_HACK = false;

Binlog::Binlog() = default;

Binlog::~Binlog() {
Expand Down Expand Up @@ -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))));
Expand Down Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion tddb/td/db/binlog/Binlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e4bfb5b

Please sign in to comment.