From 01f220d47add49c449a0b735d325514798f61a3b Mon Sep 17 00:00:00 2001
From: Alexander Rutkovsky <alexvru@ydb.tech>
Date: Thu, 20 Mar 2025 14:08:32 +0000
Subject: [PATCH] Fix replication bug

---
 .../blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp b/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp
index 4acb4567276f..dc9974520681 100644
--- a/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp
+++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp
@@ -124,12 +124,12 @@ namespace NKikimr {
 
                 if (AddingTasks) {
                     for (; it.Valid(); it.Next()) {
+                        StartKey = it.GetCurKey().LogoBlobID();
+
                         if (checkRestart()) {
                             return;
                         }
 
-                        StartKey = it.GetCurKey().LogoBlobID();
-
                         // we still have some space in recovery machine logic, so we can add new item
                         ProcessItem(it, *barriers, allowKeepFlags);
                         MilestoneQueue.PopIfNeeded(StartKey);
@@ -147,12 +147,12 @@ namespace NKikimr {
                 }
 
                 for (; it.Valid(); it.Next()) {
+                    StartKey = it.GetCurKey().LogoBlobID();
+
                     if (checkRestart()) {
                         return;
                     }
 
-                    StartKey = it.GetCurKey().LogoBlobID();
-
                     // check the milestone queue, if we have requested blob
                     if (MilestoneQueue.Match(StartKey, &ReplInfo->ItemsTotal, &ReplInfo->WorkUnitsTotal)) {
                         break;