Skip to content

Commit

Permalink
IGNITE-24128 Remove casts to RestartProofIgnite (#4983)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpuch authored Dec 27, 2024
1 parent 86cc298 commit 51cb224
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import org.apache.ignite.internal.TestWrappers;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.jdbc.JdbcPreparedStatement;
import org.apache.ignite.internal.jdbc.JdbcStatement;
import org.apache.ignite.internal.jdbc.proto.IgniteQueryErrorCode;
import org.apache.ignite.internal.jdbc.proto.SqlStateCode;
import org.apache.ignite.internal.restart.RestartProofIgnite;
import org.apache.ignite.internal.sql.engine.QueryCancelledException;
import org.apache.ignite.internal.sql.engine.SqlQueryProcessor;
import org.apache.ignite.internal.sql.engine.exec.fsm.QueryInfo;
Expand Down Expand Up @@ -122,8 +122,8 @@ protected void afterTest() throws Exception {
assertTrue(pstmt.isClosed());

long countOfPendingTransactions = CLUSTER.runningNodes()
.map(RestartProofIgnite.class::cast)
.map(rpi -> rpi.unwrap(IgniteImpl.class).txManager())
.map(TestWrappers::unwrapIgniteImpl)
.map(IgniteImpl::txManager)
.collect(Collectors.summarizingInt(TxManager::pending))
.getSum();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.ignite.internal.placementdriver;

import static java.util.stream.Collectors.toSet;
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.junit.jupiter.api.Assertions.assertTrue;
Expand All @@ -34,7 +35,6 @@
import org.apache.ignite.internal.partitiondistribution.TokenizedAssignments;
import org.apache.ignite.internal.replicator.ReplicationGroupId;
import org.apache.ignite.internal.replicator.TablePartitionId;
import org.apache.ignite.internal.restart.RestartProofIgnite;
import org.apache.ignite.internal.table.TableImpl;
import org.junit.jupiter.api.Test;

Expand All @@ -57,11 +57,9 @@ public void testAssignmentsAreTrackedOnEveryNode() throws InterruptedException {

Set<Integer> cmgMetastoreNodesIndices = Arrays.stream(cmgMetastoreNodes()).boxed().collect(toSet());

RestartProofIgnite igniteMs = (RestartProofIgnite) findAliveNode(ni -> cmgMetastoreNodesIndices.contains(ni.getKey()));
IgniteImpl metaStorageNode = igniteMs.unwrap(IgniteImpl.class);
IgniteImpl metaStorageNode = unwrapIgniteImpl(findAliveNode(ni -> cmgMetastoreNodesIndices.contains(ni.getKey())));

RestartProofIgnite igniteNms = (RestartProofIgnite) findAliveNode(ni -> !cmgMetastoreNodesIndices.contains(ni.getKey()));
IgniteImpl nonMetaStorageNode = igniteNms.unwrap(IgniteImpl.class);
IgniteImpl nonMetaStorageNode = unwrapIgniteImpl(findAliveNode(ni -> !cmgMetastoreNodesIndices.contains(ni.getKey())));

TableImpl table = unwrapTableImpl(metaStorageNode.tables().table("TABLE_TEST"));
ReplicationGroupId groupId = new TablePartitionId(table.tableId(), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.raft.service.RaftGroupService;
import org.apache.ignite.internal.replicator.TablePartitionId;
import org.apache.ignite.internal.restart.RestartProofIgnite;
import org.apache.ignite.internal.sql.BaseSqlIntegrationTest;
import org.apache.ignite.internal.storage.MvPartitionStorage;
import org.apache.ignite.internal.table.TableImpl;
Expand Down Expand Up @@ -159,7 +158,7 @@ void testLocalPartitionStatesSystemViewWithUpdatedEstimatedRows() throws Excepti
* @param partitionsCount Expected the table partitions count for iterating over them.
*/
private static void waitLeaderOnAllPartitions(String tableName, int partitionsCount) {
IgniteImpl node = ((RestartProofIgnite) CLUSTER.node(0)).unwrap(IgniteImpl.class);
IgniteImpl node = unwrapIgniteImpl(CLUSTER.node(0));

TableImpl table = ((PublicApiThreadingTable) node.tables().table(tableName)).unwrap(TableImpl.class);

Expand Down

0 comments on commit 51cb224

Please sign in to comment.