Binlog dump: add event size.

GitOrigin-RevId: 871d204c135226cf46e4591304d1d7413e218a62
This commit is contained in:
levlam 2019-06-13 20:22:16 +03:00
parent 53ce0a1ebb
commit 22959280c1

View File

@ -28,19 +28,19 @@ int main(int argc, char *argv[]) {
SET_VERBOSITY_LEVEL(VERBOSITY_NAME(ERROR)); SET_VERBOSITY_LEVEL(VERBOSITY_NAME(ERROR));
td::Binlog binlog; td::Binlog binlog;
binlog binlog
.init( .init(argv[1],
argv[1], [&](auto &event) {
[&](auto &event) { info[0].compressed_size += event.raw_event_.size();
info[0].compressed_size += event.raw_event_.size(); info[event.type_].compressed_size += event.raw_event_.size();
info[event.type_].compressed_size += event.raw_event_.size(); },
}, td::DbKey::raw_key("cucumber"), td::DbKey::empty(), -1,
td::DbKey::raw_key("cucumber"), td::DbKey::empty(), -1, [&](auto &event) mutable {
[&](auto &event) mutable { info[0].full_size += event.raw_event_.size();
info[0].full_size += event.raw_event_.size(); info[event.type_].full_size += event.raw_event_.size();
info[event.type_].full_size += event.raw_event_.size(); LOG(PLAIN) << "LogEvent[" << td::tag("id", td::format::as_hex(event.id_)) << td::tag("type", event.type_)
LOG(PLAIN) << "LogEvent[" << td::tag("id", td::format::as_hex(event.id_)) << td::tag("type", event.type_) << td::tag("flags", event.flags_) << td::tag("size", event.data_.size())
<< td::tag("flags", event.flags_) << td::tag("data", td::format::escaped(event.data_)) << "]\n"; << td::tag("data", td::format::escaped(event.data_)) << "]\n";
}) })
.ensure(); .ensure();
for (auto &it : info) { for (auto &it : info) {