use of org.apache.ignite.internal.raft.server.impl.RaftServerImpl in project ignite-3 by apache.
the class ItMetaStorageServiceTest method prepareMetaStorage.
/**
* Prepares meta storage by instantiating corresponding raft server with {@link MetaStorageListener} and {@link
* MetaStorageServiceImpl}.
*
* @return {@link MetaStorageService} instance.
*/
private MetaStorageService prepareMetaStorage() throws Exception {
List<Peer> peers = List.of(new Peer(cluster.get(0).topologyService().localMember().address()));
metaStorageRaftSrv = new RaftServerImpl(cluster.get(0), FACTORY);
metaStorageRaftSrv.start();
metaStorageRaftSrv.startRaftGroup(METASTORAGE_RAFT_GROUP_NAME, new MetaStorageListener(mockStorage), peers);
metaStorageRaftGrpSvc = RaftGroupServiceImpl.start(METASTORAGE_RAFT_GROUP_NAME, cluster.get(1), FACTORY, 10_000, peers, true, 200, executor).get(3, TimeUnit.SECONDS);
return new MetaStorageServiceImpl(metaStorageRaftGrpSvc, NODE_ID_0);
}
use of org.apache.ignite.internal.raft.server.impl.RaftServerImpl in project ignite-3 by apache.
the class ItInternalTableScanTest method setUp.
/**
* Prepare test environment.
* <ol>
* <li>Start network node.</li>
* <li>Start raft server.</li>
* <li>Prepare partitioned raft group.</li>
* <li>Prepare partitioned raft group service.</li>
* <li>Prepare internal table as a test object.</li>
* </ol>
*
* @throws Exception If any.
*/
@BeforeEach
public void setUp(TestInfo testInfo) throws Exception {
NetworkAddress nodeNetworkAddress = new NetworkAddress("localhost", 20_000);
network = ClusterServiceTestUtils.clusterService(testInfo, 20_000, new StaticNodeFinder(List.of(nodeNetworkAddress)), NETWORK_FACTORY);
network.start();
raftSrv = new RaftServerImpl(network, FACTORY);
raftSrv.start();
String grpName = "test_part_grp";
List<Peer> conf = List.of(new Peer(nodeNetworkAddress));
mockStorage = mock(PartitionStorage.class);
txManager = new TxManagerImpl(network, new HeapLockManager());
txManager.start();
UUID tblId = UUID.randomUUID();
raftSrv.startRaftGroup(grpName, new PartitionListener(tblId, new VersionedRowStore(mockStorage, txManager) {
@Override
protected Pair<BinaryRow, BinaryRow> versionedRow(@Nullable DataRow row, Timestamp timestamp) {
// Return as is.
return new Pair<>(new ByteBufferRow(row.valueBytes()), null);
}
}), conf);
executor = new ScheduledThreadPoolExecutor(20, new NamedThreadFactory(Loza.CLIENT_POOL_NAME));
RaftGroupService raftGrpSvc = RaftGroupServiceImpl.start(RAFT_GRP_ID, network, FACTORY, 10_000, conf, true, 200, executor).get(3, TimeUnit.SECONDS);
internalTbl = new InternalTableImpl(TEST_TABLE_NAME, tblId, Int2ObjectMaps.singleton(0, raftGrpSvc), 1, NetworkAddress::toString, txManager, mock(TableStorage.class));
}
Aggregations