sanpwc commented on code in PR #5197: URL: https://github.com/apache/ignite-3/pull/5197#discussion_r1956202520
########## modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java: ########## @@ -842,6 +856,97 @@ public void testScanCloseReplicaRequest(TestInfo testInfo) throws Exception { assertDoesNotThrow(tx::commit); } + @Test + public void testCatalogCompaction(TestInfo testInfo) throws Exception { + // How often we update the low water mark. + long lowWatermarkUpdateInterval = 500; + updateLowWatermarkConfiguration(lowWatermarkUpdateInterval * 2, lowWatermarkUpdateInterval); + + // Prepare a single node cluster. + startNodes(testInfo, 1); + Node node = getNode(0); + + List<Set<Assignment>> assignments = PartitionDistributionUtils.calculateAssignments( + nodes.values().stream().map(n -> n.name).collect(toList()), 1, 1); + + List<TokenizedAssignments> tokenizedAssignments = assignments.stream() + .map(a -> new TokenizedAssignmentsImpl(a, Integer.MIN_VALUE)) + .collect(toList()); + + placementDriver.setPrimary(node.clusterService.topologyService().localMember()); + placementDriver.setAssignments(tokenizedAssignments); + + forceCheckpoint(node); + + String zoneName = "test-zone"; + createZone(node, zoneName, 1, 1); + int zoneId = DistributionZonesTestUtil.getZoneId(node.catalogManager, zoneName, node.hybridClock.nowLong()); + prepareTableIdToZoneIdConverter(node, zoneId); + + int catalogVersion1 = getLatestCatalogVersion(node); + + String tableName1 = "test_table_1"; + createTable(node, zoneName, tableName1); + + String tableName2 = "test_table_2"; + createTable(node, zoneName, tableName2); + + int tableId = TableTestUtils.getTableId(node.catalogManager, tableName2, node.hybridClock.nowLong()); + TableViewInternal tableViewInternal = node.tableManager.table(tableId); + KeyValueView<Long, Integer> tableView = tableViewInternal.keyValueView(Long.class, Integer.class); + + // Write 2 rows to the table. + Map<Long, Integer> valuesToPut = Map.of(0L, 0, 1L, 1); + assertDoesNotThrow(() -> tableView.putAll(null, valuesToPut)); + + forceCheckpoint(node); + + int catalogVersion2 = getLatestCatalogVersion(node); + assertThat("The catalog version did not changed [initial=" + catalogVersion1 + ", latest=" + catalogVersion2 + ']', + catalogVersion2, greaterThan(catalogVersion1)); + + expectEarliestCatalogVersion(node, catalogVersion2 - 1); Review Comment: We can check right after zone creation I guess. What I'm trying to check that is that `catalogVersion2 - 1 != veryEarliestCatalogVersion`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org