Search in sources :

Example 11 with TxManager

use of org.apache.ignite.internal.tx.TxManager in project ignite-3 by apache.

the class ItTxDistributedTestSingleNode method after.

/**
 * Shutdowns all cluster nodes after each test.
 *
 * @throws Exception If failed.
 */
@AfterEach
public void after() throws Exception {
    cluster.parallelStream().map(c -> {
        c.stop();
        return null;
    }).forEach(o -> {
    });
    if (client != null) {
        client.stop();
    }
    IgniteUtils.shutdownAndAwaitTermination(executor, 10, TimeUnit.SECONDS);
    for (Loza rs : raftServers.values()) {
        Set<String> grps = rs.startedGroups();
        for (String grp : grps) {
            rs.stopRaftGroup(grp);
        }
        rs.stop();
    }
    for (TxManager txMgr : txManagers.values()) {
        txMgr.stop();
    }
    for (RaftGroupService svc : accRaftClients.values()) {
        svc.shutdown();
    }
    for (RaftGroupService svc : custRaftClients.values()) {
        svc.shutdown();
    }
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) TxAbstractTest(org.apache.ignite.internal.table.TxAbstractTest) RaftMessagesFactory(org.apache.ignite.raft.jraft.RaftMessagesFactory) RaftGroupService(org.apache.ignite.raft.client.service.RaftGroupService) Map(java.util.Map) JraftServerImpl(org.apache.ignite.internal.raft.server.impl.JraftServerImpl) NodeFinder(org.apache.ignite.network.NodeFinder) Int2ObjectOpenHashMap(it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap) InternalTableImpl(org.apache.ignite.internal.table.distributed.storage.InternalTableImpl) Set(java.util.Set) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) TxManager(org.apache.ignite.internal.tx.TxManager) TestInfo(org.junit.jupiter.api.TestInfo) ClusterNode(org.apache.ignite.network.ClusterNode) List(java.util.List) StaticNodeFinder(org.apache.ignite.network.StaticNodeFinder) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) RaftGroupServiceImpl(org.apache.ignite.raft.jraft.rpc.impl.RaftGroupServiceImpl) ClusterServiceTestUtils.findLocalAddresses(org.apache.ignite.utils.ClusterServiceTestUtils.findLocalAddresses) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Assertions.fail(org.junit.jupiter.api.Assertions.fail) ConcurrentHashMapPartitionStorage(org.apache.ignite.internal.storage.basic.ConcurrentHashMapPartitionStorage) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) RendezvousAffinityFunction(org.apache.ignite.internal.affinity.RendezvousAffinityFunction) ClusterServiceTestUtils(org.apache.ignite.utils.ClusterServiceTestUtils) Loza(org.apache.ignite.internal.raft.Loza) HashMap(java.util.HashMap) VersionedRowStore(org.apache.ignite.internal.table.distributed.storage.VersionedRowStore) HeapLockManager(org.apache.ignite.internal.tx.impl.HeapLockManager) TestScaleCubeClusterServiceFactory(org.apache.ignite.network.scalecube.TestScaleCubeClusterServiceFactory) TestUtils.waitForTopology(org.apache.ignite.raft.jraft.test.TestUtils.waitForTopology) TableImpl(org.apache.ignite.internal.table.TableImpl) IgniteUtils(org.apache.ignite.internal.util.IgniteUtils) DummySchemaManagerImpl(org.apache.ignite.internal.table.impl.DummySchemaManagerImpl) TxManagerImpl(org.apache.ignite.internal.tx.impl.TxManagerImpl) TableTxManagerImpl(org.apache.ignite.internal.table.distributed.TableTxManagerImpl) TableStorage(org.apache.ignite.internal.storage.engine.TableStorage) NetworkAddress(org.apache.ignite.network.NetworkAddress) TimeUnit(java.util.concurrent.TimeUnit) Mockito(org.mockito.Mockito) Peer(org.apache.ignite.raft.client.Peer) AfterEach(org.junit.jupiter.api.AfterEach) ClusterService(org.apache.ignite.network.ClusterService) PartitionListener(org.apache.ignite.internal.table.distributed.raft.PartitionListener) IgniteTransactionsImpl(org.apache.ignite.internal.tx.impl.IgniteTransactionsImpl) NamedThreadFactory(org.apache.ignite.internal.thread.NamedThreadFactory) Table(org.apache.ignite.table.Table) RaftGroupService(org.apache.ignite.raft.client.service.RaftGroupService) TxManager(org.apache.ignite.internal.tx.TxManager) Loza(org.apache.ignite.internal.raft.Loza) AfterEach(org.junit.jupiter.api.AfterEach)

Example 12 with TxManager

use of org.apache.ignite.internal.tx.TxManager in project ignite-3 by apache.

the class ItTxDistributedTestSingleNode method txManager.

/**
 * {@inheritDoc}
 */
@Override
protected TxManager txManager(Table t) {
    Int2ObjectOpenHashMap<RaftGroupService> clients = null;
    if (t == accounts) {
        clients = accRaftClients;
    } else if (t == customers) {
        clients = custRaftClients;
    } else {
        fail("Unknown table " + t.name());
    }
    TxManager manager = txManagers.get(clients.get(0).clusterService().topologyService().getByAddress(clients.get(0).leader().address()));
    assertNotNull(manager);
    return manager;
}
Also used : RaftGroupService(org.apache.ignite.raft.client.service.RaftGroupService) TxManager(org.apache.ignite.internal.tx.TxManager)

Aggregations

TxManager (org.apache.ignite.internal.tx.TxManager)12 VersionedRowStore (org.apache.ignite.internal.table.distributed.storage.VersionedRowStore)10 HeapLockManager (org.apache.ignite.internal.tx.impl.HeapLockManager)9 TxManagerImpl (org.apache.ignite.internal.tx.impl.TxManagerImpl)9 ConcurrentHashMapPartitionStorage (org.apache.ignite.internal.storage.basic.ConcurrentHashMapPartitionStorage)8 ClusterService (org.apache.ignite.network.ClusterService)8 List (java.util.List)7 DummySchemaManagerImpl (org.apache.ignite.internal.table.impl.DummySchemaManagerImpl)7 Map (java.util.Map)6 Set (java.util.Set)6 Collectors (java.util.stream.Collectors)6 TableStorage (org.apache.ignite.internal.storage.engine.TableStorage)6 InternalTableImpl (org.apache.ignite.internal.table.distributed.storage.InternalTableImpl)6 NetworkAddress (org.apache.ignite.network.NetworkAddress)6 RaftGroupService (org.apache.ignite.raft.client.service.RaftGroupService)6 UUID (java.util.UUID)5 SchemaDescriptor (org.apache.ignite.internal.schema.SchemaDescriptor)5 PartitionListener (org.apache.ignite.internal.table.distributed.raft.PartitionListener)5 DummyInternalTableImpl (org.apache.ignite.internal.table.impl.DummyInternalTableImpl)5 MessagingService (org.apache.ignite.network.MessagingService)5