Binlog: bugfix

GitOrigin-RevId: 4b5f62ee906b5c2ad31390a0fda457a89adc5349
This commit is contained in:
Arseny Smirnov 2018-06-07 15:41:31 +03:00
parent 50a5098b0f
commit 1ee7ea7acc
3 changed files with 18 additions and 3 deletions

View File

@ -344,7 +344,6 @@ void Binlog::do_event(BinlogEvent &&event) {
update_write_encryption();
//LOG(INFO) << format::cond(state_ == State::Run, "Run", "Reindex") << ": init encryption";
}
return;
}
}

View File

@ -32,8 +32,8 @@ void BinlogEventsProcessor::do_event(BinlogEvent &&event) {
total_raw_events_size_ += static_cast<int64>(event.raw_event_.size());
events_[pos] = std::move(event);
}
} else if (event.type_ == BinlogEvent::ServiceTypes::Empty) {
// just skip this event
} else if (event.type_ < 0) {
// just skip service events
} else {
CHECK(ids_.empty() || ids_.back() < fixed_id);
last_id_ = event.id_;

View File

@ -34,6 +34,22 @@ static typename ContainerT::value_type &rand_elem(ContainerT &cont) {
return cont[Random::fast(0, static_cast<int>(cont.size()) - 1)];
}
TEST(DB, binlog_encryption_bug) {
CSlice binlog_name = "test_binlog";
Binlog::destroy(binlog_name).ignore();
auto cucumber = DbKey::password("cucumber");
auto empty = DbKey::empty();
{
Binlog binlog;
binlog.init(binlog_name.str(), [&](const BinlogEvent &x) {}, cucumber).ensure();
}
{
Binlog binlog;
binlog.init(binlog_name.str(), [&](const BinlogEvent &x) {}, cucumber).ensure();
}
}
TEST(DB, binlog_encryption) {
CSlice binlog_name = "test_binlog";
Binlog::destroy(binlog_name).ignore();