]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: Refuse to commit/rollforward beyond end of log.
authorAlex Ainscow <aainscow@uk.ibm.com>
Tue, 13 May 2025 11:55:14 +0000 (12:55 +0100)
committerLaura Flores <lflores@ibm.com>
Wed, 9 Jul 2025 15:47:24 +0000 (15:47 +0000)
In optimised EC, if transaction is applied to all shards, followed by a
partial transaction AND these two transactions overlap, then it is
possible for the non-primary shards to commit a version which is after
then end of the log.

This commit changes the apply_log such that the commit version will be
changed to the head of the log in such situations.

Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
(cherry picked from commit 912437d47053f92086261e285462ac5b4d8d749a)

src/osd/PeeringState.cc

index 0b0b3c881bec1251f13752caa529ff59d6410be9..7e6d06c9343dac55faf5151cab723acef70d2a06 100644 (file)
@@ -4503,6 +4503,20 @@ void PeeringState::append_log(
   bool transaction_applied,
   bool async)
 {
+  /* With EC optimisations on, it is possible that we are told to commit a
+   * version we don't have. This happens when the multiple transactions were
+   * in flight and the last was a partial write.
+   * While this is technically valid, there are a number of asserts which can
+   * be avoided by refusing to roll forward beyond the head of the log.
+   */
+  if (pool.info.allows_ecoptimizations()) {
+    if (roll_forward_to > pg_log.get_head()) {
+      roll_forward_to = pg_log.get_head();
+    }
+    if (pct > pg_log.get_head()) {
+      pct = pg_log.get_head();
+    }
+  }
   /* The primary has sent an info updating the history, but it may not
    * have arrived yet.  We want to make sure that we cannot remember this
    * write without remembering that it happened in an interval which went