Search in sources :

Example 6 with PartitionListener

use of org.apache.ignite.internal.table.distributed.raft.PartitionListener 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

PartitionListener (org.apache.ignite.internal.table.distributed.raft.PartitionListener)6 VersionedRowStore (org.apache.ignite.internal.table.distributed.storage.VersionedRowStore)6 RaftGroupService (org.apache.ignite.raft.client.service.RaftGroupService)5 Int2ObjectOpenHashMap (it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap)4 List (java.util.List)4 Map (java.util.Map)4 UUID (java.util.UUID)4 Path (java.nio.file.Path)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 Loza (org.apache.ignite.internal.raft.Loza)3 InternalTableImpl (org.apache.ignite.internal.table.distributed.storage.InternalTableImpl)3 ClusterNode (org.apache.ignite.network.ClusterNode)3 NetworkAddress (org.apache.ignite.network.NetworkAddress)3 IOException (java.io.IOException)2 Files (java.nio.file.Files)2 HashSet (java.util.HashSet)2 NoSuchElementException (java.util.NoSuchElementException)2 Set (java.util.Set)2