| 84 | void LogReplicator::SetRole(const ReplicatorRole& role) { role_ = role; } |
| 85 | |
| 86 | void LogReplicator::SyncToDisk() { |
| 87 | std::lock_guard<std::mutex> lock(wmu_); |
| 88 | if (wh_ != NULL) { |
| 89 | uint64_t consumed = ::baidu::common::timer::get_micros(); |
| 90 | ::fedb::base::Status status = wh_->Sync(); |
| 91 | if (!status.ok()) { |
| 92 | PDLOG(WARNING, "fail to sync data for path %s", path_.c_str()); |
| 93 | } |
| 94 | consumed = ::baidu::common::timer::get_micros() - consumed; |
| 95 | if (consumed > 20000) { |
| 96 | PDLOG(INFO, "sync to disk for path %s consumed %lld ms", |
| 97 | path_.c_str(), consumed / 1000); |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | bool LogReplicator::Init() { |
| 103 | logs_ = new LogParts(12, 4, scmp); |
no test coverage detected