use of io.hetu.core.statestore.StateStoreManagerPlugin in project hetu-core by openlookeng.
the class TestCrossRegionDynamicFilter method createDCQueryRunner.
private static DistributedQueryRunner createDCQueryRunner(TestingPrestoServer hetuServer, Map<String, String> properties) throws Exception {
hetuServer.installPlugin(new TpchPlugin());
hetuServer.createCatalog("tpch", "tpch");
hetuServer.installPlugin(new StateStoreManagerPlugin());
hetuServer.loadStateSotre();
DistributedQueryRunner distributedQueryRunner = null;
try {
distributedQueryRunner = DistributedQueryRunner.builder(testSessionBuilder().build()).setNodeCount(1).build();
Map<String, String> connectorProperties = new HashMap<>(properties);
connectorProperties.putIfAbsent("connection-url", hetuServer.getBaseUrl().toString());
connectorProperties.putIfAbsent("connection-user", "root");
distributedQueryRunner.installPlugin(new DataCenterPlugin());
distributedQueryRunner.createDCCatalog("dc", "dc", connectorProperties);
distributedQueryRunner.installPlugin(new TpchPlugin());
distributedQueryRunner.createCatalog("tpch", "tpch", properties);
return distributedQueryRunner;
} catch (Throwable e) {
closeAllSuppress(e, distributedQueryRunner);
throw e;
}
}
use of io.hetu.core.statestore.StateStoreManagerPlugin in project hetu-core by openlookeng.
the class DistributedQueryRunnerWithStateStore method setupStateStore.
public void setupStateStore() throws Exception {
int port = SslSocketUtil.getAvailablePort();
for (TestingPrestoServer server : servers) {
server.installPlugin(new StateStoreManagerPlugin());
// State Store
StateStoreLauncher launcher = server.getInstance(Key.get(StateStoreLauncher.class));
if (launcher instanceof EmbeddedStateStoreLauncher) {
Set<String> ips = Sets.newHashSet(Arrays.asList("127.0.0.1"));
Map<String, String> stateStoreProperties = new HashMap<>();
stateStoreProperties.put(DISCOVERY_PORT_CONFIG_NAME, port + "");
stateStoreProperties.putIfAbsent(HazelcastConstants.DISCOVERY_MODE_CONFIG_NAME, HazelcastConstants.DISCOVERY_MODE_TCPIP);
this.stateStores.add(((EmbeddedStateStoreLauncher) launcher).launchStateStore(ips, stateStoreProperties));
}
launcher.launchStateStore();
StateStoreProvider provider = server.getInstance(Key.get(StateStoreProvider.class));
Seed seed = new FileBasedSeed("127.0.0.1:" + port, 0);
SeedStore seedStore = new SeedStore() {
@Override
public Collection<Seed> add(Collection<Seed> seeds) throws IOException {
return null;
}
@Override
public Collection<Seed> get() throws IOException {
return new ArrayList<>((Arrays.asList(seed)));
}
@Override
public Collection<Seed> remove(Collection<Seed> seeds) throws IOException {
return null;
}
@Override
public Seed create(Map<String, String> properties) {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public void setName(String name) {
}
};
server.getInstance(Key.get(SeedStoreManager.class)).setSeedStore(SeedStoreSubType.HAZELCAST, seedStore);
if (provider instanceof LocalStateStoreProvider) {
Map<String, String> stateStoreProperties = new HashMap<>();
stateStoreProperties.putIfAbsent(HazelcastConstants.DISCOVERY_MODE_CONFIG_NAME, HazelcastConstants.DISCOVERY_MODE_TCPIP);
stateStoreProperties.put(DISCOVERY_PORT_CONFIG_NAME, port + "");
((LocalStateStoreProvider) provider).setStateStore("hazelcast", stateStoreProperties);
((LocalStateStoreProvider) provider).createStateCollections();
}
provider.loadStateStore();
this.providers.add(provider);
}
}
Aggregations