Always initialize BinlogEvent.offset_.
This commit is contained in:
parent
0e58eeb5e9
commit
d6b7770561
@ -549,6 +549,7 @@ Status Binlog::load_binlog(const Callback &callback, const Callback &debug_callb
|
||||
}
|
||||
|
||||
auto offset = processor_->offset();
|
||||
CHECK(offset >= 0);
|
||||
processor_->for_each([&](BinlogEvent &event) {
|
||||
VLOG(binlog) << "Replay binlog event: " << event.public_to_string();
|
||||
if (callback) {
|
||||
|
@ -29,6 +29,7 @@ void BinlogEvent::init(BufferSlice &&raw_event) {
|
||||
}
|
||||
|
||||
Slice BinlogEvent::get_data() const {
|
||||
CHECK(raw_event_.size() >= MIN_SIZE);
|
||||
return Slice(raw_event_.as_slice().data() + HEADER_SIZE, size_ - MIN_SIZE);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ struct BinlogEvent {
|
||||
static constexpr size_t TAIL_SIZE = 4;
|
||||
static constexpr size_t MIN_SIZE = HEADER_SIZE + TAIL_SIZE;
|
||||
|
||||
int64 offset_;
|
||||
int64 offset_ = -1;
|
||||
|
||||
uint32 size_;
|
||||
uint64 id_;
|
||||
|
@ -37,8 +37,8 @@ Status BinlogEventsProcessor::do_event(BinlogEvent &&event) {
|
||||
// just skip service events
|
||||
} else {
|
||||
if (!(event_ids_.empty() || event_ids_.back() < fixed_event_id)) {
|
||||
return Status::Error(PSLICE() << offset_ << " " << event_ids_.size() << " " << event_ids_.back() << " "
|
||||
<< fixed_event_id << " " << event.public_to_string() << " " << total_events_ << " "
|
||||
return Status::Error(PSLICE() << offset_ << ' ' << event_ids_.size() << ' ' << event_ids_.back() << ' '
|
||||
<< fixed_event_id << ' ' << event.public_to_string() << ' ' << total_events_ << ' '
|
||||
<< total_raw_events_size_);
|
||||
}
|
||||
last_event_id_ = event.id_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user