@Test public void testUrlHook() throws Exception { Configuration conf = MetastoreConf.newMetastoreConf(); MetastoreConf.setVar(conf, ConfVars.CONNECT_URL_HOOK, DummyJdoConnectionUrlHook.class.getName()); MetastoreConf.setVar(conf, ConfVars.CONNECT_URL_KEY, DummyJdoConnectionUrlHook.initialUrl); MetastoreConf.setVar(conf, ConfVars.RAW_STORE_IMPL, DummyRawStoreForJdoConnection.class.getName()); MetaStoreTestUtils.setConfForStandloneMode(conf); // Instantiating the HMSHandler with hive.metastore.checkForDefaultDb will cause it to // initialize an instance of the DummyRawStoreForJdoConnection HiveMetaStore.HMSHandler hms = new HiveMetaStore.HMSHandler( "test_metastore_connection_url_hook_hms_handler", conf); } }
inputProtoFactory = new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize); HMSHandler baseHandler = new HiveMetaStore.HMSHandler("new db based metaserver", conf, false); IHMSHandler handler = newRetryingHMSHandler(baseHandler, conf);
Warehouse wh = mock(Warehouse.class); HiveMetaStore.HMSHandler hms = new HiveMetaStore.HMSHandler("", conf, false); Method m = hms.getClass().getDeclaredMethod("initializeAddedPartition", Table.class, Partition.class, boolean.class); m.setAccessible(true);
inputProtoFactory = new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize); HMSHandler baseHandler = new HiveMetaStore.HMSHandler("new db based metaserver", conf, false); IHMSHandler handler = newRetryingHMSHandler(baseHandler, conf);
inputProtoFactory = new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize); HMSHandler baseHandler = new HiveMetaStore.HMSHandler("new db based metaserver", conf, false); IHMSHandler handler = newRetryingHMSHandler(baseHandler, conf);
inputProtoFactory = new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize); HMSHandler baseHandler = new HiveMetaStore.HMSHandler("new db based metaserver", conf, false); IHMSHandler handler = newRetryingHMSHandler(baseHandler, conf);
transFactory = saslServer.createTransportFactory(); processor = saslServer.wrapProcessor(new ThriftHiveMetastore.Processor( new HMSHandler("new db based metaserver", conf))); } else { processor = new ThriftHiveMetastore.Processor( new HMSHandler("new db based metaserver", conf)); transFactory = new TTransportFactory();
client = new HiveMetaStore.HMSHandler("hive client", conf); isConnected = true; return;
HMSHandler baseHandler = new HiveMetaStore.HMSHandler( "new db based metaserver", conf, true); rawStore = baseHandler.getMS();
HMSHandler baseHandler = new HiveMetaStore.HMSHandler( "new db based metaserver", conf, true); rawStore = baseHandler.getMS();
HMSHandler baseHandler = new HiveMetaStore.HMSHandler( "new db based metaserver", conf, true); rawStore = baseHandler.getMS();
HMSHandler baseHandler = new HiveMetaStore.HMSHandler( "new db based metaserver", conf, true); rawStore = baseHandler.getMS();
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); }
protected RetryingHMSHandler(HiveConf hiveConf, String name) throws MetaException { this.hiveConf = hiveConf; // This has to be called before initializing the instance of HMSHandler init(); this.base = (IHMSHandler) new HiveMetaStore.HMSHandler(name, hiveConf); }
public static Iface newRetryingHMSHandler(String name, HiveConf conf, boolean local) throws MetaException { HMSHandler baseHandler = new HiveMetaStore.HMSHandler(name, conf, false); return RetryingHMSHandler.getProxy(conf, baseHandler, local); }
public static Iface newRetryingHMSHandler(String name, HiveConf conf, boolean local) throws MetaException { HMSHandler baseHandler = new HiveMetaStore.HMSHandler(name, conf, false); return RetryingHMSHandler.getProxy(conf, baseHandler, local); }
static Iface newRetryingHMSHandler(String name, Configuration conf, boolean local) throws MetaException { HMSHandler baseHandler = new HiveMetaStore.HMSHandler(name, conf, false); return RetryingHMSHandler.getProxy(conf, baseHandler, local); }
/** * Create retrying HMS handler for embedded metastore. * * <h1>IMPORTANT</h1> * * This method is called indirectly by HiveMetastoreClient and HiveMetaStoreClientPreCatalog * using reflection. It can not be removed and its arguments can't be changed without matching * change in HiveMetastoreClient and HiveMetaStoreClientPreCatalog. * * @param conf configuration to use * @throws MetaException */ static Iface newRetryingHMSHandler(Configuration conf) throws MetaException { HMSHandler baseHandler = new HiveMetaStore.HMSHandler("hive client", conf, false); return RetryingHMSHandler.getProxy(conf, baseHandler, true); }
@Test public void testCreateAdminNAddUser() throws MetaException, NoSuchObjectException { Configuration conf = MetastoreConf.newMetastoreConf(); MetastoreConf.setVar(conf, ConfVars.USERS_IN_ADMIN_ROLE, "adminuser"); MetaStoreTestUtils.setConfForStandloneMode(conf); RawStore rawStore = new HMSHandler("testcreateroot", conf).getMS(); Role adminRole = rawStore.getRole(HiveMetaStore.ADMIN); Assert.assertTrue(adminRole.getOwnerName().equals(HiveMetaStore.ADMIN)); Assert.assertEquals(rawStore.listPrincipalGlobalGrants(HiveMetaStore.ADMIN, PrincipalType.ROLE) .get(0).getGrantInfo().getPrivilege(),"All"); Assert.assertEquals(rawStore.listRoles("adminuser", PrincipalType.USER).get(0). getRoleName(),HiveMetaStore.ADMIN); } }