Skip to content

Commit 7462b1c

Browse files
committed
crimson/osd/pg: Handle peer replies handling once received
Instead of updating last complete on disk and calling complete_write in PG::submit_transacion (chained to all_completed). Move the completion handling earlier as soon as all the peers acked. This essentially means that we move the handling to ReplicatedBackend::get_rep_op_reply, unless replication size is 1 - then we would mark completion in ReplicatedBackend::submit_transaction. Fixes: https://tracker.ceph.com/issues/69439 Signed-off-by: Matan Breizman <[email protected]> Signed-off-by: Xuehan Xu <[email protected]>
1 parent 522cc6c commit 7462b1c

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/crimson/osd/pg.cc

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -930,16 +930,7 @@ PG::submit_transaction(
930930
std::move(log_entries));
931931
co_return std::make_tuple(
932932
std::move(submitted),
933-
all_completed.then_interruptible(
934-
[this, last_complete=peering_state.get_info().last_complete, at_version]
935-
(auto acked) {
936-
for (const auto& peer : acked) {
937-
peering_state.update_peer_last_complete_ondisk(
938-
peer.shard, peer.last_complete_ondisk);
939-
}
940-
peering_state.complete_write(at_version, last_complete);
941-
return seastar::now();
942-
})
933+
std::move(all_completed)
943934
);
944935
}
945936

src/crimson/osd/replicated_backend.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,13 @@ ReplicatedBackend::submit_transaction(
166166
assert(0 == "impossible");
167167
}
168168
if (--peers->pending == 0) {
169+
// no peers other than me, replication size is 1
170+
pg.complete_write(peers->at_version, peers->last_complete);
169171
peers->all_committed.set_value();
170172
peers->all_committed = {};
171173
return seastar::now();
172174
}
175+
// wait for all peers to ack (ReplicatedBackend::got_rep_op_reply)
173176
return peers->all_committed.get_shared_future();
174177
}).then_interruptible([pending_txn, this, _new_clone, &hoid,
175178
to_push_delete=std::move(to_push_delete),
@@ -216,7 +219,10 @@ void ReplicatedBackend::got_rep_op_reply(const MOSDRepOpReply& reply)
216219
for (auto& peer : peers.acked_peers) {
217220
if (peer.shard == reply.from) {
218221
peer.last_complete_ondisk = reply.get_last_complete_ondisk();
222+
pg.update_peer_last_complete_ondisk(
223+
peer.shard, peer.last_complete_ondisk);
219224
if (--peers.pending == 0) {
225+
pg.complete_write(peers.at_version, peers.last_complete);
220226
peers.all_committed.set_value();
221227
peers.all_committed = {};
222228
}

0 commit comments

Comments
 (0)