This is an automated email from the ASF dual-hosted git repository.
dspavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
The following commit(s) were added to refs/heads/master by this push:
new a2fbf14a Minor fix for migrator manual run (#223)
a2fbf14a is described below
commit a2fbf14aa8bb12a1793dab8962013c1182fcac7e
Author: ignitetcbot <[email protected]>
AuthorDate: Sat May 9 15:58:22 2026 +0300
Minor fix for migrator manual run (#223)
Co-authored-by: Dmitriy Pavlov <[email protected]>
---
.../apache/ignite/migrate/GridIntListMigrator.java | 2 +-
.../ignite/migrate/GridIntListMigratorTest.java | 46 ++++++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletion(-)
diff --git
a/migrator/src/main/java/org/apache/ignite/migrate/GridIntListMigrator.java
b/migrator/src/main/java/org/apache/ignite/migrate/GridIntListMigrator.java
index e4d90fe2..93d2ba7b 100644
--- a/migrator/src/main/java/org/apache/ignite/migrate/GridIntListMigrator.java
+++ b/migrator/src/main/java/org/apache/ignite/migrate/GridIntListMigrator.java
@@ -275,7 +275,7 @@ public final class GridIntListMigrator {
RecoveryDump dump = dumpFailedEntriesSafely(ignite,
failureDetails);
- if (tryAutoRepair(ignite, failureDetails, dump)) {
+ if (apply && tryAutoRepair(ignite, failureDetails, dump)) {
log.info("GridIntList migration auto-repair completed. Deleted
failed entries: {}", totalFailed);
return totalUpdated;
diff --git
a/migrator/src/test/java/org/apache/ignite/migrate/GridIntListMigratorTest.java
b/migrator/src/test/java/org/apache/ignite/migrate/GridIntListMigratorTest.java
index db0526d5..3f415896 100644
---
a/migrator/src/test/java/org/apache/ignite/migrate/GridIntListMigratorTest.java
+++
b/migrator/src/test/java/org/apache/ignite/migrate/GridIntListMigratorTest.java
@@ -39,6 +39,7 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyCollection;
import static org.mockito.ArgumentMatchers.anyString;
@@ -196,6 +197,51 @@ public class GridIntListMigratorTest {
}
}
+ /**
+ * Checks that dry-run mode never removes failed entries.
+ */
+ @Test public void dryRunDumpsDiagnosticsButDoesNotAutoRepair() throws
Exception {
+ Long failedKey = 6062419808021002488L;
+ Ignite ignite = mock(Ignite.class);
+ IgniteCache<Object, Object> rawCache = mock(IgniteCache.class);
+ IgniteCache<Object, Object> binCache = mock(IgniteCache.class);
+ QueryCursor<Cache.Entry<Object, Object>> cursor =
mock(QueryCursor.class);
+ IgniteSnapshot snapshot = mock(IgniteSnapshot.class);
+ IgniteFuture<Void> dumpFut = mock(IgniteFuture.class);
+ java.io.File workDir = tmp.newFolder("ignite-work-dry-run");
+
+ when(ignite.cacheNames()).thenReturn(Collections.singleton(FAT_BUILD));
+ when(ignite.cache(FAT_BUILD)).thenReturn(rawCache);
+ when(ignite.configuration()).thenReturn(new IgniteConfiguration()
+ .setWorkDirectory(workDir.getAbsolutePath()));
+ when(ignite.snapshot()).thenReturn(snapshot);
+ when(snapshot.createDump(anyString(),
anyCollection())).thenAnswer(invocation -> {
+ String dumpName = invocation.getArgument(0);
+
+
Files.createDirectories(workDir.toPath().resolve("snapshots").resolve(dumpName));
+
+ return dumpFut;
+ });
+ when(rawCache.withKeepBinary()).thenReturn(binCache);
+ when(binCache.query(any(ScanQuery.class))).thenReturn(cursor);
+ when(cursor.iterator()).thenReturn(Collections.<Cache.Entry<Object,
Object>>singletonList(
+ new TestEntry(failedKey, new BrokenBinaryObject())).iterator());
+
+ try {
+ GridIntListMigrator.migrateOnInstance(ignite, null, false, false,
1);
+
+ fail("Dry-run migration must fail after reporting diagnostics for
failed entries");
+ }
+ catch (IllegalStateException e) {
+ assertTrue(e.getMessage().contains("GridIntList migration failed
for 1 entries"));
+ }
+
+ verify(binCache, never()).remove(failedKey);
+
+ Path dumpDir =
workDir.toPath().resolve("diagnostic").resolve("grid-int-list-migration-recovery");
+ assertTrue("Dry-run should still write diagnostics",
Files.isDirectory(dumpDir));
+ }
+
/**
* Checks that unrelated caches are skipped by default, including the
cache that exposed the production failure.
*/