You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2022/10/24 16:48:40 UTC
[ignite] 01/02: Add a test reproducing the issue.
This is an automated email from the ASF dual-hosted git repository.
amashenkov pushed a commit to branch ignite-17964
in repository https://gitbox.apache.org/repos/asf/ignite.git
commit 2c294d201220c0b34c255919aa493e6bc3647f41
Author: amashenkov <an...@gmail.com>
AuthorDate: Mon Oct 24 19:47:55 2022 +0300
Add a test reproducing the issue.
---
.../query/stat/StatisticsConfigurationTest.java | 44 ++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/stat/StatisticsConfigurationTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/stat/StatisticsConfigurationTest.java
index b814de5a51b..eced0606697 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/stat/StatisticsConfigurationTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/stat/StatisticsConfigurationTest.java
@@ -394,6 +394,50 @@ public class StatisticsConfigurationTest extends StatisticsAbstractTest {
(stats) -> stats.forEach(s -> assertNull("Invalid stats: " + stats, s.columnStatistics("A"))));
}
+ /**
+ * Checks orphan records cleanup on activation doesn't lead to grid hanging.
+ * - Start the grid, create table and collect statistics.
+ * - Ensure statistics for the table exists.
+ * - Disable StatisticsManagerConfiguration to prevent configuration changes in metastorage.
+ * - Drop table.
+ * - Re-activate the grid.
+ * - Ensures statistics for the table was dropped as well.
+ *
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testOrphanDataCleanup() throws Exception {
+ startGrids(2);
+
+ grid(0).cluster().state(ClusterState.ACTIVE);
+
+ createSmallTable(null);
+
+ collectStatistics(StatisticsType.GLOBAL, SMALL_TARGET);
+
+ waitForStats(SCHEMA, "SMALL", TIMEOUT, checkTotalRows, checkColumStats);
+
+ // Stop StatisticsConfigurationManager with all it's listeners, so metastorage won't be updated.
+ statisticsMgr(0).statisticConfiguration().stop();
+ statisticsMgr(1).statisticConfiguration().stop();
+
+ dropSmallTable(null);
+
+ waitForStats(SCHEMA, "SMALL", TIMEOUT, (stats) -> stats.forEach(s -> assertNotNull(s)));
+
+ checkStatisticsInMetastore(grid(0).context().cache().context().database(), TIMEOUT,
+ SCHEMA, "SMALL", (s -> assertNotNull(s.data().get("A"))));
+
+ // Restarts StatisticsConfigurationManager and trigger cleanup of orphan record in metastorage.
+ grid(0).cluster().state(ClusterState.INACTIVE);
+ grid(0).cluster().state(ClusterState.ACTIVE);
+
+ waitForStats(SCHEMA, "SMALL", TIMEOUT, (stats) -> stats.forEach(s -> assertNull(s)));
+
+ checkStatisticsInMetastore(grid(0).context().cache().context().database(), TIMEOUT,
+ SCHEMA, "SMALL", (s -> assertNull(s.data().get("A"))));
+ }
+
/**
* Check drop statistics when table is dropped.
*/