Search in sources :

Example 11 with GlobalState

use of com.yelp.nrtsearch.server.luceneserver.GlobalState in project nrtsearch by Yelp.

the class QueryTest method setUpGrpcServer.

private GrpcServer setUpGrpcServer() throws IOException {
    String testIndex = "test_index";
    LuceneServerConfiguration luceneServerConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.STANDALONE, folder.getRoot());
    GlobalState globalState = GlobalState.createState(luceneServerConfiguration);
    return new GrpcServer(grpcCleanup, luceneServerConfiguration, folder, false, globalState, luceneServerConfiguration.getIndexDir(), testIndex, globalState.getPort());
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState)

Example 12 with GlobalState

use of com.yelp.nrtsearch.server.luceneserver.GlobalState in project nrtsearch by Yelp.

the class ReplicationServerTest method setUp.

@Before
public void setUp() throws IOException {
    // setup S3 for backup/restore
    s3Directory = folder.newFolder("s3").toPath();
    archiverDirectory = folder.newFolder("archiver").toPath();
    api = S3Mock.create(8011, s3Directory.toAbsolutePath().toString());
    api.start();
    s3 = new AmazonS3Client(new AnonymousAWSCredentials());
    s3.setEndpoint("http://127.0.0.1:8011");
    s3.createBucket(BUCKET_NAME);
    archiver = new ArchiverImpl(s3, BUCKET_NAME, archiverDirectory, new TarImpl(Tar.CompressionMode.LZ4));
    // set up primary servers
    String testIndex = "test_index";
    LuceneServerConfiguration luceneServerPrimaryConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.PRIMARY, folder.getRoot());
    GlobalState globalStatePrimary = GlobalState.createState(luceneServerPrimaryConfiguration);
    luceneServerPrimary = new GrpcServer(grpcCleanup, luceneServerPrimaryConfiguration, folder, false, globalStatePrimary, luceneServerPrimaryConfiguration.getIndexDir(), testIndex, globalStatePrimary.getPort(), archiver);
    replicationServerPrimary = new GrpcServer(grpcCleanup, luceneServerPrimaryConfiguration, folder, true, globalStatePrimary, luceneServerPrimaryConfiguration.getIndexDir(), testIndex, luceneServerPrimaryConfiguration.getReplicationPort(), archiver);
    // set up secondary servers
    LuceneServerConfiguration luceneServerSecondaryConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.REPLICA, folder.getRoot());
    GlobalState globalStateSecondary = GlobalState.createState(luceneServerSecondaryConfiguration);
    luceneServerSecondary = new GrpcServer(grpcCleanup, luceneServerSecondaryConfiguration, folder, false, globalStateSecondary, luceneServerSecondaryConfiguration.getIndexDir(), testIndex, globalStateSecondary.getPort(), archiver);
    replicationServerSecondary = new GrpcServer(grpcCleanup, luceneServerSecondaryConfiguration, folder, true, globalStateSecondary, luceneServerSecondaryConfiguration.getIndexDir(), testIndex, globalStateSecondary.getReplicationPort(), archiver);
}
Also used : AmazonS3Client(com.amazonaws.services.s3.AmazonS3Client) ArchiverImpl(com.yelp.nrtsearch.server.backup.ArchiverImpl) LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState) AnonymousAWSCredentials(com.amazonaws.auth.AnonymousAWSCredentials) TarImpl(com.yelp.nrtsearch.server.backup.TarImpl) Before(org.junit.Before)

Example 13 with GlobalState

use of com.yelp.nrtsearch.server.luceneserver.GlobalState in project nrtsearch by Yelp.

the class ReplicationTestFailureScenarios method startPrimaryServer.

public void startPrimaryServer() throws IOException {
    LuceneServerConfiguration luceneServerPrimaryConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.PRIMARY, folder.getRoot());
    GlobalState globalStatePrimary = GlobalState.createState(luceneServerPrimaryConfiguration);
    luceneServerPrimary = new GrpcServer(grpcCleanup, luceneServerPrimaryConfiguration, folder, false, globalStatePrimary, luceneServerPrimaryConfiguration.getIndexDir(), TEST_INDEX, globalStatePrimary.getPort(), archiver);
    replicationServerPrimary = new GrpcServer(grpcCleanup, luceneServerPrimaryConfiguration, folder, true, globalStatePrimary, luceneServerPrimaryConfiguration.getIndexDir(), TEST_INDEX, 9001, archiver);
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState)

Example 14 with GlobalState

use of com.yelp.nrtsearch.server.luceneserver.GlobalState in project nrtsearch by Yelp.

the class NodeNameResolverAndLoadBalancingTests method createGrpcServer.

private GrpcServer createGrpcServer() throws IOException {
    LuceneServerConfiguration luceneServerConfiguration = LuceneServerTestConfigurationFactory.getConfig(Mode.STANDALONE, folder.getRoot());
    GlobalState globalState = GlobalState.createState(luceneServerConfiguration);
    return new GrpcServer(grpcCleanup, luceneServerConfiguration, folder, false, globalState, luceneServerConfiguration.getIndexDir(), TEST_INDEX, luceneServerConfiguration.getPort());
}
Also used : LuceneServerConfiguration(com.yelp.nrtsearch.server.config.LuceneServerConfiguration) GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState) GrpcServer(com.yelp.nrtsearch.server.grpc.GrpcServer)

Example 15 with GlobalState

use of com.yelp.nrtsearch.server.luceneserver.GlobalState in project nrtsearch by Yelp.

the class DirSizeCollectorTest method getMockState.

private GlobalState getMockState(Set<String> indexNames, File baseDir) {
    GlobalState mockGlobalState = mock(GlobalState.class);
    when(mockGlobalState.getIndexNames()).thenReturn(indexNames);
    when(mockGlobalState.getIndexDir(any(String.class))).then(i -> Paths.get(baseDir.toString(), i.getArgument(0, String.class)));
    return mockGlobalState;
}
Also used : GlobalState(com.yelp.nrtsearch.server.luceneserver.GlobalState)

Aggregations

GlobalState (com.yelp.nrtsearch.server.luceneserver.GlobalState)19 LuceneServerConfiguration (com.yelp.nrtsearch.server.config.LuceneServerConfiguration)17 PersistentGlobalState (com.yelp.nrtsearch.server.luceneserver.state.PersistentGlobalState)3 AnonymousAWSCredentials (com.amazonaws.auth.AnonymousAWSCredentials)2 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)2 ArchiverImpl (com.yelp.nrtsearch.server.backup.ArchiverImpl)2 TarImpl (com.yelp.nrtsearch.server.backup.TarImpl)2 GrpcServer (com.yelp.nrtsearch.server.grpc.GrpcServer)2 Path (java.nio.file.Path)2 Before (org.junit.Before)2 Test (org.junit.Test)2 JsonObject (com.google.gson.JsonObject)1