@@ -194,7 +194,8 @@ class LevelDBKV : public KVInterface<K, V> {
194194 }
195195
196196 Status GetShardedSnapshot (
197- std::vector<K>* key_list, std::vector<void *>* value_ptr_list,
197+ std::vector<std::vector<K>>& key_list,
198+ std::vector<std::vector<void *>>& value_ptr_list,
198199 int partition_id, int partition_nums) override {
199200 ReadOptions options;
200201 options.snapshot = db_->GetSnapshot ();
@@ -203,8 +204,9 @@ class LevelDBKV : public KVInterface<K, V> {
203204 for (it->SeekToFirst (); it->Valid (); it->Next ()) {
204205 K key;
205206 memcpy ((char *)&key, it->key ().ToString ().data (), sizeof (K));
206- if (key % kSavedPartitionNum % partition_nums == partition_id) continue ;
207- key_list->emplace_back (key);
207+ int part_id = key % kSavedPartitionNum % partition_nums;
208+ if (part_id == partition_id) continue ;
209+ key_list[part_id].emplace_back (key);
208210 FeatureDescriptor<V> hbm_feat_desc (
209211 1 , 1 , ev_allocator ()/* useless*/ ,
210212 StorageType::HBM_DRAM, true , true ,
@@ -218,7 +220,7 @@ class LevelDBKV : public KVInterface<K, V> {
218220 value_ptr, feat_desc_->GetFreq (dram_value_ptr));
219221 hbm_feat_desc.UpdateVersion (
220222 value_ptr, feat_desc_->GetVersion (dram_value_ptr));
221- value_ptr_list-> emplace_back (value_ptr);
223+ value_ptr_list[part_id]. emplace_back (value_ptr);
222224 }
223225 delete it;
224226 feat_desc_->Deallocate (dram_value_ptr);
0 commit comments