Search in sources :

Example 11 with JraftServerImpl

use of org.apache.ignite.internal.raft.server.impl.JraftServerImpl in project ignite-3 by apache.

the class ItTxDistributedTestSingleNode method assertPartitionsSame.

/**
 * {@inheritDoc}
 */
@Override
protected boolean assertPartitionsSame(Table table, int partId) {
    int hash = 0;
    for (Map.Entry<ClusterNode, Loza> entry : raftServers.entrySet()) {
        Loza svc = (Loza) entry.getValue();
        JraftServerImpl server = (JraftServerImpl) svc.server();
        org.apache.ignite.raft.jraft.RaftGroupService grp = server.raftGroupService(table.name() + "-part-" + partId);
        JraftServerImpl.DelegatingStateMachine fsm = (JraftServerImpl.DelegatingStateMachine) grp.getRaftNode().getOptions().getFsm();
        PartitionListener listener = (PartitionListener) fsm.getListener();
        VersionedRowStore storage = listener.getStorage();
        if (hash == 0) {
            hash = storage.delegate().hashCode();
        } else if (hash != storage.delegate().hashCode()) {
            return false;
        }
    }
    return true;
}
Also used : ClusterNode(org.apache.ignite.network.ClusterNode) VersionedRowStore(org.apache.ignite.internal.table.distributed.storage.VersionedRowStore) Loza(org.apache.ignite.internal.raft.Loza) PartitionListener(org.apache.ignite.internal.table.distributed.raft.PartitionListener) JraftServerImpl(org.apache.ignite.internal.raft.server.impl.JraftServerImpl) Map(java.util.Map) Int2ObjectOpenHashMap(it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap) HashMap(java.util.HashMap)

Aggregations

JraftServerImpl (org.apache.ignite.internal.raft.server.impl.JraftServerImpl)11 Path (java.nio.file.Path)4 ClusterService (org.apache.ignite.network.ClusterService)4 NetworkAddress (org.apache.ignite.network.NetworkAddress)3 Peer (org.apache.ignite.raft.client.Peer)3 RaftGroupService (org.apache.ignite.raft.client.service.RaftGroupService)3 ArrayList (java.util.ArrayList)2 ClusterNode (org.apache.ignite.network.ClusterNode)2 NodeOptions (org.apache.ignite.raft.jraft.option.NodeOptions)2 AfterEach (org.junit.jupiter.api.AfterEach)2 Test (org.junit.jupiter.api.Test)2 Int2ObjectOpenHashMap (it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ExecutorService (java.util.concurrent.ExecutorService)1 Future (java.util.concurrent.Future)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 TimeoutException (java.util.concurrent.TimeoutException)1