MCPcopy Create free account
hub / github.com/apache/kvrocks / parseKVFromLocalStorage

Method parseKVFromLocalStorage

utils/kvrocks2redis/sync.cc:148–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148void 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
170Status Sync::updateNextSeq(rocksdb::SequenceNumber seq) {
171 next_seq_ = seq;

Callers

nothing calls this directly

Calls 5

ParseFullDBMethod · 0.80
GetDBMethod · 0.80
FlushDBMethod · 0.45
IsOKMethod · 0.45
MsgMethod · 0.45

Tested by

no test coverage detected