org.apache.hadoop.hive.metastore.TSetIpAddressProcessor Java Examples
The following examples show how to use
org.apache.hadoop.hive.metastore.TSetIpAddressProcessor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HiveTableBaseTest.java From iceberg with Apache License 2.0 | 6 votes |
private TServer thriftServer() throws IOException, TTransportException, MetaException, InvocationTargetException, NoSuchMethodException, IllegalAccessException, NoSuchFieldException { final TServerSocketKeepAlive socket = new TServerSocketKeepAlive(new TServerSocket(0)); this.hiveConf = hiveConf(new Configuration(), socket.getServerSocket().getLocalPort()); HiveMetaStore.HMSHandler baseHandler = new HiveMetaStore.HMSHandler("new db based metaserver", hiveConf); IHMSHandler handler = RetryingHMSHandler.getProxy(hiveConf, baseHandler, true); final TTransportFactory transportFactory = new TTransportFactory(); final TSetIpAddressProcessor<IHMSHandler> processor = new TSetIpAddressProcessor<>(handler); TThreadPoolServer.Args args = new TThreadPoolServer.Args(socket) .processor(processor) .transportFactory(transportFactory) .protocolFactory(new TBinaryProtocol.Factory()) .minWorkerThreads(3) .maxWorkerThreads(5); return new TThreadPoolServer(args); }
Example #2
Source File: TSetIpAddressProcessorFactory.java From waggle-dance with Apache License 2.0 | 6 votes |
@Override public TProcessor getProcessor(TTransport transport) { try { if (transport instanceof TSocket) { Socket socket = ((TSocket) transport).getSocket(); log.debug("Received a connection from ip: {}", socket.getInetAddress().getHostAddress()); } CloseableIHMSHandler baseHandler = federatedHMSHandlerFactory.create(); IHMSHandler handler = newRetryingHMSHandler(ExceptionWrappingHMSHandler.newProxyInstance(baseHandler), hiveConf, false); transportMonitor.monitor(transport, baseHandler); return new TSetIpAddressProcessor<>(handler); } catch (MetaException | ReflectiveOperationException | RuntimeException e) { throw new RuntimeException("Error creating TProcessor", e); } }
Example #3
Source File: TestHiveMetastore.java From iceberg with Apache License 2.0 | 5 votes |
private TServer newThriftServer(TServerSocket socket, HiveConf conf) throws Exception { HiveConf serverConf = new HiveConf(conf); serverConf.set(HiveConf.ConfVars.METASTORECONNECTURLKEY.varname, "jdbc:derby:" + getDerbyPath() + ";create=true"); HiveMetaStore.HMSHandler baseHandler = new HiveMetaStore.HMSHandler("new db based metaserver", serverConf); IHMSHandler handler = RetryingHMSHandler.getProxy(serverConf, baseHandler, false); TThreadPoolServer.Args args = new TThreadPoolServer.Args(socket) .processor(new TSetIpAddressProcessor<>(handler)) .transportFactory(new TTransportFactory()) .protocolFactory(new TBinaryProtocol.Factory()) .minWorkerThreads(3) .maxWorkerThreads(5); return new TThreadPoolServer(args); }
Example #4
Source File: TSetIpAddressProcessorFactoryTest.java From waggle-dance with Apache License 2.0 | 4 votes |
@Test public void correctType() throws Exception { TProcessor processor = factory.getProcessor(transport); assertThat(TSetIpAddressProcessor.class.isAssignableFrom(processor.getClass()), is(true)); }
Example #5
Source File: HiveTestService.java From hudi with Apache License 2.0 | 4 votes |
public TServer startMetaStore(String forceBindIP, int port, HiveConf conf) throws IOException { try { // Server will create new threads up to max as necessary. After an idle // period, it will destory threads to keep the number of threads in the // pool to min. int minWorkerThreads = conf.getIntVar(HiveConf.ConfVars.METASTORESERVERMINTHREADS); int maxWorkerThreads = conf.getIntVar(HiveConf.ConfVars.METASTORESERVERMAXTHREADS); boolean tcpKeepAlive = conf.getBoolVar(HiveConf.ConfVars.METASTORE_TCP_KEEP_ALIVE); boolean useFramedTransport = conf.getBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_FRAMED_TRANSPORT); // don't support SASL yet // boolean useSasl = conf.getBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL); TServerTransport serverTransport; if (forceBindIP != null) { InetSocketAddress address = new InetSocketAddress(forceBindIP, port); serverTransport = tcpKeepAlive ? new TServerSocketKeepAlive(address) : new TServerSocket(address); } else { serverTransport = tcpKeepAlive ? new TServerSocketKeepAlive(port) : new TServerSocket(port); } TProcessor processor; TTransportFactory transFactory; HiveMetaStore.HMSHandler baseHandler = new HiveMetaStore.HMSHandler("new db based metaserver", conf, false); IHMSHandler handler = RetryingHMSHandler.getProxy(conf, baseHandler, true); if (conf.getBoolVar(HiveConf.ConfVars.METASTORE_EXECUTE_SET_UGI)) { transFactory = useFramedTransport ? new ChainedTTransportFactory(new TFramedTransport.Factory(), new TUGIContainingTransport.Factory()) : new TUGIContainingTransport.Factory(); processor = new TUGIBasedProcessor<>(handler); LOG.info("Starting DB backed MetaStore Server with SetUGI enabled"); } else { transFactory = useFramedTransport ? new TFramedTransport.Factory() : new TTransportFactory(); processor = new TSetIpAddressProcessor<>(handler); LOG.info("Starting DB backed MetaStore Server"); } TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport).processor(processor) .transportFactory(transFactory).protocolFactory(new TBinaryProtocol.Factory()) .minWorkerThreads(minWorkerThreads).maxWorkerThreads(maxWorkerThreads); final TServer tServer = new TThreadPoolServer(args); executorService.submit(tServer::serve); return tServer; } catch (Throwable x) { throw new IOException(x); } }
Example #6
Source File: HiveService.java From kite with Apache License 2.0 | 4 votes |
public TServer startMetaStore(String forceBindIP, int port, HiveConf conf) throws IOException { try { // Server will create new threads up to max as necessary. After an idle // period, it will destory threads to keep the number of threads in the // pool to min. int minWorkerThreads = conf.getIntVar(HiveConf.ConfVars.METASTORESERVERMINTHREADS); int maxWorkerThreads = conf.getIntVar(HiveConf.ConfVars.METASTORESERVERMAXTHREADS); boolean tcpKeepAlive = conf.getBoolVar(HiveConf.ConfVars.METASTORE_TCP_KEEP_ALIVE); boolean useFramedTransport = conf.getBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_FRAMED_TRANSPORT); // don't support SASL yet //boolean useSasl = conf.getBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL); TServerTransport serverTransport; if (forceBindIP != null) { InetSocketAddress address = new InetSocketAddress(forceBindIP, port); serverTransport = tcpKeepAlive ? new TServerSocketKeepAlive(address) : new TServerSocket(address); } else { serverTransport = tcpKeepAlive ? new TServerSocketKeepAlive(port) : new TServerSocket(port); } TProcessor processor; TTransportFactory transFactory; IHMSHandler handler = (IHMSHandler) HiveMetaStore .newRetryingHMSHandler("new db based metaserver", conf, true); if (conf.getBoolVar(HiveConf.ConfVars.METASTORE_EXECUTE_SET_UGI)) { transFactory = useFramedTransport ? new ChainedTTransportFactory(new TFramedTransport.Factory(), new TUGIContainingTransport.Factory()) : new TUGIContainingTransport.Factory(); processor = new TUGIBasedProcessor<IHMSHandler>(handler); LOG.info("Starting DB backed MetaStore Server with SetUGI enabled"); } else { transFactory = useFramedTransport ? new TFramedTransport.Factory() : new TTransportFactory(); processor = new TSetIpAddressProcessor<IHMSHandler>(handler); LOG.info("Starting DB backed MetaStore Server"); } TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport) .processor(processor) .transportFactory(transFactory) .protocolFactory(new TBinaryProtocol.Factory()) .minWorkerThreads(minWorkerThreads) .maxWorkerThreads(maxWorkerThreads); final TServer tServer = new TThreadPoolServer(args); executorService.submit(new Runnable() { @Override public void run() { tServer.serve(); } }); return tServer; } catch (Throwable x) { throw new IOException(x); } }