.setAddress(rpcBindAddress) .setUserPort(userport) .setFabricPort(fabric.getPort()) .setStartTime(System.currentTimeMillis()) .setMaxDirectMemory(VM.getMaxDirectMemory())
@Override public void start() throws Exception { logger.info("Starting LocalKVStoreProvider"); coreStoreProvider.start(); if (fabricService != null) { final DefaultDataStoreRpcHandler rpcHandler = new LocalDataStoreRpcHandler(hostName, coreStoreProvider); final NodeEndpoint thisNode = NodeEndpoint.newBuilder() .setAddress(hostName) .setFabricPort(fabricService.get().getPort()) .build(); try { // DatastoreRpcService registers itself with fabric //noinspection ResultOfObjectAllocationIgnored new DatastoreRpcService(DirectProvider.wrap(thisNode), fabricService.get(), allocator, rpcHandler); } catch (RpcException e) { throw new DatastoreException("Failed to start rpc service", e); } } stores = StoreLoader.buildStores(scan, new StoreBuildingFactory() { @Override public <K, V> StoreBuilder<K, V> newStore() { return LocalKVStoreProvider.this.newStore(); } }); // recover after the stores are built coreStoreProvider.recoverIfPreviouslyCrashed(); logger.info("LocalKVStoreProvider is up"); }
@Test public void firstDisconnectRecovery() throws Exception { CountDownLatch closeLatch = new CountDownLatch(1); FabricRunnerFactory factory = getFabric().registerProtocol(new Protocol(closeLatch)); FabricCommandRunner runner = factory.getCommandRunner(getFabric().getAddress(), getFabric().getPort()); // send a message, establishing the connection. { SimpleMessage m = new SimpleMessage(1); runner.runCommand(m); m.getFuture().checkedGet(1000, TimeUnit.MILLISECONDS); } closeLatch.countDown(); // wait for the local connection to be closed. Thread.sleep(1000); // ensure we can send message again. { SimpleMessage m = new SimpleMessage(1); runner.runCommand(m); m.getFuture().checkedGet(1000, TimeUnit.MILLISECONDS); } }
@Test(expected=ChannelClosedException.class) public void failureOnDisconnection() throws Exception { FabricRunnerFactory factory = getFabric().registerProtocol(new Protocol(null)); FabricCommandRunner runner = factory.getCommandRunner(getFabric().getAddress(), getFabric().getPort()); SimpleMessage m = new SimpleMessage(2); runner.runCommand(m); m.getFuture().checkedGet(1000, TimeUnit.MILLISECONDS); }
.with(DremioConfig.DIST_WRITE_PATH_STRING, distpath) .clusterMode(ClusterMode.DISTRIBUTED) .localPort(masterDremioDaemon.getBindingProvider().lookup(FabricService.class).getPort() + 1) .isRemote(true) .with(DremioConfig.ENABLE_EXECUTOR_BOOL, false) .with(DremioConfig.DIST_WRITE_PATH_STRING, distpath) .clusterMode(ClusterMode.DISTRIBUTED) .localPort(masterDremioDaemon.getBindingProvider().lookup(FabricService.class).getPort() + 1) .isRemote(true) .zk("localhost:" + zkPort),
@Override void initProvider() throws Exception { allocator = new RootAllocator(20 * 1024 * 1024); pool = new CloseableThreadPool("test-remoteocckvstore"); localFabricService = new FabricServiceImpl(HOSTNAME, 45678, true, THREAD_COUNT, allocator, RESERVATION, MAX_ALLOCATION, TIMEOUT, pool); localFabricService.start(); remoteFabricService = new FabricServiceImpl(HOSTNAME, 45679, true, THREAD_COUNT, allocator, RESERVATION, MAX_ALLOCATION, TIMEOUT, pool); remoteFabricService.start(); localKVStoreProvider = new LocalKVStoreProvider(DremioTest.CLASSPATH_SCAN_RESULT, DirectProvider.wrap(localFabricService), allocator, HOSTNAME, tmpFolder.getRoot().toString(), true, true, true, false); localKVStoreProvider.start(); remoteKVStoreProvider = new RemoteKVStoreProvider( DremioTest.CLASSPATH_SCAN_RESULT, DirectProvider.wrap(NodeEndpoint.newBuilder() .setAddress(HOSTNAME) .setFabricPort(localFabricService.getPort()) .build()), DirectProvider.wrap(remoteFabricService), allocator, HOSTNAME); remoteKVStoreProvider.start(); }
@Override KVStoreProvider createKKStoreProvider() throws Exception { allocator = new RootAllocator(20 * 1024 * 1024); pool = new CloseableThreadPool("test-remoteindexedkvstore"); localFabricService = new FabricServiceImpl(HOSTNAME, 45678, true, THREAD_COUNT, allocator, RESERVATION, MAX_ALLOCATION, TIMEOUT, pool); localFabricService.start(); final Provider<FabricService> fab = () -> localFabricService; remoteFabricService = new FabricServiceImpl(HOSTNAME, 45679, true, THREAD_COUNT, allocator, RESERVATION, MAX_ALLOCATION, TIMEOUT, pool); remoteFabricService.start(); final Provider<FabricService> rfab = () -> remoteFabricService; localKVStoreProvider = new LocalKVStoreProvider(DremioTest.CLASSPATH_SCAN_RESULT, fab, allocator, HOSTNAME, null, true, true, true, false); localKVStoreProvider.start(); remoteKVStoreProvider = new RemoteKVStoreProvider( DremioTest.CLASSPATH_SCAN_RESULT, DirectProvider.wrap(NodeEndpoint.newBuilder() .setAddress(HOSTNAME) .setFabricPort(localFabricService.getPort()) .build()), rfab, allocator, HOSTNAME); remoteKVStoreProvider.start(); return remoteKVStoreProvider; }
@Override KVStoreProvider createKKStoreProvider() throws Exception { allocator = new RootAllocator(20 * 1024 * 1024); pool = new CloseableThreadPool("test-remoteocckvstore"); localFabricService = new FabricServiceImpl(HOSTNAME, 45678, true, THREAD_COUNT, allocator, RESERVATION, MAX_ALLOCATION, TIMEOUT, pool); localFabricService.start(); remoteFabricService = new FabricServiceImpl(HOSTNAME, 45679, true, THREAD_COUNT, allocator, RESERVATION, MAX_ALLOCATION, TIMEOUT, pool); remoteFabricService.start(); localKVStoreProvider = new LocalKVStoreProvider(DremioTest.CLASSPATH_SCAN_RESULT, DirectProvider.<FabricService>wrap(localFabricService), allocator, HOSTNAME, null, true, true, true, false); localKVStoreProvider.start(); remoteKVStoreProvider = new RemoteKVStoreProvider( DremioTest.CLASSPATH_SCAN_RESULT, DirectProvider.wrap(NodeEndpoint.newBuilder() .setAddress(HOSTNAME) .setFabricPort(localFabricService.getPort()) .build()), DirectProvider.<FabricService>wrap(remoteFabricService), allocator, HOSTNAME); remoteKVStoreProvider.start(); return remoteKVStoreProvider; }