You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ib...@apache.org on 2022/01/19 09:11:27 UTC

[ignite] branch master updated: IGNITE-16324 wal-reader can't parse negative groupId/cacheId (#9745)

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

ibessonov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new f592749  IGNITE-16324 wal-reader can't parse negative groupId/cacheId (#9745)
f592749 is described below

commit f592749b5b792739e40aed898a2c75eddbf93da2
Author: Kirill Tkalenko <tk...@yandex.ru>
AuthorDate: Wed Jan 19 12:10:59 2022 +0300

    IGNITE-16324 wal-reader can't parse negative groupId/cacheId (#9745)
---
 .../development/utils/IgniteWalConverterArguments.java |  2 +-
 .../utils/IgniteWalConverterArgumentsTest.java         | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/modules/dev-utils/src/main/java/org/apache/ignite/development/utils/IgniteWalConverterArguments.java b/modules/dev-utils/src/main/java/org/apache/ignite/development/utils/IgniteWalConverterArguments.java
index b6f9e47..ec4c5a8 100644
--- a/modules/dev-utils/src/main/java/org/apache/ignite/development/utils/IgniteWalConverterArguments.java
+++ b/modules/dev-utils/src/main/java/org/apache/ignite/development/utils/IgniteWalConverterArguments.java
@@ -86,7 +86,7 @@ public class IgniteWalConverterArguments {
     private static final String PAGES = "pages";
 
     /** Record pattern for {@link #PAGES}. */
-    private static final Pattern PAGE_ID_PATTERN = Pattern.compile("(\\d+):(\\d+)");
+    private static final Pattern PAGE_ID_PATTERN = Pattern.compile("(-?\\d+):(-?\\d+)");
 
     /** Path to dir with wal files. */
     private final File walDir;
diff --git a/modules/dev-utils/src/test/java/org/apache/ignite/development/utils/IgniteWalConverterArgumentsTest.java b/modules/dev-utils/src/test/java/org/apache/ignite/development/utils/IgniteWalConverterArgumentsTest.java
index 0b710a3b..fba6dba 100644
--- a/modules/dev-utils/src/test/java/org/apache/ignite/development/utils/IgniteWalConverterArgumentsTest.java
+++ b/modules/dev-utils/src/test/java/org/apache/ignite/development/utils/IgniteWalConverterArgumentsTest.java
@@ -445,6 +445,9 @@ public class IgniteWalConverterArgumentsTest extends GridCommonAbstractTest {
             assertThrows(log, () -> parsePageId(v), IllegalArgumentException.class, null);
 
         assertEquals(new T2<>(1, 1L), parsePageId("1:1"));
+        assertEquals(new T2<>(-1, 1L), parsePageId("-1:1"));
+        assertEquals(new T2<>(1, -1L), parsePageId("1:-1"));
+        assertEquals(new T2<>(-1, -1L), parsePageId("-1:-1"));
     }
 
     /**
@@ -474,6 +477,15 @@ public class IgniteWalConverterArgumentsTest extends GridCommonAbstractTest {
 
             U.writeStringToFile(f, U.nl() + "2:2", defaultCharset().toString(), true);
             assertEqualsCollections(F.asList(new T2<>(1, 1L), new T2<>(2, 2L)), parsePageIds(f));
+
+            U.writeStringToFile(f, U.nl() + "-1:1", defaultCharset().toString(), true);
+            U.writeStringToFile(f, U.nl() + "1:-1", defaultCharset().toString(), true);
+            U.writeStringToFile(f, U.nl() + "-1:-1", defaultCharset().toString(), true);
+
+            assertEqualsCollections(
+                F.asList(new T2<>(1, 1L), new T2<>(2, 2L), new T2<>(-1, 1L), new T2<>(1, -1L), new T2<>(-1, -1L)),
+                parsePageIds(f)
+            );
         }
         finally {
             assertTrue(U.delete(f));
@@ -491,7 +503,11 @@ public class IgniteWalConverterArgumentsTest extends GridCommonAbstractTest {
         assertThrows(log, () -> parsePageIds("1:1", "a:b"), IllegalArgumentException.class, null);
 
         assertEqualsCollections(F.asList(new T2<>(1, 1L)), parsePageIds("1:1"));
-        assertEqualsCollections(F.asList(new T2<>(1, 1L), new T2<>(2, 2L)), parsePageIds("1:1", "2:2"));
+
+        assertEqualsCollections(
+            F.asList(new T2<>(1, 1L), new T2<>(2, 2L), new T2<>(-1, 1L), new T2<>(1, -1L), new T2<>(-1, -1L)),
+            parsePageIds("1:1", "2:2", "-1:1", "1:-1", "-1:-1")
+        );
     }
 
     /**