From 84ed3c6395a5ef652ee709456ff3666eb041745b Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 30 Jun 2023 02:30:23 +0300 Subject: [PATCH] Fix CAS retries during snapshot merge --- src/cli_merge.cpp | 4 ++-- src/cluster_client.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cli_merge.cpp b/src/cli_merge.cpp index 512eeba3..85544e3d 100644 --- a/src/cli_merge.cpp +++ b/src/cli_merge.cpp @@ -533,7 +533,7 @@ struct snap_merger_t if (use_cas && subop->retval == -EINTR) { // CAS failure - reread and repeat optimistically - rwo->start = subop->offset - rwo->offset; + rwo->start = rwo->end = 0; rwo_read(rwo); delete subop; return; @@ -543,7 +543,7 @@ struct snap_merger_t rwo->error_read = false; } // Increment CAS version - rwo->op.version++; + rwo->op.version = subop->version; if (use_cas) next_write(rwo); else diff --git a/src/cluster_client.cpp b/src/cluster_client.cpp index 2eba937b..2cfef2e5 100644 --- a/src/cluster_client.cpp +++ b/src/cluster_client.cpp @@ -1209,6 +1209,10 @@ void cluster_client_t::handle_op_part(cluster_op_part_t *part) copy_part_bitmap(op, part); op->version = op->parts.size() == 1 ? part->op.reply.rw.version : 0; } + else if (op->opcode == OSD_OP_WRITE) + { + op->version = op->parts.size() == 1 ? part->op.reply.rw.version : 0; + } if (op->inflight_count == 0) { if (op->opcode == OSD_OP_SYNC)