| 163 | } |
| 164 | |
| 165 | int ReplicateNode::MatchLogOffsetFromNode() { |
| 166 | ::fedb::api::AppendEntriesRequest request; |
| 167 | request.set_tid(tid_); |
| 168 | request.set_pid(pid_); |
| 169 | request.set_term(term_->load(std::memory_order_relaxed)); |
| 170 | request.set_pre_log_index(0); |
| 171 | ::fedb::api::AppendEntriesResponse response; |
| 172 | bool ret = rpc_client_.SendRequest( |
| 173 | &::fedb::api::TabletServer_Stub::AppendEntries, &request, &response, |
| 174 | FLAGS_request_timeout_ms, FLAGS_request_max_retry); |
| 175 | if (ret && response.code() == 0) { |
| 176 | last_sync_offset_ = response.log_offset(); |
| 177 | log_matched_ = true; |
| 178 | log_reader_.SetOffset(last_sync_offset_); |
| 179 | PDLOG(INFO, "match node %s log offset %lu for table tid %u pid %u", |
| 180 | endpoint_.c_str(), last_sync_offset_, tid_, pid_); |
| 181 | return 0; |
| 182 | } |
| 183 | PDLOG(WARNING, "match node %s log offset failed. tid %u pid %u", |
| 184 | endpoint_.c_str(), tid_, pid_); |
| 185 | return -1; |
| 186 | } |
| 187 | |
| 188 | int ReplicateNode::SyncData(uint64_t log_offset) { |
| 189 | DEBUGLOG("node[%s] offset[%lu] log offset[%lu]", endpoint_.c_str(), |
nothing calls this directly
no test coverage detected