| 146 | } |
| 147 | |
| 148 | void Sync::parseKVFromLocalStorage() { |
| 149 | INFO("Start parsing kv from the local storage"); |
| 150 | for (const auto &iter : config_->tokens) { |
| 151 | auto s = writer_->FlushDB(iter.first); |
| 152 | if (!s.IsOK()) { |
| 153 | ERROR("Failed to flush target redis db in namespace: {}, encounter error: {}", iter.first, s.Msg()); |
| 154 | return; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | Status s = parser_->ParseFullDB(); |
| 159 | if (!s.IsOK()) { |
| 160 | ERROR("Failed to parse full db, encounter error: {}", s.Msg()); |
| 161 | return; |
| 162 | } |
| 163 | auto last_seq = storage_->GetDB()->GetLatestSequenceNumber(); |
| 164 | s = updateNextSeq(last_seq + 1); |
| 165 | if (!s.IsOK()) { |
| 166 | ERROR("Failed to update next sequence: {}", s.Msg()); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | Status Sync::updateNextSeq(rocksdb::SequenceNumber seq) { |
| 171 | next_seq_ = seq; |
nothing calls this directly
no test coverage detected