You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by hg...@apache.org on 2026/10/01 22:44:34 UTC

(iggy) 02/02: fix(server): sync partition hierarchy before persisted recovery

This is an automated email from the ASF dual-hosted git repository.

hubcio pushed a commit to branch fix/partition-recovery-and-old-requests
in repository https://gitbox.apache.org/repos/asf/iggy.git

commit 487d8d56efb5da44f6011abf46c1dbde2e0cd220
Author: Hubert Gruszecki <h....@gmail.com>
AuthorDate: Fri Oct 2 00:39:16 2026 +0200

    fix(server): sync partition hierarchy before persisted recovery
    
    Recovery left replacement directories without durable parent
    entries, so a power loss can discard acknowledged writes.
    
    Reuse the hierarchy barrier for persisted recovery. Repeat it for
    matching markers so retries cannot bypass a failed sync.
---
 core/server/src/partition_helpers.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/core/server/src/partition_helpers.rs b/core/server/src/partition_helpers.rs
index 3ecaf5152..2ad1ffb17 100644
--- a/core/server/src/partition_helpers.rs
+++ b/core/server/src/partition_helpers.rs
@@ -262,6 +262,12 @@ pub async fn load_partition_or_fence(
         create_dir_all(&directory).await.map_err(revision_io)?;
         record_created_revision(&directory, created_revision).await?;
     }
+    // A matching marker can outlive a failed hierarchy sync, so retries repeat this barrier.
+    if topic_runtime.durability.is_persisted()
+        || topic_runtime.consumer_offset_durability.is_persisted()
+    {
+        persist_partition_hierarchy(&directory, &config.get_system_path()).await?;
+    }
     // Heap-pinned: the loader's and the rebuilder's futures side by side
     // outgrow clippy's `large_futures` cap, and this runs once per partition.
     match Box::pin(load_partition(
@@ -1925,7 +1931,11 @@ mod tests {
                 created_revision,
                 created_view,
             ),
-            TopicRuntimeOptions::default(),
+            TopicRuntimeOptions {
+                durability: iggy_common::Durability::Persisted,
+                consumer_offset_durability: iggy_common::Durability::Persisted,
+                ..TopicRuntimeOptions::default()
+            },
             CLUSTER,
             REPLICA,
             REPLICAS,