From 251553b2e909673cdca0520b7173827ecbe97e5d Mon Sep 17 00:00:00 2001 From: Arseny Smirnov Date: Sun, 17 Jun 2018 22:48:18 +0300 Subject: [PATCH] Add debug GitOrigin-RevId: 63b9f09889866d9510ac951e8fc32be08615223b --- tddb/td/db/binlog/BinlogEvent.h | 4 ++++ tddb/td/db/binlog/detail/BinlogEventsProcessor.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tddb/td/db/binlog/BinlogEvent.h b/tddb/td/db/binlog/BinlogEvent.h index 1874543d..5a8bff44 100644 --- a/tddb/td/db/binlog/BinlogEvent.h +++ b/tddb/td/db/binlog/BinlogEvent.h @@ -80,6 +80,10 @@ struct BinlogEvent { Status init(BufferSlice &&raw_event, bool check_crc = true) TD_WARN_UNUSED_RESULT; static BufferSlice create_raw(uint64 id, int32 type, int32 flags, const Storer &storer); + std::string public_to_string() { + return PSTRING() << "LogEvent[" << tag("id", format::as_hex(id_)) << tag("type", type_) << tag("flags", flags_) + << tag("data", data_.size()) << "]"; + } }; inline StringBuilder &operator<<(StringBuilder &sb, const BinlogEvent &event) { diff --git a/tddb/td/db/binlog/detail/BinlogEventsProcessor.cpp b/tddb/td/db/binlog/detail/BinlogEventsProcessor.cpp index ce769998..1eb23fe2 100644 --- a/tddb/td/db/binlog/detail/BinlogEventsProcessor.cpp +++ b/tddb/td/db/binlog/detail/BinlogEventsProcessor.cpp @@ -18,7 +18,7 @@ void BinlogEventsProcessor::do_event(BinlogEvent &&event) { if ((event.flags_ & BinlogEvent::Flags::Rewrite) && !ids_.empty() && ids_.back() >= fixed_id) { auto it = std::lower_bound(ids_.begin(), ids_.end(), fixed_id); if (it == ids_.end() || *it != fixed_id) { - LOG(FATAL) << "Ignore rewrite logevent"; + LOG(FATAL) << "Ignore rewrite logevent " << event.public_to_string(); return; } auto pos = it - ids_.begin();