Skip to content

Commit e1c7507

Browse files
committed
Revert "os/bluestore: Modify _deferred_replay"
This reverts commit c10a794. Signed-off-by: Matan Breizman <[email protected]>
1 parent caa77ed commit e1c7507

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

src/os/bluestore/BlueStore.cc

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15119,7 +15119,7 @@ void BlueStore::_kv_sync_thread()
1511915119
auto sync_start = mono_clock::now();
1512015120
#endif
1512115121
// submit synct synchronously (block and wait for it to commit)
15122-
int r = cct->_conf->bluestore_debug_omit_kv_commit ?
15122+
int r = db_was_opened_read_only || cct->_conf->bluestore_debug_omit_kv_commit ?
1512315123
0 : db->submit_transaction_sync(synct);
1512415124
ceph_assert(r == 0);
1512515125

@@ -15518,14 +15518,19 @@ int BlueStore::_deferred_replay()
1551815518
}
1551915519
);
1552015520
}
15521+
CollectionRef ch = _get_collection(coll_t::meta());
15522+
bool fake_ch = false;
15523+
if (!ch) {
15524+
// hmm, replaying initial mkfs?
15525+
ch = static_cast<Collection*>(create_new_collection(coll_t::meta()).get());
15526+
fake_ch = true;
15527+
}
15528+
OpSequencer *osr = static_cast<OpSequencer*>(ch->osr.get());
1552115529
if (tracepoint_debug_deferred_replay_start) tracepoint_debug_deferred_replay_start();
15522-
IOContext ioctx(cct, nullptr);
15523-
KeyValueDB::Transaction t = db->get_transaction();
1552415530
KeyValueDB::Iterator it = db->get_iterator(PREFIX_DEFERRED);
1552515531
for (it->lower_bound(string()); it->valid(); it->next(), ++count) {
1552615532
dout(20) << __func__ << " replay " << pretty_binary_string(it->key())
1552715533
<< dendl;
15528-
t->rmkey(PREFIX_DEFERRED, it->key());
1552915534
bluestore_deferred_transaction_t *deferred_txn =
1553015535
new bluestore_deferred_transaction_t;
1553115536
bufferlist bl = it->value();
@@ -15542,29 +15547,22 @@ int BlueStore::_deferred_replay()
1554215547
bool has_some = _eliminate_outdated_deferred(deferred_txn, bluefs_extents);
1554315548
if (has_some) {
1554415549
if (tracepoint_debug_deferred_replay_track) tracepoint_debug_deferred_replay_track(*deferred_txn);
15545-
for (auto& op: deferred_txn->ops) {
15546-
for (auto& e : op.extents) {
15547-
bufferlist t;
15548-
op.data.splice(0, e.length, &t);
15549-
bdev->aio_write(e.offset, t, &ioctx, false);
15550-
}
15551-
}
15550+
TransContext *txc = _txc_create(ch.get(), osr, nullptr);
15551+
txc->deferred_txn = deferred_txn;
15552+
txc->set_state(TransContext::STATE_KV_DONE);
15553+
_txc_state_proc(txc);
1555215554
} else {
1555315555
delete deferred_txn;
1555415556
}
1555515557
}
1555615558
out:
15557-
bdev->aio_submit(&ioctx);
15558-
dout(20) << __func__ << "waiting to complete IO" << dendl;
15559-
ioctx.aio_wait();
15560-
dout(20) << __func__ << "wait done" << dendl;
15561-
if (!db_was_opened_read_only) {
15562-
db->submit_transaction_sync(t);
15563-
dout(20) << __func__ << "removed L keys" << dendl;
15564-
} else {
15565-
dout(10) << __func__ << "DB read-pnly, skipped L keys removal" << dendl;
15566-
}
15559+
dout(20) << __func__ << " draining osr" << dendl;
15560+
_osr_register_zombie(osr);
15561+
_osr_drain_all();
1556715562
if (tracepoint_debug_deferred_replay_end) tracepoint_debug_deferred_replay_end();
15563+
if (fake_ch) {
15564+
new_coll_map.clear();
15565+
}
1556815566
dout(10) << __func__ << " completed " << count << " events" << dendl;
1556915567
return r;
1557015568
}

0 commit comments

Comments
 (0)