@@ -199,6 +199,54 @@ void ConcurrentMasstreeIndex::GetRecord(transaction *t, rc_t &rc, const varstr &
199
199
}
200
200
}
201
201
202
+ void ConcurrentMasstreeIndex::GetRecordMulti (transaction *t, rc_t &rc, const varstr &key,
203
+ std::vector<varstr> &result_vec, std::vector<OID> *out_oid) {
204
+ rc = {RC_INVALID};
205
+ OID dir_oid = INVALID_OID;
206
+ std::vector<OID> oids;
207
+ ermia::varstr tmpval;
208
+ if (!t) {
209
+ auto e = MM::epoch_enter ();
210
+ rc._val = masstree_.search (key, dir_oid, e, nullptr ) ? RC_TRUE : RC_FALSE;
211
+ MM::epoch_exit (0 , e);
212
+ } else {
213
+ t->ensure_active ();
214
+ bool found = masstree_.search (key, dir_oid, t->xc ->begin_epoch , nullptr );
215
+ dbtuple *tuple = nullptr ;
216
+ if (found) {
217
+ LOG_IF (FATAL, config::is_backup_srv ()) << " GetRecordMulti is not supportted for backup server" ;
218
+ bool ok = oidmgr->oid_get_dir (table_descriptor->GetTupleArray (), dir_oid, oids);
219
+ ALWAYS_ASSERT (ok);
220
+ for (auto &o : oids) {
221
+ tuple = oidmgr->oid_get_version (table_descriptor->GetTupleArray (), o, t->xc );
222
+ if (!tuple) {
223
+ DLOG (WARNING) << " (SKIPPED) Some tuple is empty: OID = " << std::hex << o;
224
+ found = false ;
225
+ }
226
+
227
+ if (found) {
228
+ bool ret = t->DoTupleRead (tuple, &tmpval)._val ;
229
+ if (!ret) {
230
+ DLOG (WARNING) << " (SKIPPED) Cannot do tuple read for OID = " << std::hex << o;
231
+ continue ;
232
+ }
233
+ result_vec.push_back (tmpval);
234
+ } else if (config::phantom_prot) {
235
+ // volatile_write(rc._val, DoNodeRead(t, sinfo.first, sinfo.second)._val);
236
+ } else {
237
+ continue ;
238
+ }
239
+ }
240
+ volatile_write (rc._val , RC_TRUE);
241
+ return ;
242
+ } else {
243
+ volatile_write (rc._val , RC_FALSE);
244
+ return ;
245
+ }
246
+ }
247
+ }
248
+
249
+
202
250
void ConcurrentMasstreeIndex::PurgeTreeWalker::on_node_begin (
203
251
const typename ConcurrentMasstree::node_opaque_t *n) {
204
252
ASSERT (spec_values.empty ());
0 commit comments