This is an automated email from the ASF dual-hosted git repository.
sk0x50 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new f2c82f8d7be IGNITE-26939 Replace composition of CatalogManager#catalog
and CatalogManager#latestCatalogVersion with CatalogManager#latestCatalog
(#7325)
f2c82f8d7be is described below
commit f2c82f8d7be22f37abbdc18b83b7bdb393ec5127
Author: Mikhail Efremov <[email protected]>
AuthorDate: Mon Jan 12 21:24:56 2026 +0600
IGNITE-26939 Replace composition of CatalogManager#catalog and
CatalogManager#latestCatalogVersion with CatalogManager#latestCatalog (#7325)
---
.../CatalogCompactionRunnerSelfTest.java | 39 +++++++++----------
.../ignite/internal/catalog/CatalogService.java | 1 -
.../ignite/internal/catalog/CatalogIndexTest.java | 12 +++---
.../internal/catalog/CatalogManagerSelfTest.java | 8 ++--
.../ignite/internal/catalog/CatalogTableTest.java | 18 ++++-----
.../catalog/commands/CatalogUtilsTest.java | 2 +-
.../ItRebalanceByPendingAssignmentsQueueTest.java | 4 +-
.../rebalance/ItRebalanceDistributedTest.java | 13 +++----
.../ignite/internal/rebalance/ItRebalanceTest.java | 4 +-
.../distributionzones/DataNodesManager.java | 6 +--
.../distributionzones/DistributionZoneManager.java | 4 +-
.../rebalance/DistributionZoneRebalanceEngine.java | 6 +--
...butionZoneManagerLogicalTopologyEventsTest.java | 38 +++++++++---------
.../DistributionZoneRebalanceEngineTest.java | 10 ++---
...balanceMinimumRequiredTimeProviderImplTest.java | 15 +++++---
.../distributionzones/DataNodesTestUtil.java | 2 +-
.../DistributionZonesTestUtil.java | 2 +-
.../index/ItDropIndexMultipleNodesTest.java | 24 +++++-------
.../ignite/internal/index/ItIndexRecoveryTest.java | 4 +-
.../index/ChangeIndexStatusTaskController.java | 4 +-
.../index/IndexAvailabilityController.java | 5 +--
.../internal/index/IndexBuildController.java | 2 +-
.../apache/ignite/internal/index/IndexManager.java | 4 +-
.../internal/index/ChangeIndexStatusTaskTest.java | 2 +-
.../IndexAvailabilityControllerRestorerTest.java | 2 +-
.../replicator/ItReplicaLifecycleTest.java | 8 +---
.../partition/replicator/ItZoneInMemoryTest.java | 2 +-
.../PartitionReplicaLifecycleManagerTest.java | 8 ++--
.../ItPrimaryReplicaChoiceTest.java | 12 +++---
...InterruptedRaftSnapshotStorageRecoveryTest.java | 9 ++---
.../internal/runner/app/ItDataSchemaSyncTest.java | 5 +--
.../runner/app/ItIgniteNodeRestartTest.java | 3 +-
...ClientTransactionsWithBrokenReplicatorTest.java | 10 ++---
.../ItSchemaSyncMetastorageDependencyTest.java | 2 +-
.../ignite/internal/table/ItReplicasTest.java | 31 +++++++--------
.../ignite/internal/table/ItTableScanTest.java | 14 +------
.../ignite/internal/AssignmentsTestUtils.java | 38 ++++++++++--------
.../java/org/apache/ignite/internal/Cluster.java | 2 +-
.../internal/ClusterPerClassIntegrationTest.java | 10 +----
.../internal/sql/api/ItSqlCreateZoneTest.java | 6 +--
.../internal/sql/engine/ItPublicSchemaTest.java | 3 +-
.../systemviews/ItIndexColumnsSystemViewTest.java | 12 +-----
.../systemviews/ItIndexesSystemViewTest.java | 7 +---
.../systemviews/ItSchemasSystemViewTest.java | 4 +-
.../engine/systemviews/ItTablesSystemViewTest.java | 10 +----
.../internal/sql/engine/exec/DdlBatchingTest.java | 26 +++----------
.../exec/mapping/MappingServiceImplTest.java | 8 +---
.../engine/planner/KeyValueModifyPlannerTest.java | 4 +-
.../planner/PrimaryKeyDeletePlannerTest.java | 4 +-
.../planner/PrimaryKeyLookupPlannerTest.java | 4 +-
.../sql/engine/planner/SelectCountPlannerTest.java | 4 +-
.../PartitionAwarenessMetadataTest.java | 10 +----
.../engine/schema/SqlSchemaManagerImplTest.java | 2 +-
.../partition/ItPartitionDestructionTest.java | 4 +-
.../ItPartitionModificationCounterMetricsTest.java | 13 +++----
.../disaster/DisasterRecoveryManager.java | 15 +-------
.../distributed/TableManagerRecoveryTest.java | 4 +-
.../FullStateTransferIndexChooserTest.java | 10 +----
.../disaster/ItDisasterRecoveryManagerTest.java | 11 +++---
.../ItDisasterRecoveryReconfigurationTest.java | 45 ++++++++--------------
...RecoveryZonePartitionsStatesSystemViewTest.java | 8 ++--
61 files changed, 227 insertions(+), 372 deletions(-)
diff --git
a/modules/catalog-compaction/src/test/java/org/apache/ignite/internal/catalog/compaction/CatalogCompactionRunnerSelfTest.java
b/modules/catalog-compaction/src/test/java/org/apache/ignite/internal/catalog/compaction/CatalogCompactionRunnerSelfTest.java
index 24afdffde7e..15d9b01ccfb 100644
---
a/modules/catalog-compaction/src/test/java/org/apache/ignite/internal/catalog/compaction/CatalogCompactionRunnerSelfTest.java
+++
b/modules/catalog-compaction/src/test/java/org/apache/ignite/internal/catalog/compaction/CatalogCompactionRunnerSelfTest.java
@@ -176,15 +176,15 @@ public class CatalogCompactionRunnerSelfTest extends
AbstractCatalogCompactionTe
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog1 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog1 = catalogManager.latestCatalog();
assertNotNull(catalog1);
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog2 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog2 = catalogManager.latestCatalog();
assertNotNull(catalog2);
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog3 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog3 = catalogManager.latestCatalog();
assertNotNull(catalog3);
Map<String, Long> nodeToTime = Map.of(
@@ -231,15 +231,15 @@ public class CatalogCompactionRunnerSelfTest extends
AbstractCatalogCompactionTe
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog1 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog1 = catalogManager.latestCatalog();
assertNotNull(catalog1);
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog2 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog2 = catalogManager.latestCatalog();
assertNotNull(catalog2);
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog3 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog3 = catalogManager.latestCatalog();
assertNotNull(catalog3);
int expectedEarliestCatalogVersion = catalog1.version() - 1;
@@ -280,15 +280,15 @@ public class CatalogCompactionRunnerSelfTest extends
AbstractCatalogCompactionTe
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog1 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog1 = catalogManager.latestCatalog();
assertNotNull(catalog1);
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog2 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog2 = catalogManager.latestCatalog();
assertNotNull(catalog2);
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog3 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog3 = catalogManager.latestCatalog();
assertNotNull(catalog3);
int expectedEarliestCatalogVersion = catalog1.version() - 1;
@@ -327,15 +327,15 @@ public class CatalogCompactionRunnerSelfTest extends
AbstractCatalogCompactionTe
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog1 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog1 = catalogManager.latestCatalog();
assertNotNull(catalog1);
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog2 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog2 = catalogManager.latestCatalog();
assertNotNull(catalog2);
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog3 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog3 = catalogManager.latestCatalog();
assertNotNull(catalog3);
int expectedEarliestCatalogVersion = catalog1.version() - 1;
@@ -431,13 +431,13 @@ public class CatalogCompactionRunnerSelfTest extends
AbstractCatalogCompactionTe
assertThat(catalogManager.execute(command),
willCompleteSuccessfully());
assertThat(catalogManager.execute(createIndex),
willCompleteSuccessfully());
- Catalog firstCatalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog firstCatalog = catalogManager.latestCatalog();
CatalogIndexDescriptor index =
firstCatalog.indexes().stream().filter(idx -> "T1_VAL_IDX".equals(idx.name()))
.findFirst()
.orElseThrow();
int indexId = index.id();
- Catalog catalog1 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog1 = catalogManager.latestCatalog();
assertNotNull(catalog1);
// ConcurrentMap so we can modify it as we go.
@@ -465,7 +465,7 @@ public class CatalogCompactionRunnerSelfTest extends
AbstractCatalogCompactionTe
// Advances time, so nodes can observe the latest catalog time at the
moment.
Runnable advanceTime = () -> {
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog = catalogManager.latestCatalog();
long latestTime = catalog.time();
nodeToTime.put(NODE1.name(), latestTime);
@@ -554,7 +554,7 @@ public class CatalogCompactionRunnerSelfTest extends
AbstractCatalogCompactionTe
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog1 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog1 = catalogManager.latestCatalog();
assertNotNull(catalog1);
long time = catalog1.time();
@@ -618,7 +618,7 @@ public class CatalogCompactionRunnerSelfTest extends
AbstractCatalogCompactionTe
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
assertThat(catalogManager.execute(TestCommand.ok()),
willCompleteSuccessfully());
- Catalog catalog1 =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog1 = catalogManager.latestCatalog();
assertNotNull(catalog1);
long time = catalog1.time();
@@ -1315,7 +1315,7 @@ public class CatalogCompactionRunnerSelfTest extends
AbstractCatalogCompactionTe
List<AvailablePartitionsMessage> availablePartitions = new
ArrayList<>();
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog = catalogManager.latestCatalog();
for (CatalogTableDescriptor table : catalog.tables()) {
Entry<String, Integer> nodeTableId = Map.entry(nodeName,
table.id());
@@ -1369,8 +1369,7 @@ public class CatalogCompactionRunnerSelfTest extends
AbstractCatalogCompactionTe
Long minTime = timeSupplier.minLocalTimeAtNode(coordinator);
Map<TablePartitionId, Long> values = new HashMap<>();
- int version = catalogManager.latestCatalogVersion();
- Catalog catalog = catalogManager.catalog(version);
+ Catalog catalog = catalogManager.latestCatalog();
for (CatalogTableDescriptor table : catalog.tables()) {
for (int i = 0; i < CatalogUtils.DEFAULT_PARTITION_COUNT; i++)
{
diff --git
a/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogService.java
b/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogService.java
index 458eac7e6e2..bccecbac7d5 100644
---
a/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogService.java
+++
b/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogService.java
@@ -137,7 +137,6 @@ public interface CatalogService extends
EventProducer<CatalogEvent, CatalogEvent
*
* @return The latest registered catalog
*/
- // TODO: https://issues.apache.org/jira/browse/IGNITE-26939
Catalog latestCatalog();
/**
diff --git
a/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogIndexTest.java
b/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogIndexTest.java
index 1b16d982b9c..ff9808a8033 100644
---
a/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogIndexTest.java
+++
b/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogIndexTest.java
@@ -246,7 +246,7 @@ public class CatalogIndexTest extends
BaseCatalogManagerTest {
assertThat(index.status(), is(AVAILABLE));
// Validate actual catalog
- Catalog latestCatalog =
manager.catalog(manager.latestCatalogVersion());
+ Catalog latestCatalog = manager.latestCatalog();
assertNotNull(latestCatalog);
assertSame(latestCatalog, manager.activeCatalog(clock.nowLong()));
@@ -853,11 +853,11 @@ public class CatalogIndexTest extends
BaseCatalogManagerTest {
}
private List<Integer> tableIndexIds(int catalogVersion, int tableId) {
- Catalog catalog = manager.catalog(catalogVersion);
-
- assert catalog != null;
-
- return
catalog.indexes(tableId).stream().map(CatalogObjectDescriptor::id).collect(toList());
+ return manager.catalog(catalogVersion)
+ .indexes(tableId)
+ .stream()
+ .map(CatalogObjectDescriptor::id)
+ .collect(toList());
}
private int tableId(String tableName) {
diff --git
a/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerSelfTest.java
b/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerSelfTest.java
index 94871383ed6..257c63be789 100644
---
a/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerSelfTest.java
+++
b/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerSelfTest.java
@@ -216,7 +216,7 @@ public class CatalogManagerSelfTest extends
BaseCatalogManagerTest {
delayDuration.set(TimeUnit.DAYS.toMillis(365));
reset(updateLog, clockWaiter);
- Catalog initialCatalog =
manager.catalog(manager.latestCatalogVersion());
+ Catalog initialCatalog = manager.latestCatalog();
assertNotNull(initialCatalog);
int initial = initialCatalog.objectIdGenState();
@@ -293,7 +293,7 @@ public class CatalogManagerSelfTest extends
BaseCatalogManagerTest {
verify(clockWaiter, timeout(10_000).times(3)).waitFor(any());
- Catalog catalog0 = manager.catalog(manager.latestCatalogVersion());
+ Catalog catalog0 = manager.latestCatalog();
assertNotNull(catalog0);
@@ -371,7 +371,7 @@ public class CatalogManagerSelfTest extends
BaseCatalogManagerTest {
TestCommand.fail()
);
- Catalog catalog = manager.catalog(manager.latestCatalogVersion());
+ Catalog catalog = manager.latestCatalog();
assertNotNull(catalog);
int initial = catalog.objectIdGenState();
@@ -382,7 +382,7 @@ public class CatalogManagerSelfTest extends
BaseCatalogManagerTest {
bulkUpdate.subList(0, bulkUpdate.size() - 1),
true, true);
- Catalog updatedCatalog =
manager.catalog(manager.latestCatalogVersion());
+ Catalog updatedCatalog = manager.latestCatalog();
assertNotNull(updatedCatalog);
assertEquals(2 + initial, updatedCatalog.objectIdGenState());
}
diff --git
a/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogTableTest.java
b/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogTableTest.java
index 00672f1646c..1ba22e87093 100644
---
a/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogTableTest.java
+++
b/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogTableTest.java
@@ -260,7 +260,7 @@ public class CatalogTableTest extends
BaseCatalogManagerTest {
tryApplyAndExpectApplied(simpleTable(TABLE_NAME_2));
- Catalog catalog = manager.catalog(manager.latestCatalogVersion());
+ Catalog catalog = manager.latestCatalog();
assertNotNull(catalog);
CatalogSchemaDescriptor schema = catalog.schema(SCHEMA_NAME);
@@ -572,8 +572,7 @@ public class CatalogTableTest extends
BaseCatalogManagerTest {
@Test
public void testCreateDefaultZoneLazilyIfNoZonesProvided() {
// Check that initially there no default zone and zones at all.
- int initialVersion = manager.latestCatalogVersion();
- Catalog initialCatalog = manager.catalog(initialVersion);
+ Catalog initialCatalog = manager.latestCatalog();
assertThat(initialCatalog.zones(), empty());
assertThat(initialCatalog.defaultZone(), nullValue());
@@ -592,8 +591,7 @@ public class CatalogTableTest extends
BaseCatalogManagerTest {
@Test
public void testDefaultZoneCreationIsIdempotent() {
// Check that initially there no default zone and zones at all.
- int initialVersion = manager.latestCatalogVersion();
- Catalog initialCatalog = manager.catalog(initialVersion);
+ Catalog initialCatalog = manager.latestCatalog();
assertThat(initialCatalog.zones(), empty());
assertThat(initialCatalog.defaultZone(), nullValue());
@@ -613,8 +611,7 @@ public class CatalogTableTest extends
BaseCatalogManagerTest {
@Test
public void testDefaultZoneCannotBeCreatedIfDefaultNameIsAlreadyInUse() {
// Check that initially there no default zone and zones at all.
- int initialVersion = manager.latestCatalogVersion();
- Catalog initialCatalog = manager.catalog(initialVersion);
+ Catalog initialCatalog = manager.latestCatalog();
assertThat(initialCatalog.zones(), empty());
assertThat(initialCatalog.defaultZone(), nullValue());
@@ -629,8 +626,7 @@ public class CatalogTableTest extends
BaseCatalogManagerTest {
)
);
- int lastVersion = manager.latestCatalogVersion();
- Catalog lastCatalog = manager.catalog(lastVersion);
+ Catalog lastCatalog = manager.latestCatalog();
assertThat(lastCatalog.zones(), hasSize(1));
assertThat(initialCatalog.defaultZone(), nullValue());
}
@@ -1308,7 +1304,7 @@ public class CatalogTableTest extends
BaseCatalogManagerTest {
tryApplyAndExpectApplied(createTableCmd);
- Catalog catalog = manager.catalog(manager.latestCatalogVersion());
+ Catalog catalog = manager.latestCatalog();
CatalogZoneDescriptor defaultZoneDescriptor =
catalog.zone(DEFAULT_ZONE_NAME);
CatalogZoneDescriptor zoneDescriptor = catalog.zone(customZoneName);
@@ -1377,7 +1373,7 @@ public class CatalogTableTest extends
BaseCatalogManagerTest {
tryApplyAndExpectApplied(tableCmdWithEverything);
}
- assertThat(manager.catalog(manager.latestCatalogVersion()).tables(),
hasItems(
+ assertThat(manager.latestCatalog().tables(), hasItems(
tableThatSatisfies("table with stale rows conf that matches
defaults", d ->
"defaults".equals(d.name())
&& d.properties().minStaleRowsCount() ==
CatalogUtils.DEFAULT_MIN_STALE_ROWS_COUNT
diff --git
a/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/commands/CatalogUtilsTest.java
b/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/commands/CatalogUtilsTest.java
index fb5af13b496..799a3505051 100644
---
a/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/commands/CatalogUtilsTest.java
+++
b/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/commands/CatalogUtilsTest.java
@@ -190,7 +190,7 @@ public class CatalogUtilsTest extends
BaseIgniteAbstractTest {
void testClusterWideEnsuredActivationTimestamp() {
createTable(TABLE_NAME);
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog = catalogManager.latestCatalog();
HybridTimestamp expClusterWideActivationTs =
HybridTimestamp.hybridTimestamp(catalog.time())
.addPhysicalTime(TEST_MAX_CLOCK_SKEW_MILLIS)
diff --git
a/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceByPendingAssignmentsQueueTest.java
b/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceByPendingAssignmentsQueueTest.java
index ec0a809635a..f55e71fbbac 100644
---
a/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceByPendingAssignmentsQueueTest.java
+++
b/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceByPendingAssignmentsQueueTest.java
@@ -68,7 +68,6 @@ import org.apache.ignite.internal.Cluster;
import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.descriptors.CatalogZoneDescriptor;
import
org.apache.ignite.internal.distributionzones.rebalance.ZoneRebalanceUtil;
import org.apache.ignite.internal.hlc.HybridTimestamp;
@@ -506,8 +505,7 @@ class ItRebalanceByPendingAssignmentsQueueTest extends
ClusterPerTestIntegration
}
private static Catalog latestCatalog(Ignite ignite) {
- CatalogManager catalogManager =
unwrapIgniteImpl(ignite).catalogManager();
- return catalogManager.catalog(catalogManager.latestCatalogVersion());
+ return unwrapIgniteImpl(ignite).catalogManager().latestCatalog();
}
/**
diff --git
a/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java
b/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java
index c500c4c33ae..5d1170005a8 100644
---
a/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java
+++
b/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java
@@ -563,11 +563,11 @@ public class ItRebalanceDistributedTest extends
BaseIgniteAbstractTest {
}
private static int defaultZoneId(CatalogManager catalog) {
- return
catalog.catalog(catalog.latestCatalogVersion()).defaultZone().id();
+ return catalog.latestCatalog().defaultZone().id();
}
private static boolean hasDefaultZone(CatalogManager catalog) {
- return catalog.catalog(catalog.latestCatalogVersion()).defaultZone()
!= null;
+ return catalog.latestCatalog().defaultZone() != null;
}
@Test
@@ -781,8 +781,7 @@ public class ItRebalanceDistributedTest extends
BaseIgniteAbstractTest {
{
ByteArray partAssignmentsPendingKey =
pendingPartAssignmentsQueueKey(partitionGroupId);
- int catalogVersion = node.catalogManager.latestCatalogVersion();
- long timestamp =
node.catalogManager.catalog(catalogVersion).time();
+ long timestamp = node.catalogManager.latestCatalog().time();
byte[] bytesPendingAssignments =
AssignmentsQueue.toBytes(Assignments.of(newAssignment, timestamp));
@@ -848,8 +847,7 @@ public class ItRebalanceDistributedTest extends
BaseIgniteAbstractTest {
// Write the new assignments to metastore as a pending assignments.
ByteArray partAssignmentsPendingKey =
pendingPartAssignmentsQueueKey(partId);
- int catalogVersion = node.catalogManager.latestCatalogVersion();
- long timestamp = node.catalogManager.catalog(catalogVersion).time();
+ long timestamp = node.catalogManager.latestCatalog().time();
byte[] bytesPendingAssignments =
AssignmentsQueue.toBytes(Assignments.of(newAssignment, timestamp));
@@ -968,8 +966,7 @@ public class ItRebalanceDistributedTest extends
BaseIgniteAbstractTest {
TableViewInternal table =
unwrapTableViewInternal(node0.tableManager.table(TABLE_NAME));
ZonePartitionId partitionGroupId = new ZonePartitionId(table.zoneId(),
0);
- int catalogVersion = node0.catalogManager.latestCatalogVersion();
- long timestamp = node0.catalogManager.catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager.latestCatalog().time();
byte[] bytesPendingAssignments =
AssignmentsQueue.toBytes(Assignments.of(pendingAssignments, timestamp));
byte[] bytesPlannedAssignments =
Assignments.toBytes(plannedAssignments, timestamp);
diff --git
a/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceTest.java
b/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceTest.java
index 33878a2c2d0..b430675a9a5 100644
---
a/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceTest.java
+++
b/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceTest.java
@@ -214,7 +214,9 @@ public class ItRebalanceTest extends
ClusterPerTestIntegrationTest {
CatalogManager catalogManager =
unwrapIgniteImpl(cluster.aliveNode()).catalogManager();
- return
catalogManager.catalog(catalogManager.latestCatalogVersion()).tables().stream()
+ return catalogManager.latestCatalog()
+ .tables()
+ .stream()
.filter(t -> t.name().equals(tableName))
.findFirst().get().id();
}
diff --git
a/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DataNodesManager.java
b/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DataNodesManager.java
index b6357034452..9f7da26a2fd 100644
---
a/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DataNodesManager.java
+++
b/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DataNodesManager.java
@@ -941,9 +941,7 @@ public class DataNodesManager {
public CompletableFuture<Void> recalculateDataNodes(String zoneName) {
Objects.requireNonNull(zoneName, "Zone name is required.");
- int catalogVersion = catalogManager.latestCatalogVersion();
-
- CatalogZoneDescriptor zoneDescriptor =
catalogManager.catalog(catalogVersion).zone(zoneName);
+ CatalogZoneDescriptor zoneDescriptor =
catalogManager.latestCatalog().zone(zoneName);
if (zoneDescriptor == null) {
return failedFuture(new
DistributionZoneNotFoundException(zoneName));
@@ -1543,7 +1541,7 @@ public class DataNodesManager {
}
private CatalogZoneDescriptor zoneDescriptor(int zoneId) {
- CatalogZoneDescriptor zone =
catalogManager.catalog(catalogManager.latestCatalogVersion()).zone(zoneId);
+ CatalogZoneDescriptor zone =
catalogManager.latestCatalog().zone(zoneId);
if (zone == null) {
throw new DistributionZoneNotFoundException(zoneId);
diff --git
a/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java
b/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java
index 335e53001fe..376b3a4be5d 100644
---
a/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java
+++
b/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java
@@ -696,9 +696,7 @@ public class DistributionZoneManager extends
* Returns the current zones in the Catalog. Must always be called from
the meta storage thread.
*/
private Collection<CatalogZoneDescriptor> currentZones() {
- int catalogVersion = catalogManager.latestCatalogVersion();
-
- return catalogManager.catalog(catalogVersion).zones();
+ return catalogManager.latestCatalog().zones();
}
/**
diff --git
a/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/rebalance/DistributionZoneRebalanceEngine.java
b/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/rebalance/DistributionZoneRebalanceEngine.java
index 58c876798ca..ce41bb7e369 100644
---
a/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/rebalance/DistributionZoneRebalanceEngine.java
+++
b/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/rebalance/DistributionZoneRebalanceEngine.java
@@ -158,9 +158,7 @@ public class DistributionZoneRebalanceEngine {
// It is safe to get the latest version of the catalog as we are
in the metastore thread.
// TODO: IGNITE-22723 Potentially unsafe to use the latest catalog
version, as the tables might not already present
// in the catalog. Better to store this version when writing
datanodes.
- int catalogVersion = catalogService.latestCatalogVersion();
-
- Catalog catalog = catalogService.catalog(catalogVersion);
+ Catalog catalog = catalogService.latestCatalog();
long assignmentsTimestamp = catalog.time();
@@ -284,7 +282,7 @@ public class DistributionZoneRebalanceEngine {
// TODO: And then run the remote invoke, only if needed.
private CompletableFuture<Void> recoveryRebalanceTrigger(long
recoveryRevision) {
if (recoveryRevision > 0) {
- Catalog catalog =
catalogService.catalog(catalogService.latestCatalogVersion());
+ Catalog catalog = catalogService.latestCatalog();
HybridTimestamp recoveryTimestamp =
metaStorageManager.timestampByRevisionLocally(recoveryRevision);
diff --git
a/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/DistributionZoneManagerLogicalTopologyEventsTest.java
b/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/DistributionZoneManagerLogicalTopologyEventsTest.java
index 826a3b5b8fc..19492104a58 100644
---
a/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/DistributionZoneManagerLogicalTopologyEventsTest.java
+++
b/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/DistributionZoneManagerLogicalTopologyEventsTest.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.distributionzones;
+import static java.time.Duration.ofSeconds;
import static java.util.UUID.randomUUID;
import static java.util.stream.Collectors.toSet;
import static
org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE;
@@ -28,12 +29,13 @@ import static
org.apache.ignite.internal.distributionzones.DistributionZonesUtil
import static
org.apache.ignite.internal.distributionzones.DistributionZonesUtil.zonesLogicalTopologyKey;
import static
org.apache.ignite.internal.distributionzones.DistributionZonesUtil.zonesLogicalTopologyVersionKey;
import static
org.apache.ignite.internal.metastorage.server.KeyValueUpdateContext.kvContext;
-import static
org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
import static
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
import static
org.apache.ignite.internal.util.ByteUtils.longToBytesKeepingOrder;
+import static org.awaitility.Awaitility.waitAtMost;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import java.util.Map;
@@ -242,7 +244,7 @@ public class
DistributionZoneManagerLogicalTopologyEventsTest extends BaseDistri
* Tests that zone data nodes get correctly set if the zone had been
created right before the topology was updated.
*/
@Test
- void testZoneStartAndTopologyUpdateOrder() throws InterruptedException {
+ void testZoneStartAndTopologyUpdateOrder() {
startDistributionZoneManager();
Set<NodeWithAttributes> topology = Stream.of(NODE_1, NODE_2)
@@ -258,11 +260,10 @@ public class
DistributionZoneManagerLogicalTopologyEventsTest extends BaseDistri
// to become active.
catalogManager.execute(createZoneCommand);
- assertTrue(waitForCondition(() -> {
- int version = catalogManager.latestCatalogVersion();
-
- return catalogManager.catalog(version).zone(ZONE_NAME) != null;
- }, 10_000));
+ waitAtMost(ofSeconds(10)).until(
+ () -> catalogManager.latestCatalog().zone(ZONE_NAME),
+ is(notNullValue())
+ );
CompletableFuture<?> metaStorageUpdateFuture =
metaStorageManager.putAll(Map.of(
zonesLogicalTopologyKey(),
LogicalTopologySetSerializer.serialize(topology),
@@ -271,20 +272,19 @@ public class
DistributionZoneManagerLogicalTopologyEventsTest extends BaseDistri
assertThat(metaStorageUpdateFuture, willCompleteSuccessfully());
- int version = catalogManager.latestCatalogVersion();
-
- int zoneId = catalogManager.catalog(version).zone(ZONE_NAME).id();
+ int zoneId = catalogManager.latestCatalog().zone(ZONE_NAME).id();
- assertTrue(waitForCondition(() -> {
- CompletableFuture<Entry> dataNodesHistoryFuture =
metaStorageManager.get(zoneDataNodesHistoryKey(zoneId));
+ waitAtMost(ofSeconds(10)).until(
+ () -> {
+ CompletableFuture<Entry> dataNodesHistoryFuture =
metaStorageManager.get(zoneDataNodesHistoryKey(zoneId));
- assertThat(dataNodesHistoryFuture, willCompleteSuccessfully());
+ assertThat(dataNodesHistoryFuture,
willCompleteSuccessfully());
- DataNodesHistory dataNodesHistory =
DataNodesHistorySerializer.deserialize(dataNodesHistoryFuture.join().value());
+ DataNodesHistory dataNodesHistory =
DataNodesHistorySerializer.deserialize(dataNodesHistoryFuture.join().value());
- Set<NodeWithAttributes> dataNodes =
dataNodesHistory.dataNodesForTimestamp(HybridTimestamp.MAX_VALUE).dataNodes();
-
- return dataNodes.equals(topology);
- }, 10_000));
+ return
dataNodesHistory.dataNodesForTimestamp(HybridTimestamp.MAX_VALUE).dataNodes();
+ },
+ is(topology)
+ );
}
}
diff --git
a/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/rebalance/DistributionZoneRebalanceEngineTest.java
b/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/rebalance/DistributionZoneRebalanceEngineTest.java
index ab10db14cd4..1568772c1ee 100644
---
a/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/rebalance/DistributionZoneRebalanceEngineTest.java
+++
b/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/rebalance/DistributionZoneRebalanceEngineTest.java
@@ -419,8 +419,7 @@ public class DistributionZoneRebalanceEngineTest extends
IgniteAbstractTest {
when(distributionZoneManager.dataNodes(any(), anyInt(),
anyInt())).thenReturn(completedFuture(Set.of("node0")));
- int catalogVersion = catalogManager.latestCatalogVersion();
- long timestamp = catalogManager.catalog(catalogVersion).time();
+ long timestamp = catalogManager.latestCatalog().time();
byte[] assignmentsBytes = Assignments.of(timestamp,
Assignment.forPeer("node0")).toBytes();
@@ -454,8 +453,7 @@ public class DistributionZoneRebalanceEngineTest extends
IgniteAbstractTest {
when(distributionZoneManager.dataNodes(any(), anyInt(),
anyInt())).thenReturn(completedFuture(Set.of("node0")));
- int catalogVersion = catalogManager.latestCatalogVersion();
- long timestamp = catalogManager.catalog(catalogVersion).time();
+ long timestamp = catalogManager.latestCatalog().time();
for (int i = 0; i < 25; i++) {
byte[] assignmentsBytes = Assignments.of(timestamp,
Assignment.forPeer("node0")).toBytes();
@@ -505,7 +503,7 @@ public class DistributionZoneRebalanceEngineTest extends
IgniteAbstractTest {
Function<ZonePartitionId, ByteArray> assignmentFunction,
Function<byte[], Assignments> assignmentsFromBytesFunction
) {
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog = catalogManager.latestCatalog();
catalog.tables().forEach(tableDescriptor -> {
int zoneId = tableDescriptor.zoneId();
@@ -598,7 +596,7 @@ public class DistributionZoneRebalanceEngineTest extends
IgniteAbstractTest {
var zoneId = getZoneId(zoneName);
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog catalog = catalogManager.latestCatalog();
CatalogZoneDescriptor zoneDescriptor = catalog.zone(zoneId);
Set<String> initialDataNodes = Set.of("node0");
diff --git
a/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/rebalance/RebalanceMinimumRequiredTimeProviderImplTest.java
b/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/rebalance/RebalanceMinimumRequiredTimeProviderImplTest.java
index 219824ac589..2abdd15de93 100644
---
a/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/rebalance/RebalanceMinimumRequiredTimeProviderImplTest.java
+++
b/modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/rebalance/RebalanceMinimumRequiredTimeProviderImplTest.java
@@ -17,13 +17,15 @@
package org.apache.ignite.internal.distributionzones.rebalance;
+import static java.time.Duration.ofSeconds;
import static
org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
import static
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
+import static org.awaitility.Awaitility.waitAtMost;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
-import static org.hamcrest.Matchers.notNullValue;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -371,12 +373,13 @@ class RebalanceMinimumRequiredTimeProviderImplTest
extends BaseDistributionZoneM
return metaStorageManager.clusterTime().currentSafeTime().longValue();
}
- private Catalog latestCatalogVersion() throws Exception {
- Catalog latestCatalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ private Catalog latestCatalogVersion() {
+ Catalog latestCatalog = catalogManager.latestCatalog();
- assertThat(latestCatalog, is(notNullValue()));
-
- assertTrue(waitForCondition(() -> latestCatalog.time() <=
currentSafeTime(), 10, 5000));
+ waitAtMost(ofSeconds(5)).until(
+ this::currentSafeTime,
+ is(greaterThanOrEqualTo(latestCatalog.time()))
+ );
return latestCatalog;
}
diff --git
a/modules/distribution-zones/src/testFixtures/java/org/apache/ignite/internal/distributionzones/DataNodesTestUtil.java
b/modules/distribution-zones/src/testFixtures/java/org/apache/ignite/internal/distributionzones/DataNodesTestUtil.java
index c87fba6b607..72be9d71ac1 100644
---
a/modules/distribution-zones/src/testFixtures/java/org/apache/ignite/internal/distributionzones/DataNodesTestUtil.java
+++
b/modules/distribution-zones/src/testFixtures/java/org/apache/ignite/internal/distributionzones/DataNodesTestUtil.java
@@ -61,7 +61,7 @@ public final class DataNodesTestUtil {
CatalogManager catalogManager = node.catalogManager();
- CatalogZoneDescriptor zoneDesc =
catalogManager.catalog(catalogManager.latestCatalogVersion()).zone(zoneName);
+ CatalogZoneDescriptor zoneDesc =
catalogManager.latestCatalog().zone(zoneName);
assertNotNull(zoneDesc);
}
diff --git
a/modules/distribution-zones/src/testFixtures/java/org/apache/ignite/internal/distributionzones/DistributionZonesTestUtil.java
b/modules/distribution-zones/src/testFixtures/java/org/apache/ignite/internal/distributionzones/DistributionZonesTestUtil.java
index 0cf6c5b694a..c90a87d5487 100644
---
a/modules/distribution-zones/src/testFixtures/java/org/apache/ignite/internal/distributionzones/DistributionZonesTestUtil.java
+++
b/modules/distribution-zones/src/testFixtures/java/org/apache/ignite/internal/distributionzones/DistributionZonesTestUtil.java
@@ -772,7 +772,7 @@ public class DistributionZonesTestUtil {
setDefaultZone(catalogManager, DEFAULT_ZONE_NAME);
- Catalog latestCatalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ Catalog latestCatalog = catalogManager.latestCatalog();
assertNotNull(latestCatalog.defaultZone());
}
diff --git
a/modules/index/src/integrationTest/java/org/apache/ignite/internal/index/ItDropIndexMultipleNodesTest.java
b/modules/index/src/integrationTest/java/org/apache/ignite/internal/index/ItDropIndexMultipleNodesTest.java
index 7b65530214a..e1e454beaf7 100644
---
a/modules/index/src/integrationTest/java/org/apache/ignite/internal/index/ItDropIndexMultipleNodesTest.java
+++
b/modules/index/src/integrationTest/java/org/apache/ignite/internal/index/ItDropIndexMultipleNodesTest.java
@@ -17,16 +17,16 @@
package org.apache.ignite.internal.index;
+import static java.time.Duration.ofSeconds;
import static org.apache.ignite.internal.TestWrappers.unwrapIgniteImpl;
import static
org.apache.ignite.internal.sql.engine.util.QueryChecker.containsIndexScan;
import static
org.apache.ignite.internal.testframework.IgniteTestUtils.runAsync;
-import static
org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
import static
org.apache.ignite.internal.testframework.matchers.CompletableFutureExceptionMatcher.willTimeoutFast;
import static
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
+import static org.awaitility.Awaitility.waitAtMost;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -267,22 +267,16 @@ public class ItDropIndexMultipleNodesTest extends
BaseSqlIntegrationTest {
runInRwTransaction(CLUSTER.aliveNode(), tx -> {
// Create an index inside a transaction, this will prevent the
index from building.
- try {
- CompletableFuture<Void> creationFuture =
runAsync(ItDropIndexMultipleNodesTest::createIndexBlindly);
-
- assertTrue(waitForCondition(
- () ->
catalogManager.catalog(catalogManager.latestCatalogVersion()).aliveIndex(SCHEMA_NAME,
INDEX_NAME) != null,
- 10_000
- ));
+ CompletableFuture<Void> creationFuture =
runAsync(ItDropIndexMultipleNodesTest::createIndexBlindly);
- dropIndex();
+ waitAtMost(ofSeconds(10)).until(
+ () ->
catalogManager.latestCatalog().aliveIndex(SCHEMA_NAME, INDEX_NAME),
+ is(notNullValue())
+ );
- assertThat(creationFuture, willCompleteSuccessfully());
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
+ dropIndex();
- throw new RuntimeException(e);
- }
+ assertThat(creationFuture, willCompleteSuccessfully());
});
assertThat(indexRemovedFuture, willCompleteSuccessfully());
diff --git
a/modules/index/src/integrationTest/java/org/apache/ignite/internal/index/ItIndexRecoveryTest.java
b/modules/index/src/integrationTest/java/org/apache/ignite/internal/index/ItIndexRecoveryTest.java
index b570c7b279a..9066b65de4b 100644
---
a/modules/index/src/integrationTest/java/org/apache/ignite/internal/index/ItIndexRecoveryTest.java
+++
b/modules/index/src/integrationTest/java/org/apache/ignite/internal/index/ItIndexRecoveryTest.java
@@ -25,7 +25,6 @@ import java.nio.file.Path;
import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.app.IgniteServerImpl;
-import org.apache.ignite.internal.catalog.Catalog;
import org.apache.ignite.internal.configuration.IgnitePaths;
import org.apache.ignite.internal.hlc.HybridTimestamp;
import org.apache.ignite.internal.lowwatermark.LowWatermarkImpl;
@@ -122,8 +121,7 @@ class ItIndexRecoveryTest extends
ClusterPerTestIntegrationTest {
}
private static HybridTimestamp latestCatalogVersionTs(IgniteImpl ignite) {
- Catalog latestCatalog =
ignite.catalogManager().catalog(ignite.catalogManager().latestCatalogVersion());
- return HybridTimestamp.hybridTimestamp(latestCatalog.time());
+ return
HybridTimestamp.hybridTimestamp(ignite.catalogManager().latestCatalog().time());
}
private static void raisePersistedLwm(Path workDir, HybridTimestamp
newLwm) {
diff --git
a/modules/index/src/main/java/org/apache/ignite/internal/index/ChangeIndexStatusTaskController.java
b/modules/index/src/main/java/org/apache/ignite/internal/index/ChangeIndexStatusTaskController.java
index 204bb01fdca..c5ed3cf30b5 100644
---
a/modules/index/src/main/java/org/apache/ignite/internal/index/ChangeIndexStatusTaskController.java
+++
b/modules/index/src/main/java/org/apache/ignite/internal/index/ChangeIndexStatusTaskController.java
@@ -229,7 +229,7 @@ class ChangeIndexStatusTaskController implements
ManuallyCloseable {
private void scheduleTasksOnPrimaryReplicaElectedBusy(ZonePartitionId
zonePartitionId) {
// It is safe to get the latest version of the catalog because the
PRIMARY_REPLICA_ELECTED event is handled on the metastore thread.
- Catalog catalog =
catalogService.catalog(catalogService.latestCatalogVersion());
+ Catalog catalog = catalogService.latestCatalog();
IntArrayList tableIds =
getTableIdsForPrimaryReplicaElected(catalog, zonePartitionId,
id -> !localNodeIsPrimaryReplicaForTableIds.contains(id));
@@ -260,7 +260,7 @@ class ChangeIndexStatusTaskController implements
ManuallyCloseable {
private void handlePrimacyLoss(ZonePartitionId zonePartitionId) {
// It is safe to get the latest version of the catalog because the
PRIMARY_REPLICA_ELECTED event is handled on the metastore thread.
- Catalog catalog =
catalogService.catalog(catalogService.latestCatalogVersion());
+ Catalog catalog = catalogService.latestCatalog();
IntArrayList tableIds =
getTableIdsForPrimaryReplicaElected(catalog, zonePartitionId,
localNodeIsPrimaryReplicaForTableIds::contains);
diff --git
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexAvailabilityController.java
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexAvailabilityController.java
index cdda087ca69..381d1bce399 100644
---
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexAvailabilityController.java
+++
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexAvailabilityController.java
@@ -175,8 +175,7 @@ class IndexAvailabilityController implements
ManuallyCloseable {
// It is expected that the method will only be called on recovery,
when the deploy of metastore watches has not yet occurred.
// TODO: IGNITE-22656 Potentially dangerous to take the latest
version as the tables and indexes might no longer present
// in the catalog.
- int catalogVersion = catalogManager.latestCatalogVersion();
- Catalog catalog = catalogManager.catalog(catalogVersion);
+ Catalog catalog = catalogManager.latestCatalog();
List<CompletableFuture<?>> futures = catalog.indexes().stream()
.map(indexDescriptor -> {
@@ -232,7 +231,7 @@ class IndexAvailabilityController implements
ManuallyCloseable {
return inBusyLockAsync(busyLock, () -> {
int indexId = parameters.indexId();
- Catalog catalog =
catalogManager.catalog(parameters.catalogVersion());
+ Catalog catalog = catalogManager.latestCatalog();
assert catalog != null : "Catalog is null for version: " +
parameters.catalogVersion();
diff --git
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexBuildController.java
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexBuildController.java
index 47c140516a2..8c2674009c7 100644
---
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexBuildController.java
+++
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexBuildController.java
@@ -253,7 +253,7 @@ class IndexBuildController implements ManuallyCloseable {
// It is safe to get the latest version of the catalog because
the PRIMARY_REPLICA_ELECTED event is handled on the
// metastore thread.
- Catalog catalog =
catalogService.catalog(catalogService.latestCatalogVersion());
+ Catalog catalog = catalogService.latestCatalog();
CatalogZoneDescriptor zoneDescriptor =
catalog.zone(primaryReplicaId.zoneId());
// TODO: IGNITE-22656 It is necessary not to generate an event
for a destroyed zone by LWM
diff --git
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
index c784f5ef218..ffd00ef62b1 100644
---
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
+++
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
@@ -335,9 +335,9 @@ public class IndexManager implements IgniteComponent {
? catalogService.earliestCatalogVersion()
: catalogService.activeCatalogVersion(lwm.longValue());
- int latestCatalogVersion = catalogService.latestCatalogVersion();
+ Catalog nextCatalog = catalogService.latestCatalog();
- Catalog nextCatalog = catalogService.catalog(latestCatalogVersion);
+ int latestCatalogVersion = nextCatalog.version();
assert nextCatalog != null : "catalogVersion=" + latestCatalogVersion;
diff --git
a/modules/index/src/test/java/org/apache/ignite/internal/index/ChangeIndexStatusTaskTest.java
b/modules/index/src/test/java/org/apache/ignite/internal/index/ChangeIndexStatusTaskTest.java
index 0630c4a96c1..6c62cfae9f3 100644
---
a/modules/index/src/test/java/org/apache/ignite/internal/index/ChangeIndexStatusTaskTest.java
+++
b/modules/index/src/test/java/org/apache/ignite/internal/index/ChangeIndexStatusTaskTest.java
@@ -402,7 +402,7 @@ public class ChangeIndexStatusTaskTest extends
IgniteAbstractTest {
}
private ZonePartitionId createReplicationGroupId(int partId) {
- Collection<CatalogZoneDescriptor> zones =
catalogManager.catalog(catalogManager.latestCatalogVersion()).zones();
+ Collection<CatalogZoneDescriptor> zones =
catalogManager.latestCatalog().zones();
assertThat("Only one zone should be defined [zones=" + zones + ']',
zones, hasSize(1));
diff --git
a/modules/index/src/test/java/org/apache/ignite/internal/index/IndexAvailabilityControllerRestorerTest.java
b/modules/index/src/test/java/org/apache/ignite/internal/index/IndexAvailabilityControllerRestorerTest.java
index 22eac8eb222..dba5ff4d053 100644
---
a/modules/index/src/test/java/org/apache/ignite/internal/index/IndexAvailabilityControllerRestorerTest.java
+++
b/modules/index/src/test/java/org/apache/ignite/internal/index/IndexAvailabilityControllerRestorerTest.java
@@ -198,7 +198,7 @@ public class IndexAvailabilityControllerRestorerTest
extends BaseIgniteAbstractT
// Let's do checks.
assertMetastoreKeyPresent(metaStorageManager,
inProgressBuildIndexMetastoreKey(indexId));
- int partitions =
getPartitionCountFromCatalog(catalogManager.catalog(catalogManager.latestCatalogVersion()),
indexId
+ int partitions =
getPartitionCountFromCatalog(catalogManager.latestCatalog(), indexId
);
assertThat(partitions, greaterThan(0));
diff --git
a/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java
b/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java
index eff640990c3..2b50d109c96 100644
---
a/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java
+++
b/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java
@@ -57,7 +57,6 @@ import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
-import org.apache.ignite.internal.catalog.Catalog;
import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.descriptors.CatalogZoneDescriptor;
import
org.apache.ignite.internal.cluster.management.configuration.NodeAttributesConfiguration;
@@ -200,9 +199,7 @@ public class ItReplicaLifecycleTest extends
ItAbstractColocationTest {
DistributionZonesTestUtil.createDefaultZone(catalogManager);
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
-
- CatalogZoneDescriptor defaultZone = catalog.defaultZone();
+ CatalogZoneDescriptor defaultZone =
catalogManager.latestCatalog().defaultZone();
MetaStorageManager metaStorageManager = node.metaStorageManager;
@@ -509,8 +506,7 @@ public class ItReplicaLifecycleTest extends
ItAbstractColocationTest {
Node node = cluster.get(0);
- int catalogVersion =
node.catalogManager.latestCatalogVersion();
- long timestamp =
node.catalogManager.catalog(catalogVersion).time();
+ long timestamp = node.catalogManager.latestCatalog().time();
node.metaStorageManager.put(
stablePartAssignmentsKey(partId),
diff --git
a/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItZoneInMemoryTest.java
b/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItZoneInMemoryTest.java
index 97455437557..d6625b6a27d 100644
---
a/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItZoneInMemoryTest.java
+++
b/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItZoneInMemoryTest.java
@@ -132,7 +132,7 @@ public class ItZoneInMemoryTest extends
ItAbstractColocationTest {
}
private static List<CatalogStorageProfileDescriptor>
extractZoneProfiles(Node node, int zoneId) {
- CatalogZoneDescriptor zoneDescriptor =
node.catalogManager.catalog(node.catalogManager.latestCatalogVersion()).zone(zoneId);
+ CatalogZoneDescriptor zoneDescriptor =
node.catalogManager.latestCatalog().zone(zoneId);
assertNotNull(zoneDescriptor);
diff --git
a/modules/partition-replicator/src/test/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManagerTest.java
b/modules/partition-replicator/src/test/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManagerTest.java
index 4ca06dae09c..9a21318173e 100644
---
a/modules/partition-replicator/src/test/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManagerTest.java
+++
b/modules/partition-replicator/src/test/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManagerTest.java
@@ -321,7 +321,7 @@ class PartitionReplicaLifecycleManagerTest extends
BaseIgniteAbstractTest {
*/
@Test
void testStopOrder() throws NodeStoppingException {
- int zoneId =
catalogManager.catalog(catalogManager.latestCatalogVersion()).defaultZone().id();
+ int zoneId = catalogManager.latestCatalog().defaultZone().id();
var zonePartitionId = new ZonePartitionId(zoneId, 0);
@@ -352,7 +352,7 @@ class PartitionReplicaLifecycleManagerTest extends
BaseIgniteAbstractTest {
afterReplicaStoppedFuture.complete(params);
}));
- int zoneId =
catalogManager.catalog(catalogManager.latestCatalogVersion()).defaultZone().id();
+ int zoneId = catalogManager.latestCatalog().defaultZone().id();
var zonePartitionId = new ZonePartitionId(zoneId, 0);
@@ -381,7 +381,7 @@ class PartitionReplicaLifecycleManagerTest extends
BaseIgniteAbstractTest {
afterReplicaDestroyedFuture.complete(params);
}));
- int zoneId =
catalogManager.catalog(catalogManager.latestCatalogVersion()).defaultZone().id();
+ int zoneId = catalogManager.latestCatalog().defaultZone().id();
var zonePartitionId = new ZonePartitionId(zoneId, 0);
@@ -424,7 +424,7 @@ class PartitionReplicaLifecycleManagerTest extends
BaseIgniteAbstractTest {
public void
partitionLifecycleManagerStopsCorrectWhenTxStatePartitionStoragesAreStoppedExceptionally()
throws Exception {
doReturn(commonZonePartitionResources).when(zoneResourcesManager).getZonePartitionResources(any());
- int defaultZoneId =
catalogManager.catalog(catalogManager.latestCatalogVersion()).defaultZone().id();
+ int defaultZoneId = catalogManager.latestCatalog().defaultZone().id();
List<ZonePartitionResources> defaultZoneResources = IntStream.range(0,
CatalogUtils.DEFAULT_PARTITION_COUNT)
.mapToObj(partId -> new ZonePartitionId(defaultZoneId, partId))
.map(partitionReplicaLifecycleManager::zonePartitionResources)
diff --git
a/modules/placement-driver/src/integrationTest/java/org/apache/ignite/internal/placementdriver/ItPrimaryReplicaChoiceTest.java
b/modules/placement-driver/src/integrationTest/java/org/apache/ignite/internal/placementdriver/ItPrimaryReplicaChoiceTest.java
index 010f0b08723..6d15570a1c3 100644
---
a/modules/placement-driver/src/integrationTest/java/org/apache/ignite/internal/placementdriver/ItPrimaryReplicaChoiceTest.java
+++
b/modules/placement-driver/src/integrationTest/java/org/apache/ignite/internal/placementdriver/ItPrimaryReplicaChoiceTest.java
@@ -48,8 +48,6 @@ import
org.apache.ignite.internal.ClusterPerTestIntegrationTest;
import org.apache.ignite.internal.TestWrappers;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
-import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.descriptors.CatalogObjectDescriptor;
import org.apache.ignite.internal.lang.IgniteStringFormatter;
import org.apache.ignite.internal.network.ClusterNodeImpl;
@@ -394,11 +392,11 @@ public class ItPrimaryReplicaChoiceTest extends
ClusterPerTestIntegrationTest {
* @return Index id.
*/
private int getIndexId(String idxName) {
- CatalogManager catalogManager = igniteImpl(0).catalogManager();
-
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
-
- return catalog.indexes().stream()
+ return igniteImpl(0)
+ .catalogManager()
+ .latestCatalog()
+ .indexes()
+ .stream()
.filter(index -> {
log.info("Scanned idx " + index.name());
diff --git
a/modules/raft/src/integrationTest/java/org/apache/ignite/internal/raftsnapshot/ItInterruptedRaftSnapshotStorageRecoveryTest.java
b/modules/raft/src/integrationTest/java/org/apache/ignite/internal/raftsnapshot/ItInterruptedRaftSnapshotStorageRecoveryTest.java
index 3f76ed64b98..46c82ce67e2 100644
---
a/modules/raft/src/integrationTest/java/org/apache/ignite/internal/raftsnapshot/ItInterruptedRaftSnapshotStorageRecoveryTest.java
+++
b/modules/raft/src/integrationTest/java/org/apache/ignite/internal/raftsnapshot/ItInterruptedRaftSnapshotStorageRecoveryTest.java
@@ -37,8 +37,6 @@ import java.util.function.Consumer;
import org.apache.ignite.Ignite;
import org.apache.ignite.internal.Cluster;
import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
-import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.CatalogService;
import org.apache.ignite.internal.catalog.descriptors.CatalogZoneDescriptor;
import org.apache.ignite.internal.components.LogSyncer;
@@ -176,10 +174,11 @@ class ItInterruptedRaftSnapshotStorageRecoveryTest
extends ClusterPerTestIntegra
}
private int zoneId() {
- CatalogManager catalogManager =
unwrapIgniteImpl(cluster.aliveNode()).catalogManager();
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
+ CatalogZoneDescriptor zone = unwrapIgniteImpl(cluster.aliveNode())
+ .catalogManager()
+ .latestCatalog()
+ .zone(ZONE_NAME);
- CatalogZoneDescriptor zone = catalog.zone(ZONE_NAME);
assertThat(zone, is(notNullValue()));
return zone.id();
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItDataSchemaSyncTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItDataSchemaSyncTest.java
index 32fbf25a5e0..50fc267e593 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItDataSchemaSyncTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItDataSchemaSyncTest.java
@@ -38,7 +38,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.Ignite;
import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
import org.apache.ignite.internal.app.IgniteImpl;
-import org.apache.ignite.internal.catalog.Catalog;
import
org.apache.ignite.internal.distributionzones.rebalance.ZoneRebalanceUtil;
import org.apache.ignite.internal.lang.ByteArray;
import org.apache.ignite.internal.metastorage.server.WatchListenerInhibitor;
@@ -293,9 +292,7 @@ public class ItDataSchemaSyncTest extends
ClusterPerTestIntegrationTest {
private static void waitForStableAssignments(Ignite node, int zoneId)
throws Exception {
IgniteImpl nodeImpl = unwrapIgniteImpl(node);
- Catalog catalog =
nodeImpl.catalogManager().catalog(nodeImpl.catalogManager().latestCatalogVersion());
-
- int numberOfPartitions = catalog.zone(zoneId).partitions();
+ int numberOfPartitions =
nodeImpl.catalogManager().latestCatalog().zone(zoneId).partitions();
boolean res = waitForCondition(() -> {
var stableAssignmentsAreReady = new AtomicBoolean(true);
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
index 1d721e28ec2..36d948dceaa 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
@@ -1685,8 +1685,7 @@ public class ItIgniteNodeRestartTest extends
BaseIgniteRestartTest {
// Populate the stable assignments before calling table create, if
needed.
if (populateStableAssignmentsBeforeTableCreation) {
- int catalogVersion = node.catalogManager().latestCatalogVersion();
- long timestamp =
node.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node.catalogManager().latestCatalog().time();
node.metaStorageManager().put(
stablePartAssignmentsKey(partId),
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientTransactionsWithBrokenReplicatorTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientTransactionsWithBrokenReplicatorTest.java
index 8d38e530707..974b3d0c11d 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientTransactionsWithBrokenReplicatorTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientTransactionsWithBrokenReplicatorTest.java
@@ -37,8 +37,6 @@ import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.ignite.internal.app.IgniteImpl;
-import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.descriptors.CatalogZoneDescriptor;
import org.apache.ignite.internal.client.table.ClientTable;
import org.apache.ignite.internal.raft.server.RaftServer;
import org.apache.ignite.internal.raft.server.impl.JraftServerImpl;
@@ -380,9 +378,9 @@ public class
ItThinClientTransactionsWithBrokenReplicatorTest extends ItAbstract
}
private static List<ZonePartitionId> getPartitions(IgniteImpl server) {
- Catalog catalog =
server.catalogManager().catalog(server.catalogManager().latestCatalogVersion());
- CatalogZoneDescriptor zoneDescriptor =
catalog.zone(ZONE_NAME.toUpperCase());
- List<ZonePartitionId> replicationGroupIds = zonePartitionIds(server,
zoneDescriptor.id());
- return replicationGroupIds;
+ return zonePartitionIds(
+ server,
+
server.catalogManager().latestCatalog().zone(ZONE_NAME.toUpperCase()).id()
+ );
}
}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/schemasync/ItSchemaSyncMetastorageDependencyTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/schemasync/ItSchemaSyncMetastorageDependencyTest.java
index 4fdcd6b4d82..c759a056a5a 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/schemasync/ItSchemaSyncMetastorageDependencyTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/schemasync/ItSchemaSyncMetastorageDependencyTest.java
@@ -105,6 +105,6 @@ class ItSchemaSyncMetastorageDependencyTest extends
ClusterPerTestIntegrationTes
}
private static boolean hasTableInCatalog(String anotherTableName,
CatalogManager catalogManager) {
- return
catalogManager.catalog(catalogManager.latestCatalogVersion()).table(DEFAULT_SCHEMA_NAME,
anotherTableName) != null;
+ return catalogManager.latestCatalog().table(DEFAULT_SCHEMA_NAME,
anotherTableName) != null;
}
}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItReplicasTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItReplicasTest.java
index e410f4f7596..89d252054f9 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItReplicasTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItReplicasTest.java
@@ -50,8 +50,6 @@ import java.util.stream.Collectors;
import org.apache.ignite.Ignite;
import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
import org.apache.ignite.internal.app.IgniteImpl;
-import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.CatalogManager;
import
org.apache.ignite.internal.distributionzones.rebalance.ZoneRebalanceUtil;
import org.apache.ignite.internal.lang.IgniteBiTuple;
import org.apache.ignite.internal.network.InternalClusterNode;
@@ -178,12 +176,11 @@ class ItReplicasTest extends
ClusterPerTestIntegrationTest {
return
ZoneRebalanceUtil.zoneStableAssignments(ignite.metaStorageManager(), zoneId,
new int[]{0}).join().get(0).nodes();
}
- private static ZonePartitionId partitionGroupId(Ignite node, String
zoneName, String tableName, int partId) {
- IgniteImpl igniteImpl = unwrapIgniteImpl(node);
- CatalogManager catalogManager = igniteImpl.catalogManager();
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
-
- return new ZonePartitionId(catalog.zone(zoneName).id(), partId);
+ private static ZonePartitionId partitionGroupId(Ignite node, String
zoneName, int partId) {
+ return new ZonePartitionId(
+
unwrapIgniteImpl(node).catalogManager().latestCatalog().zone(zoneName).id(),
+ partId
+ );
}
private static int getZoneId(Ignite node, String tableName) {
@@ -221,14 +218,14 @@ class ItReplicasTest extends
ClusterPerTestIntegrationTest {
};
}
- private static Function<Ignite, ReplicaListener> toReplicaListener(String
zoneName, String tableName, int partId) {
+ private static Function<Ignite, ReplicaListener> toReplicaListener(String
zoneName, int partId) {
return node -> {
try {
CompletableFuture<Replica> replicaFut =
unwrapIgniteImpl(node).replicaManager()
- .replica(partitionGroupId(node, zoneName, tableName,
partId));
+ .replica(partitionGroupId(node, zoneName, partId));
if (replicaFut == null) {
- throw new AssertionError(format("Replica not found for
table {} in node {}", tableName, node.name()));
+ throw new AssertionError(format("Replica not found for
zone {} in node {}", zoneName, node.name()));
}
Replica replica = replicaFut.get(30, TimeUnit.SECONDS);
@@ -281,7 +278,7 @@ class ItReplicasTest extends ClusterPerTestIntegrationTest {
this.partId = partId;
this.schema =
unwrapTableViewInternal(node.tables().table("TEST")).schemaView().lastKnownSchema();
this.marshaller = new ReflectionMarshallerFactory().create(schema,
keyClass, valClass);
- this.replicaListener = of(node).map(toReplicaListener(zoneName,
tableName, partId)).orElseThrow();
+ this.replicaListener = of(node).map(toReplicaListener(zoneName,
partId)).orElseThrow();
}
Request readOnlySingleRowPkReplicaRequest(K pk) {
@@ -292,7 +289,7 @@ class ItReplicasTest extends ClusterPerTestIntegrationTest {
ReadOnlySingleRowPkReplicaRequest request = new
PartitionReplicationMessagesFactory()
.readOnlySingleRowPkReplicaRequest()
- .groupId(groupIdMessage(node, zoneName, tableName, partId))
+ .groupId(groupIdMessage(node, zoneName, partId))
.tableId(table.tableId())
.readTimestamp(node.clock().now())
.schemaVersion(pkRow.schemaVersion())
@@ -313,7 +310,7 @@ class ItReplicasTest extends ClusterPerTestIntegrationTest {
ReadOnlyMultiRowPkReplicaRequest request = new
PartitionReplicationMessagesFactory()
.readOnlyMultiRowPkReplicaRequest()
- .groupId(groupIdMessage(node, zoneName, tableName, partId))
+ .groupId(groupIdMessage(node, zoneName, partId))
.tableId(table.tableId())
.readTimestamp(node.clock().now())
.schemaVersion(pkRow.schemaVersion())
@@ -332,7 +329,7 @@ class ItReplicasTest extends ClusterPerTestIntegrationTest {
ReadOnlyScanRetrieveBatchReplicaRequest request = new
PartitionReplicationMessagesFactory()
.readOnlyScanRetrieveBatchReplicaRequest()
- .groupId(groupIdMessage(node, zoneName, tableName, partId))
+ .groupId(groupIdMessage(node, zoneName, partId))
.tableId(table.tableId())
.readTimestamp(node.clock().now())
.scanId(1)
@@ -343,8 +340,8 @@ class ItReplicasTest extends ClusterPerTestIntegrationTest {
return new Request(request);
}
- private static ReplicationGroupIdMessage groupIdMessage(IgniteImpl
node, String zoneName, String tableName, int partId) {
- PartitionGroupId partitionGroupId = partitionGroupId(node,
zoneName, tableName, partId);
+ private static ReplicationGroupIdMessage groupIdMessage(IgniteImpl
node, String zoneName, int partId) {
+ PartitionGroupId partitionGroupId = partitionGroupId(node,
zoneName, partId);
var replicaMessagesFactory = new ReplicaMessagesFactory();
return toZonePartitionIdMessage(replicaMessagesFactory,
((ZonePartitionId) partitionGroupId));
}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
index 846a8f3bed3..5a32edb2726 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
@@ -57,8 +57,6 @@ import org.apache.ignite.InitParametersBuilder;
import org.apache.ignite.internal.TestWrappers;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
-import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.descriptors.CatalogObjectDescriptor;
import org.apache.ignite.internal.lang.IgniteStringFormatter;
import org.apache.ignite.internal.lang.RunnableX;
@@ -208,11 +206,7 @@ public class ItTableScanTest extends
BaseSqlIntegrationTest {
* @return Index id.
*/
private int getIndexId(IgniteImpl ignite, String idxName) {
- CatalogManager catalogManager = ignite.catalogManager();
-
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
-
- return catalog.indexes().stream()
+ return ignite.catalogManager().latestCatalog().indexes().stream()
.filter(index -> {
log.info("Scanned idx " + index.name());
@@ -944,11 +938,7 @@ public class ItTableScanTest extends
BaseSqlIntegrationTest {
* Gets an index id.
*/
private static int getSortedIndexId() {
- CatalogManager catalogManager =
unwrapIgniteImpl(CLUSTER.aliveNode()).catalogManager();
-
- Catalog catalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
-
- return catalog.indexes().stream()
+ return
unwrapIgniteImpl(CLUSTER.aliveNode()).catalogManager().latestCatalog().indexes().stream()
.filter(index -> SORTED_IDX.equalsIgnoreCase(index.name()))
.mapToInt(CatalogObjectDescriptor::id)
.findFirst()
diff --git
a/modules/runner/src/testFixtures/java/org/apache/ignite/internal/AssignmentsTestUtils.java
b/modules/runner/src/testFixtures/java/org/apache/ignite/internal/AssignmentsTestUtils.java
index ff220799b3a..aa7b4af7eae 100644
---
a/modules/runner/src/testFixtures/java/org/apache/ignite/internal/AssignmentsTestUtils.java
+++
b/modules/runner/src/testFixtures/java/org/apache/ignite/internal/AssignmentsTestUtils.java
@@ -17,18 +17,18 @@
package org.apache.ignite.internal;
+import static java.time.Duration.ofSeconds;
import static org.apache.ignite.internal.TestWrappers.unwrapIgniteImpl;
import static org.apache.ignite.internal.TestWrappers.unwrapTableImpl;
-import static
org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
import static
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
+import static org.awaitility.Awaitility.waitAtMost;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.concurrent.CompletableFuture;
import org.apache.ignite.Ignite;
import org.apache.ignite.internal.app.IgniteImpl;
-import org.apache.ignite.internal.catalog.Catalog;
import org.apache.ignite.internal.catalog.descriptors.CatalogZoneDescriptor;
import org.apache.ignite.internal.hlc.HybridTimestamp;
import org.apache.ignite.internal.partitiondistribution.TokenizedAssignments;
@@ -45,30 +45,34 @@ public class AssignmentsTestUtils {
* @param node Node via which to operate.
* @param tableName Name of the table which assignments (or which zone's
assignments) to wait for.
*/
- public static void awaitAssignmentsStabilization(Ignite node, String
tableName) throws InterruptedException {
+ public static void awaitAssignmentsStabilization(Ignite node, String
tableName) {
IgniteImpl igniteImpl = unwrapIgniteImpl(node);
TableImpl table = unwrapTableImpl(node.tables().table(tableName));
- Catalog catalog =
igniteImpl.catalogManager().catalog(igniteImpl.catalogManager().latestCatalogVersion());
- CatalogZoneDescriptor zone = catalog.zone(table.zoneId());
+ CatalogZoneDescriptor zone =
igniteImpl.catalogManager().latestCatalog().zone(table.zoneId());
assertNotNull(zone);
HybridTimestamp timestamp = igniteImpl.clock().now();
- assertTrue(waitForCondition(() -> {
- int totalPartitionSize = 0;
+ int expectedTotalPartitionSize = zone.partitions() * zone.replicas();
- for (int p = 0; p < zone.partitions(); p++) {
- CompletableFuture<TokenizedAssignments> assignmentsFuture =
igniteImpl.placementDriver().getAssignments(
- new ZonePartitionId(table.zoneId(), p),
- timestamp);
+ waitAtMost(ofSeconds(10)).until(
+ () -> {
+ int totalPartitionSize = 0;
- assertThat(assignmentsFuture, willCompleteSuccessfully());
+ for (int p = 0; p < zone.partitions(); p++) {
+ CompletableFuture<TokenizedAssignments>
assignmentsFuture = igniteImpl.placementDriver().getAssignments(
+ new ZonePartitionId(table.zoneId(), p),
+ timestamp);
- totalPartitionSize += assignmentsFuture.join().nodes().size();
- }
+ assertThat(assignmentsFuture,
willCompleteSuccessfully());
- return totalPartitionSize == zone.partitions() * zone.replicas();
- }, 10_000));
+ totalPartitionSize +=
assignmentsFuture.join().nodes().size();
+ }
+
+ return totalPartitionSize;
+ },
+ is(expectedTotalPartitionSize)
+ );
}
}
diff --git
a/modules/runner/src/testFixtures/java/org/apache/ignite/internal/Cluster.java
b/modules/runner/src/testFixtures/java/org/apache/ignite/internal/Cluster.java
index a711846c4dd..b5e68ecf8d8 100644
---
a/modules/runner/src/testFixtures/java/org/apache/ignite/internal/Cluster.java
+++
b/modules/runner/src/testFixtures/java/org/apache/ignite/internal/Cluster.java
@@ -875,7 +875,7 @@ public class Cluster {
public ZonePartitionId solePartitionId(String zoneName) {
IgniteImpl node = unwrapIgniteImpl(aliveNode());
- Catalog catalog =
node.catalogManager().catalog(node.catalogManager().latestCatalogVersion());
+ Catalog catalog = node.catalogManager().latestCatalog();
CatalogZoneDescriptor zoneDescriptor =
catalog.zone(zoneName.toUpperCase());
diff --git
a/modules/runner/src/testFixtures/java/org/apache/ignite/internal/ClusterPerClassIntegrationTest.java
b/modules/runner/src/testFixtures/java/org/apache/ignite/internal/ClusterPerClassIntegrationTest.java
index ad1bc6c5554..51ca53d16e1 100644
---
a/modules/runner/src/testFixtures/java/org/apache/ignite/internal/ClusterPerClassIntegrationTest.java
+++
b/modules/runner/src/testFixtures/java/org/apache/ignite/internal/ClusterPerClassIntegrationTest.java
@@ -242,13 +242,8 @@ public abstract class ClusterPerClassIntegrationTest
extends BaseIgniteAbstractT
/** Drops all non-system schemas. */
protected static void dropAllSchemas() {
Ignite aliveNode = CLUSTER.aliveNode();
- IgniteImpl ignite = unwrapIgniteImpl(aliveNode);
- CatalogManager catalogManager = ignite.catalogManager();
-
- Catalog latestCatalog =
catalogManager.catalog(catalogManager.latestCatalogVersion());
- assert latestCatalog != null;
- String dropSchemasScript = latestCatalog.schemas().stream()
+ String dropSchemasScript =
unwrapIgniteImpl(aliveNode).catalogManager().latestCatalog().schemas().stream()
.map(CatalogSchemaDescriptor::name)
.filter(Predicate.not(CatalogUtils.SYSTEM_SCHEMAS::contains))
.filter(Predicate.not(SqlCommon.DEFAULT_SCHEMA_NAME::equals))
@@ -262,8 +257,7 @@ public abstract class ClusterPerClassIntegrationTest
extends BaseIgniteAbstractT
/** Drops all visible zones. */
protected static void dropAllZonesExceptDefaultOne() {
- CatalogManager catalogManager =
unwrapIgniteImpl(CLUSTER.aliveNode()).catalogManager();
- Catalog catalog =
Objects.requireNonNull(catalogManager.catalog(catalogManager.latestCatalogVersion()));
+ Catalog catalog =
unwrapIgniteImpl(CLUSTER.aliveNode()).catalogManager().latestCatalog();
CatalogZoneDescriptor defaultZone = catalog.defaultZone();
Predicate<String> isNotDefaultZone = defaultZone == null ? zoneName ->
true
diff --git
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlCreateZoneTest.java
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlCreateZoneTest.java
index b8737581e8c..87d0a134deb 100644
---
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlCreateZoneTest.java
+++
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlCreateZoneTest.java
@@ -160,7 +160,7 @@ class ItSqlCreateZoneTest extends
ClusterPerTestIntegrationTest {
IgniteImpl node = unwrapIgniteImpl(node(0));
CatalogManager catalogManager = node.catalogManager();
-
assertNull(catalogManager.catalog(catalogManager.latestCatalogVersion()).defaultZone());
+ assertNull(catalogManager.latestCatalog().defaultZone());
assertDoesNotThrow(() -> createZoneQuery(0, DEFAULT_STORAGE_PROFILE));
@@ -169,11 +169,11 @@ class ItSqlCreateZoneTest extends
ClusterPerTestIntegrationTest {
String testTableWithoutZoneName = "test_table_without_zone";
assertDoesNotThrow(() -> createTableWithoutZoneQuery(0,
testTableWithoutZoneName));
- CatalogZoneDescriptor defaultZoneDesc =
catalogManager.catalog(catalogManager.latestCatalogVersion()).defaultZone();
+ CatalogZoneDescriptor defaultZoneDesc =
catalogManager.latestCatalog().defaultZone();
assertNotNull(defaultZoneDesc);
CatalogTableDescriptor tableWithDefaultZoneDescriptor = catalogManager
- .catalog(catalogManager.latestCatalogVersion())
+ .latestCatalog()
.table(DEFAULT_SCHEMA_NAME, testTableWithoutZoneName);
assertNotNull(tableWithDefaultZoneDescriptor);
assertEquals(defaultZoneDesc.id(),
tableWithDefaultZoneDescriptor.zoneId());
diff --git
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItPublicSchemaTest.java
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItPublicSchemaTest.java
index e4de7686886..28924e083e4 100644
---
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItPublicSchemaTest.java
+++
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItPublicSchemaTest.java
@@ -43,9 +43,8 @@ public class ItPublicSchemaTest extends
ClusterPerTestIntegrationTest {
@Test
public void existsInEmptyCluster() {
CatalogManager catalogManager =
TestWrappers.unwrapIgniteImpl(cluster.node(0)).catalogManager();
- int version = catalogManager.latestCatalogVersion();
- assertNotNull(catalogManager.catalog(version).schema("PUBLIC"));
+ assertNotNull(catalogManager.latestCatalog().schema("PUBLIC"));
}
@Test
diff --git
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItIndexColumnsSystemViewTest.java
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItIndexColumnsSystemViewTest.java
index 6a1f2267cdc..861be5607ec 100644
---
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItIndexColumnsSystemViewTest.java
+++
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItIndexColumnsSystemViewTest.java
@@ -22,9 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Arrays;
import java.util.List;
-import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.commands.CatalogUtils;
import org.apache.ignite.internal.catalog.descriptors.CatalogIndexDescriptor;
import org.apache.ignite.internal.catalog.descriptors.CatalogSchemaDescriptor;
@@ -108,10 +106,7 @@ public class ItIndexColumnsSystemViewTest extends
AbstractSystemViewTest {
}
private static void checkHashIndex(String schemaName, String indexName,
List<String> columns) {
- IgniteImpl ignite = unwrapIgniteImpl(CLUSTER.aliveNode());
- CatalogManager catalogManager = ignite.catalogManager();
- int version = catalogManager.latestCatalogVersion();
- Catalog catalog = catalogManager.catalog(version);
+ Catalog catalog =
unwrapIgniteImpl(CLUSTER.aliveNode()).catalogManager().latestCatalog();
CatalogSchemaDescriptor schema = catalog.schema(schemaName);
assertNotNull(schema);
@@ -159,10 +154,7 @@ public class ItIndexColumnsSystemViewTest extends
AbstractSystemViewTest {
List<String> columns,
List<String> collations
) {
- IgniteImpl ignite = unwrapIgniteImpl(CLUSTER.aliveNode());
- CatalogManager catalogManager = ignite.catalogManager();
- int version = catalogManager.latestCatalogVersion();
- Catalog catalog = catalogManager.catalog(version);
+ Catalog catalog =
unwrapIgniteImpl(CLUSTER.aliveNode()).catalogManager().latestCatalog();
CatalogSchemaDescriptor schema = catalog.schema(schemaName);
assertNotNull(schema);
diff --git
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItIndexesSystemViewTest.java
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItIndexesSystemViewTest.java
index 258f2dbd75e..3749114b51e 100644
---
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItIndexesSystemViewTest.java
+++
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItIndexesSystemViewTest.java
@@ -22,9 +22,7 @@ import static
org.apache.ignite.internal.catalog.commands.CatalogUtils.DEFAULT_V
import static
org.apache.ignite.internal.catalog.descriptors.CatalogIndexDescriptor.CatalogIndexDescriptorType.HASH;
import java.util.Collection;
-import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.descriptors.CatalogIndexDescriptor;
import org.apache.ignite.internal.catalog.descriptors.CatalogTableDescriptor;
import org.apache.ignite.internal.sql.SqlCommon;
@@ -71,10 +69,7 @@ public class ItIndexesSystemViewTest extends
AbstractSystemViewTest {
sql(createIndexSql("TEST_INDEX_HASH", TABLE_NAME, HASH.name(),
COLUMNS));
sql(createIndexSql("TEST_INDEX_SORTED", TABLE_NAME, "SORTED",
COLUMNS_COLLATIONS));
- IgniteImpl ignite = unwrapIgniteImpl(CLUSTER.aliveNode());
- CatalogManager catalogManager = ignite.catalogManager();
- int version = catalogManager.latestCatalogVersion();
- Catalog catalog = catalogManager.catalog(version);
+ Catalog catalog =
unwrapIgniteImpl(CLUSTER.aliveNode()).catalogManager().latestCatalog();
CatalogTableDescriptor tableDescriptor = catalog.tables().stream()
.filter(table -> table.name().equals(TABLE_NAME))
diff --git
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItSchemasSystemViewTest.java
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItSchemasSystemViewTest.java
index a69aad4577c..ad7f0c5711b 100644
---
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItSchemasSystemViewTest.java
+++
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItSchemasSystemViewTest.java
@@ -55,7 +55,7 @@ public class ItSchemasSystemViewTest extends
AbstractSystemViewTest {
public void test() {
CatalogManager catalogManager =
TestWrappers.unwrapIgniteImpl(node(0)).catalogManager();
- Map<String, Integer> initialSchemas =
catalogManager.catalog(catalogManager.latestCatalogVersion())
+ Map<String, Integer> initialSchemas = catalogManager.latestCatalog()
.schemas()
.stream()
.map(s -> Map.entry(s.name(), s.id()))
@@ -75,7 +75,7 @@ public class ItSchemasSystemViewTest extends
AbstractSystemViewTest {
sql("CREATE SCHEMA TEST_SCHEMA");
- CatalogSchemaDescriptor newSchema =
catalogManager.catalog(catalogManager.latestCatalogVersion()).schema("TEST_SCHEMA");
+ CatalogSchemaDescriptor newSchema =
catalogManager.latestCatalog().schema("TEST_SCHEMA");
assertNotNull(newSchema);
assertQuery("SELECT schema_id, schema_name FROM system.schemas ORDER
BY schema_name")
diff --git
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItTablesSystemViewTest.java
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItTablesSystemViewTest.java
index 7894f631cb5..765e99551d1 100644
---
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItTablesSystemViewTest.java
+++
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/systemviews/ItTablesSystemViewTest.java
@@ -20,9 +20,6 @@ package org.apache.ignite.internal.sql.engine.systemviews;
import static org.apache.ignite.internal.TestWrappers.unwrapIgniteImpl;
import static
org.apache.ignite.internal.catalog.commands.CatalogUtils.DEFAULT_VARLEN_LENGTH;
-import org.apache.ignite.internal.app.IgniteImpl;
-import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.sql.engine.util.MetadataMatcher;
import org.apache.ignite.sql.ColumnType;
import org.junit.jupiter.api.BeforeAll;
@@ -67,12 +64,7 @@ public class ItTablesSystemViewTest extends
AbstractSystemViewTest {
@Test
public void tables() {
- IgniteImpl ignite = unwrapIgniteImpl(CLUSTER.aliveNode());
- CatalogManager catalogManager = ignite.catalogManager();
- int version = catalogManager.latestCatalogVersion();
- Catalog catalog = catalogManager.catalog(version);
-
- catalog.tables().forEach(table ->
+
unwrapIgniteImpl(CLUSTER.aliveNode()).catalogManager().latestCatalog().tables().forEach(table
->
assertQuery("SELECT schema, name FROM system.tables order by
schema")
.returns("PUBLIC", "TABLE_NAME")
.returns("TEST_SCHEMA", "TABLE_NAME_2")
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/DdlBatchingTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/DdlBatchingTest.java
index 2a94ebc681b..dfe80a287ab 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/DdlBatchingTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/DdlBatchingTest.java
@@ -34,7 +34,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import org.apache.ignite.internal.catalog.Catalog;
import org.apache.ignite.internal.catalog.CatalogManager;
-import org.apache.ignite.internal.catalog.CatalogService;
import org.apache.ignite.internal.sql.engine.AsyncSqlCursor;
import org.apache.ignite.internal.sql.engine.InternalSqlRow;
import org.apache.ignite.internal.sql.engine.exec.fsm.QueryInfo;
@@ -556,20 +555,14 @@ public class DdlBatchingTest extends
BaseIgniteAbstractTest {
}
private void assertSchemaExists(String name) {
- CatalogService catalogService = cluster.catalogManager();
-
- int latestVersion = catalogService.latestCatalogVersion();
- Catalog catalog = catalogService.catalog(latestVersion);
+ Catalog catalog = cluster.catalogManager().latestCatalog();
assertThat(catalog, notNullValue());
assertThat(catalog.schema(IgniteNameUtils.parseIdentifier(name)),
notNullValue());
}
private void assertTableExists(QualifiedName name) {
- CatalogService catalogService = cluster.catalogManager();
-
- int latestVersion = catalogService.latestCatalogVersion();
- Catalog catalog = catalogService.catalog(latestVersion);
+ Catalog catalog = cluster.catalogManager().latestCatalog();
assertThat(catalog, notNullValue());
assertThat(catalog.table(name.schemaName(), name.objectName()),
notNullValue());
@@ -581,10 +574,7 @@ public class DdlBatchingTest extends
BaseIgniteAbstractTest {
@SuppressWarnings("SameParameterValue")
private void assertTableNotExists(String name) {
- CatalogService catalogService = cluster.catalogManager();
-
- int latestVersion = catalogService.latestCatalogVersion();
- Catalog catalog = catalogService.catalog(latestVersion);
+ Catalog catalog = cluster.catalogManager().latestCatalog();
QualifiedName qualifiedName = QualifiedName.fromSimple(name);
@@ -597,10 +587,7 @@ public class DdlBatchingTest extends
BaseIgniteAbstractTest {
}
private void assertIndexExists(QualifiedName name) {
- CatalogService catalogService = cluster.catalogManager();
-
- int latestVersion = catalogService.latestCatalogVersion();
- Catalog catalog = catalogService.catalog(latestVersion);
+ Catalog catalog = cluster.catalogManager().latestCatalog();
assertThat(catalog, notNullValue());
assertThat(catalog.aliveIndex(name.schemaName(), name.objectName()),
notNullValue());
@@ -608,10 +595,7 @@ public class DdlBatchingTest extends
BaseIgniteAbstractTest {
@SuppressWarnings("SameParameterValue")
private void assertIndexNotExists(String name) {
- CatalogService catalogService = cluster.catalogManager();
-
- int latestVersion = catalogService.latestCatalogVersion();
- Catalog catalog = catalogService.catalog(latestVersion);
+ Catalog catalog = cluster.catalogManager().latestCatalog();
QualifiedName qualifiedName = QualifiedName.fromSimple(name);
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/mapping/MappingServiceImplTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/mapping/MappingServiceImplTest.java
index 8f720952f11..7e47464a04a 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/mapping/MappingServiceImplTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/mapping/MappingServiceImplTest.java
@@ -44,8 +44,6 @@ import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.apache.ignite.internal.TestHybridClock;
-import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.CatalogService;
import org.apache.ignite.internal.catalog.descriptors.CatalogZoneDescriptor;
import org.apache.ignite.internal.cluster.management.topology.LogicalTopology;
import org.apache.ignite.internal.cluster.management.topology.api.LogicalNode;
@@ -68,7 +66,6 @@ import org.apache.ignite.internal.systemview.api.SystemViews;
import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
import org.apache.ignite.internal.type.NativeTypes;
import org.apache.ignite.internal.util.SubscriptionUtils;
-import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@@ -252,10 +249,7 @@ public class MappingServiceImplTest extends
BaseIgniteAbstractTest {
List<String> nodeNames = List.of(localNodeName, "NODE1");
Function<String, PrimaryReplicaEventParameters> prepareEvtParams =
(name) -> {
- CatalogService catalogService = cluster.catalogManager();
- Catalog catalog =
catalogService.catalog(catalogService.latestCatalogVersion());
-
- @Nullable CatalogZoneDescriptor zoneDescriptor =
catalog.zone(name);
+ CatalogZoneDescriptor zoneDescriptor =
cluster.catalogManager().latestCatalog().zone(name);
assertNotNull(zoneDescriptor);
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/KeyValueModifyPlannerTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/KeyValueModifyPlannerTest.java
index 9db87d2f8cf..5d3ffd732a6 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/KeyValueModifyPlannerTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/KeyValueModifyPlannerTest.java
@@ -68,10 +68,8 @@ public class KeyValueModifyPlannerTest extends
AbstractPlannerTest {
@AfterEach
void clearCatalog() {
- int version = CLUSTER.catalogManager().latestCatalogVersion();
-
List<CatalogCommand> commands = new ArrayList<>();
- for (CatalogTableDescriptor table :
CLUSTER.catalogManager().catalog(version).tables()) {
+ for (CatalogTableDescriptor table :
CLUSTER.catalogManager().latestCatalog().tables()) {
commands.add(
DropTableCommand.builder()
.schemaName(SqlCommon.DEFAULT_SCHEMA_NAME)
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PrimaryKeyDeletePlannerTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PrimaryKeyDeletePlannerTest.java
index 13b64248dff..ad77c2a2082 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PrimaryKeyDeletePlannerTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PrimaryKeyDeletePlannerTest.java
@@ -69,10 +69,8 @@ public class PrimaryKeyDeletePlannerTest extends
AbstractPlannerTest {
@AfterEach
void clearCatalog() {
- int version = CLUSTER.catalogManager().latestCatalogVersion();
-
List<CatalogCommand> commands = new ArrayList<>();
- for (CatalogTableDescriptor table :
CLUSTER.catalogManager().catalog(version).tables()) {
+ for (CatalogTableDescriptor table :
CLUSTER.catalogManager().latestCatalog().tables()) {
commands.add(
DropTableCommand.builder()
.schemaName(SqlCommon.DEFAULT_SCHEMA_NAME)
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PrimaryKeyLookupPlannerTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PrimaryKeyLookupPlannerTest.java
index 252651286e4..9a2fb5641b8 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PrimaryKeyLookupPlannerTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/PrimaryKeyLookupPlannerTest.java
@@ -69,10 +69,8 @@ public class PrimaryKeyLookupPlannerTest extends
AbstractPlannerTest {
@AfterEach
void clearCatalog() {
- int version = CLUSTER.catalogManager().latestCatalogVersion();
-
List<CatalogCommand> commands = new ArrayList<>();
- for (CatalogTableDescriptor table :
CLUSTER.catalogManager().catalog(version).tables()) {
+ for (CatalogTableDescriptor table :
CLUSTER.catalogManager().latestCatalog().tables()) {
commands.add(
DropTableCommand.builder()
.schemaName(SqlCommon.DEFAULT_SCHEMA_NAME)
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/SelectCountPlannerTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/SelectCountPlannerTest.java
index e04ee362b01..05a670b1ea2 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/SelectCountPlannerTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/SelectCountPlannerTest.java
@@ -81,10 +81,8 @@ public class SelectCountPlannerTest extends
AbstractPlannerTest {
void clearCatalog() {
Commons.resetFastQueryOptimizationFlag();
- int version = CLUSTER.catalogManager().latestCatalogVersion();
-
List<CatalogCommand> commands = new ArrayList<>();
- for (CatalogTableDescriptor table :
CLUSTER.catalogManager().catalog(version).tables()) {
+ for (CatalogTableDescriptor table :
CLUSTER.catalogManager().latestCatalog().tables()) {
commands.add(
DropTableCommand.builder()
.schemaName(SqlCommon.DEFAULT_SCHEMA_NAME)
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/prepare/partitionawareness/PartitionAwarenessMetadataTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/prepare/partitionawareness/PartitionAwarenessMetadataTest.java
index bb585dabf58..6e2c3fb67c4 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/prepare/partitionawareness/PartitionAwarenessMetadataTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/prepare/partitionawareness/PartitionAwarenessMetadataTest.java
@@ -28,7 +28,6 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.ignite.internal.catalog.CatalogCommand;
-import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.commands.DropTableCommand;
import org.apache.ignite.internal.catalog.descriptors.CatalogTableDescriptor;
import org.apache.ignite.internal.sql.SqlCommon;
@@ -77,10 +76,8 @@ public class PartitionAwarenessMetadataTest extends
BaseIgniteAbstractTest {
void clearCatalog() {
Commons.resetFastQueryOptimizationFlag();
- int version = CLUSTER.catalogManager().latestCatalogVersion();
-
List<CatalogCommand> commands = new ArrayList<>();
- for (CatalogTableDescriptor table :
CLUSTER.catalogManager().catalog(version).tables()) {
+ for (CatalogTableDescriptor table :
CLUSTER.catalogManager().latestCatalog().tables()) {
commands.add(
DropTableCommand.builder()
.schemaName(SqlCommon.DEFAULT_SCHEMA_NAME)
@@ -390,10 +387,7 @@ public class PartitionAwarenessMetadataTest extends
BaseIgniteAbstractTest {
} else {
assertNotNull(actual, "Metadata not found");
- CatalogManager catalogManager = CLUSTER.catalogManager();
- int v = catalogManager.latestCatalogVersion();
-
- CatalogTableDescriptor table =
catalogManager.catalog(v).table("PUBLIC", "T");
+ CatalogTableDescriptor table =
CLUSTER.catalogManager().latestCatalog().table("PUBLIC", "T");
assertNotNull(table, "table");
assertEquals(table.id(), actual.tableId(), "metadata tableId");
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImplTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImplTest.java
index 06c88c389f0..45c86131160 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImplTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImplTest.java
@@ -735,7 +735,7 @@ public class SqlSchemaManagerImplTest extends
BaseIgniteAbstractTest {
}
private void makeIndexAvailable(String name) {
- Map<String, CatalogIndexDescriptor> indices =
catalogManager.catalog(catalogManager.latestCatalogVersion()).indexes()
+ Map<String, CatalogIndexDescriptor> indices =
catalogManager.latestCatalog().indexes()
.stream().collect(Collectors.toMap(CatalogIndexDescriptor::name,
Function.identity()));
CatalogIndexDescriptor indexDescriptor = indices.get(name);
diff --git
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java
index a63274710d0..bc827ba512f 100644
---
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java
+++
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/partition/ItPartitionDestructionTest.java
@@ -57,7 +57,6 @@ import
org.apache.ignite.internal.ClusterPerTestIntegrationTest;
import org.apache.ignite.internal.TestWrappers;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.app.IgniteServerImpl;
-import org.apache.ignite.internal.catalog.Catalog;
import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.CatalogNotFoundException;
import org.apache.ignite.internal.catalog.descriptors.CatalogTableDescriptor;
@@ -377,8 +376,7 @@ class ItPartitionDestructionTest extends
ClusterPerTestIntegrationTest {
}
private static HybridTimestamp latestCatalogVersionTs(IgniteImpl ignite) {
- Catalog latestCatalog =
ignite.catalogManager().catalog(ignite.catalogManager().latestCatalogVersion());
- return HybridTimestamp.hybridTimestamp(latestCatalog.time());
+ return
HybridTimestamp.hybridTimestamp(ignite.catalogManager().latestCatalog().time());
}
private void createZoneAndTableWith1Partition(int replicas) {
diff --git
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItPartitionModificationCounterMetricsTest.java
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItPartitionModificationCounterMetricsTest.java
index de70bd8334a..b0094debcde 100644
---
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItPartitionModificationCounterMetricsTest.java
+++
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItPartitionModificationCounterMetricsTest.java
@@ -26,11 +26,11 @@ import static
org.apache.ignite.internal.table.distributed.PartitionModification
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThan;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Map;
import java.util.Objects;
import org.apache.ignite.internal.catalog.Catalog;
-import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.descriptors.CatalogTableDescriptor;
import org.apache.ignite.internal.metrics.LongMetric;
import org.apache.ignite.internal.metrics.MetricManager;
@@ -286,8 +286,7 @@ public class ItPartitionModificationCounterMetricsTest
extends BaseSqlIntegratio
private static void expectLongValue(String tableName, long value, String
metricName) {
QualifiedName qualifiedName = QualifiedName.parse(tableName);
- CatalogManager manager = unwrapIgniteImpl(node(0)).catalogManager();
- Catalog catalog = manager.catalog(manager.latestCatalogVersion());
+ Catalog catalog =
unwrapIgniteImpl(node(0)).catalogManager().latestCatalog();
CatalogTableDescriptor tableDesc =
catalog.table(qualifiedName.schemaName(), qualifiedName.objectName());
int partsCount = catalog.zone(tableDesc.zoneId()).partitions();
@@ -322,11 +321,11 @@ public class ItPartitionModificationCounterMetricsTest
extends BaseSqlIntegratio
}
private static int tableIdByName(QualifiedName qualifiedName) {
- CatalogManager manager = unwrapIgniteImpl(node(0)).catalogManager();
- Catalog catalog = manager.catalog(manager.latestCatalogVersion());
- CatalogTableDescriptor tableDesc =
catalog.table(qualifiedName.schemaName(), qualifiedName.objectName());
+ CatalogTableDescriptor tableDesc =
unwrapIgniteImpl(node(0)).catalogManager()
+ .latestCatalog()
+ .table(qualifiedName.schemaName(), qualifiedName.objectName());
- assert tableDesc != null;
+ assertNotNull(tableDesc);
return tableDesc.id();
}
diff --git
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
index aa374ecdd43..70b66098462 100644
---
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
+++
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
@@ -1332,13 +1332,7 @@ public class DisasterRecoveryManager implements
IgniteComponent, SystemViewProvi
}
private Catalog catalogLatestVersion() {
- int catalogVersion = catalogManager.latestCatalogVersion();
-
- Catalog catalog = catalogManager.catalog(catalogVersion);
-
- assert catalog != null : catalogVersion;
-
- return catalog;
+ return catalogManager.latestCatalog();
}
private static CatalogZoneDescriptor zoneDescriptor(Catalog catalog,
String zoneName) {
@@ -1368,12 +1362,7 @@ public class DisasterRecoveryManager implements
IgniteComponent, SystemViewProvi
}
private void registerMetricSources() {
- int catalogVersion = catalogManager.latestCatalogVersion();
- Catalog catalog = catalogManager.catalog(catalogVersion);
-
- assert catalog != null : "Catalog is not found for version: " +
catalogVersion;
-
- catalog.tables().forEach(this::registerPartitionStatesMetricSource);
+
catalogLatestVersion().tables().forEach(this::registerPartitionStatesMetricSource);
}
private void registerPartitionStatesMetricSource(CatalogTableDescriptor
tableDescriptor) {
diff --git
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java
index 8411e44da1b..bc17efa2152 100644
---
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java
+++
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java
@@ -316,7 +316,7 @@ public class TableManagerRecoveryTest extends
IgniteAbstractTest {
public void raftListenersAreRecoveredOnRecovery() throws Exception {
DistributionZonesTestUtil.createDefaultZone(catalogManager);
- int defaultZonePartitions =
catalogManager.catalog(catalogManager.latestCatalogVersion())
+ int defaultZonePartitions = catalogManager.latestCatalog()
.defaultZone()
.partitions();
@@ -340,7 +340,7 @@ public class TableManagerRecoveryTest extends
IgniteAbstractTest {
int zoneId =
catalogManager.activeCatalog(clock.nowLong()).table(DEFAULT_SCHEMA_NAME,
TABLE_NAME).zoneId();
ZonePartitionId zonePartitionId = new ZonePartitionId(zoneId, 0);
- long assignmentsTimestamp =
catalogManager.catalog(catalogManager.latestCatalogVersion()).time();
+ long assignmentsTimestamp = catalogManager.latestCatalog().time();
AssignmentsQueue assignmentsQueue = pendingAssignmentsCalculator()
.stable(Assignments.of(Set.of(Assignment.forPeer(node.name()),
Assignment.forPeer(node2.name())), assignmentsTimestamp))
diff --git
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/FullStateTransferIndexChooserTest.java
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/FullStateTransferIndexChooserTest.java
index 77cb2f65d55..f32a84b0988 100644
---
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/FullStateTransferIndexChooserTest.java
+++
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/FullStateTransferIndexChooserTest.java
@@ -42,12 +42,10 @@ import static org.apache.ignite.sql.ColumnType.INT32;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.spy;
import java.util.List;
-import org.apache.ignite.internal.catalog.Catalog;
import org.apache.ignite.internal.catalog.CatalogCommand;
import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.CatalogNotFoundException;
@@ -509,13 +507,7 @@ public class FullStateTransferIndexChooserTest extends
BaseIgniteAbstractTest {
}
private HybridTimestamp latestCatalogVersionActivationTs() {
- int catalogVersion = catalogManager.latestCatalogVersion();
-
- Catalog catalog = catalogManager.catalog(catalogVersion);
-
- assertNotNull(catalog, "catalogVersion=" + catalogVersion);
-
- return hybridTimestamp(catalog.time());
+ return hybridTimestamp(catalogManager.latestCatalog().time());
}
private int tableId(String tableName) {
diff --git
a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
index 3704f7a145f..1da250b61dc 100644
---
a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
+++
b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
@@ -55,6 +55,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
import org.apache.ignite.internal.TestWrappers;
import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.catalog.Catalog;
import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.catalog.descriptors.CatalogZoneDescriptor;
import org.apache.ignite.internal.catalog.descriptors.ConsistencyMode;
@@ -291,11 +292,11 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
}
private static int zoneId(CatalogManager catalogManager, String zoneName) {
- return
catalogManager.catalog(catalogManager.latestCatalogVersion()).zone(zoneName).id();
+ return catalogManager.latestCatalog().zone(zoneName).id();
}
private static int zoneId(IgniteImpl node) {
- return
node.catalogManager().catalog(node.catalogManager().latestCatalogVersion()).zone(ZONE_NAME).id();
+ return node.catalogManager().latestCatalog().zone(ZONE_NAME).id();
}
private IgniteImpl findZoneNodeConformingOptions(String testZone, boolean
primaryReplica, boolean raftLeader)
@@ -630,9 +631,9 @@ public class ItDisasterRecoveryManagerTest extends
ClusterPerTestIntegrationTest
AtomicBoolean blocked,
AtomicBoolean reached
) {
- int catalogVersion = node.catalogManager().latestCatalogVersion();
- CatalogZoneDescriptor zoneDescriptor =
node.catalogManager().catalog(catalogVersion).zone(testZone);
- long timestamp = node.catalogManager().catalog(catalogVersion).time();
+ Catalog latestCatalog = node.catalogManager().latestCatalog();
+ CatalogZoneDescriptor zoneDescriptor = latestCatalog.zone(testZone);
+ long timestamp = latestCatalog.time();
Set<Assignment> calculatedAssignments =
calculateAssignmentForPartition(
runningNodes.stream().map(IgniteImpl::name).collect(Collectors.toSet()),
diff --git
a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryReconfigurationTest.java
b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryReconfigurationTest.java
index 1fec02da452..8c1f08e45c1 100644
---
a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryReconfigurationTest.java
+++
b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryReconfigurationTest.java
@@ -266,8 +266,7 @@ public class ItDisasterRecoveryReconfigurationTest extends
ClusterPerTestIntegra
IgniteImpl node0 = igniteImpl(0);
Table table = node0.tables().table(TABLE_NAME);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
awaitPrimaryReplica(node0, partId);
@@ -400,8 +399,7 @@ public class ItDisasterRecoveryReconfigurationTest extends
ClusterPerTestIntegra
executeSql(format("ALTER ZONE %s SET (auto scale down %d)", zoneName,
INFINITE_TIMER_VALUE));
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
Table table = node0.tables().table(TABLE_NAME);
awaitPrimaryReplica(node0, partId);
@@ -479,8 +477,7 @@ public class ItDisasterRecoveryReconfigurationTest extends
ClusterPerTestIntegra
int partId = 0;
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
Table table = node0.tables().table(TABLE_NAME);
awaitPrimaryReplica(node0, partId);
@@ -554,8 +551,7 @@ public class ItDisasterRecoveryReconfigurationTest extends
ClusterPerTestIntegra
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
Table table = node0.tables().table(TABLE_NAME);
@@ -664,8 +660,7 @@ public class ItDisasterRecoveryReconfigurationTest extends
ClusterPerTestIntegra
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
awaitPrimaryReplica(node0, partId);
@@ -738,8 +733,7 @@ public class ItDisasterRecoveryReconfigurationTest extends
ClusterPerTestIntegra
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
awaitPrimaryReplica(node0, partId);
@@ -797,8 +791,7 @@ public class ItDisasterRecoveryReconfigurationTest extends
ClusterPerTestIntegra
IgniteImpl node0 = igniteImpl(0);
Table table = node0.tables().table(TABLE_NAME);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
awaitPrimaryReplica(node0, partId);
@@ -887,8 +880,7 @@ public class ItDisasterRecoveryReconfigurationTest extends
ClusterPerTestIntegra
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
Table table = node0.tables().table(TABLE_NAME);
@@ -965,8 +957,7 @@ public class ItDisasterRecoveryReconfigurationTest extends
ClusterPerTestIntegra
int partId = 0;
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
Table table = node0.tables().table(TABLE_NAME);
awaitPrimaryReplica(node0, partId);
@@ -1116,8 +1107,7 @@ public class ItDisasterRecoveryReconfigurationTest
extends ClusterPerTestIntegra
int partId = 0;
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
Table table = node0.tables().table(TABLE_NAME);
awaitPrimaryReplica(node0, partId);
@@ -1252,8 +1242,7 @@ public class ItDisasterRecoveryReconfigurationTest
extends ClusterPerTestIntegra
int partId = 0;
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
awaitPrimaryReplica(node0, partId);
@@ -1297,8 +1286,7 @@ public class ItDisasterRecoveryReconfigurationTest
extends ClusterPerTestIntegra
int partId = 0;
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
Table table = node0.tables().table(TABLE_NAME);
awaitPrimaryReplica(node0, partId);
@@ -1452,8 +1440,7 @@ public class ItDisasterRecoveryReconfigurationTest
extends ClusterPerTestIntegra
int partId = 0;
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
Table table = node0.tables().table(TABLE_NAME);
awaitPrimaryReplica(node0, partId);
@@ -1540,8 +1527,7 @@ public class ItDisasterRecoveryReconfigurationTest
extends ClusterPerTestIntegra
int partId = 0;
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
Table table = node0.tables().table(TABLE_NAME);
awaitPrimaryReplica(node0, partId);
@@ -1650,8 +1636,7 @@ public class ItDisasterRecoveryReconfigurationTest
extends ClusterPerTestIntegra
int partId = 0;
IgniteImpl node0 = igniteImpl(0);
- int catalogVersion = node0.catalogManager().latestCatalogVersion();
- long timestamp = node0.catalogManager().catalog(catalogVersion).time();
+ long timestamp = node0.catalogManager().latestCatalog().time();
Table table = node0.tables().table(TABLE_NAME);
awaitPrimaryReplica(node0, partId);
diff --git
a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryZonePartitionsStatesSystemViewTest.java
b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryZonePartitionsStatesSystemViewTest.java
index 6a8d21864c8..fb353f15845 100644
---
a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryZonePartitionsStatesSystemViewTest.java
+++
b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryZonePartitionsStatesSystemViewTest.java
@@ -34,7 +34,6 @@ import java.util.stream.IntStream;
import org.apache.ignite.Ignite;
import org.apache.ignite.internal.Cluster;
import org.apache.ignite.internal.app.IgniteImpl;
-import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.raft.service.RaftGroupService;
import org.apache.ignite.internal.replicator.ZonePartitionId;
import org.apache.ignite.internal.sql.BaseSqlIntegrationTest;
@@ -198,9 +197,10 @@ public class
ItDisasterRecoveryZonePartitionsStatesSystemViewTest extends BaseSq
}
private static int getZoneId(String zoneName) {
- CatalogManager catalogManager =
unwrapIgniteImpl(CLUSTER.aliveNode()).catalogManager();
-
- return
catalogManager.catalog(catalogManager.latestCatalogVersion()).zone(zoneName).id();
+ return unwrapIgniteImpl(CLUSTER.aliveNode()).catalogManager()
+ .latestCatalog()
+ .zone(zoneName)
+ .id();
}
static long estimatedSize(String nodeName, String tableName, int
partitionId, Cluster cluster) {