public HiveConf createHiveConf(String metaStoreURI, String hiveMetaStorePrincipal) throws IOException { HiveConf hcatConf = new HiveConf(); hcatConf.setVar(HiveConf.ConfVars.METASTOREURIS, metaStoreURI); hcatConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3); hcatConf.setBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false); hcatConf.setBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL, true); hcatConf.set(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname, hiveMetaStorePrincipal); return hcatConf; }
private static void setConfProperties(HiveConf conf, Properties props) { for (java.util.Map.Entry<Object, Object> e : props.entrySet()) { conf.set((String) e.getKey(), (String) e.getValue()); } }
public static HiveConf getHiveConf() { HiveConf conf = new HiveConf(); // String metastoreDBLocation = "jdbc:derby:databaseName=/tmp/metastore_db;create=true"; // conf.set("javax.jdo.option.ConnectionDriverName","org.apache.derby.jdbc.EmbeddedDriver"); // conf.set("javax.jdo.option.ConnectionURL",metastoreDBLocation); conf.set("fs.raw.impl", RawFileSystem.class.getName()); conf.setVar(HiveConf.ConfVars.HIVE_TXN_MANAGER, txnMgr); conf.setBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, true); return conf; }
/** * Apply system properties to this object if the property name is defined in ConfVars * and the value is non-null and not an empty string. */ private void applySystemProperties() { Map<String, String> systemProperties = getConfSystemProperties(); for (Entry<String, String> systemProperty : systemProperties.entrySet()) { this.set(systemProperty.getKey(), systemProperty.getValue()); } }
private void configureAmRegistry(SessionType session) { if (amRegistryName != null) { bySessionId.put(session.getSessionId(), session); HiveConf conf = session.getConf(); conf.set(ConfVars.LLAP_TASK_SCHEDULER_AM_REGISTRY_NAME.varname, amRegistryName); conf.set(ConfVars.HIVESESSIONID.varname, session.getSessionId()); } }
@VisibleForTesting protected WmTezSession createSessionObject(String sessionId, HiveConf conf) { conf = (conf == null) ? new HiveConf(this.conf) : conf; conf.set(LlapTaskSchedulerService.LLAP_PLUGIN_ENDPOINT_ENABLED, "true"); return new WmTezSession(sessionId, this, expirationTracker, conf); }
private HiveConf createHiveConf(Class<?> clazz, String metaStoreUri) { HiveConf conf = new HiveConf(clazz); if (metaStoreUri != null) { conf.set(MetastoreConf.ConfVars.THRIFT_URIS.getHiveName(), metaStoreUri); } return conf; }
private void setTxnConfigs() { String validTxnList = queryState.getConf().get(ValidTxnList.VALID_TXNS_KEY); if (validTxnList != null) { conf.set(ValidTxnList.VALID_TXNS_KEY, validTxnList); } }
@Override public void beforeMethod(HiveTestEnvContext ctx) throws Exception { int sessionTimeout = (int) ctx.hiveConf.getTimeVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_SESSION_TIMEOUT, TimeUnit.MILLISECONDS); zooKeeper = new ZooKeeper("localhost:" + zkPort, sessionTimeout, new Watcher() { @Override public void process(WatchedEvent arg0) { } }); String zkServer = "localhost"; ctx.hiveConf.set("hive.zookeeper.quorum", zkServer); ctx.hiveConf.set("hive.zookeeper.client.port", "" + zkPort); }
private void recordValidTxns(HiveTxnManager txnMgr) throws LockException { String oldTxnString = conf.get(ValidTxnList.VALID_TXNS_KEY); if ((oldTxnString != null) && (oldTxnString.length() > 0)) { throw new IllegalStateException("calling recordValidTxn() more than once in the same " + JavaUtils.txnIdToString(txnMgr.getCurrentTxnId())); } ValidTxnList txnList = txnMgr.getValidTxns(); String txnStr = txnList.toString(); conf.set(ValidTxnList.VALID_TXNS_KEY, txnStr); LOG.debug("Encoding valid txns info " + txnStr + " txnid:" + txnMgr.getCurrentTxnId()); }
@Override protected void setUp() throws Exception { HiveConf hcatConf = new HiveConf(this.getClass()); hcatConf.set(ConfVars.PREEXECHOOKS.varname, ""); hcatConf.set(ConfVars.POSTEXECHOOKS.varname, ""); hcatConf.set(ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false"); hcatConf.set(ConfVars.SEMANTIC_ANALYZER_HOOK.varname, HCatSemanticAnalyzer.class.getName()); hcatDriver = DriverFactory.newDriver(hcatConf); SessionState.start(new CliSessionState(hcatConf)); }
private static Hive create(HiveConf c, boolean doRegisterAllFns) throws HiveException { if (c == null) { c = createHiveConf(); } c.set("fs.scheme.class", "dfs"); Hive newdb = new Hive(c, doRegisterAllFns); hiveDB.set(newdb); return newdb; }
private void enableTestOnlyCmd(HiveConf conf){ StringBuilder securityCMDs = new StringBuilder(conf.getVar(HiveConf.ConfVars.HIVE_SECURITY_COMMAND_WHITELIST)); for(String c : testOnlyCommands){ securityCMDs.append(","); securityCMDs.append(c); } conf.set(HiveConf.ConfVars.HIVE_SECURITY_COMMAND_WHITELIST.toString(), securityCMDs.toString()); } }
@Test public void testAcquireTxnLockCheckHeartbeatCreated() throws Exception { configuration.set("hive.txn.timeout", "100s"); writeLock.acquire(TRANSACTION_ID); verify(mockHeartbeatFactory).newInstance(eq(mockMetaStoreClient), eq(mockListener), eq(TRANSACTION_ID), eq(TABLES), eq(LOCK_ID), eq(75)); }
@Test public void testAcquireReadLockCheckHeartbeatCreated() throws Exception { configuration.set("hive.txn.timeout", "100s"); readLock.acquire(); verify(mockHeartbeatFactory).newInstance(eq(mockMetaStoreClient), eq(mockListener), any(Long.class), eq(SOURCES), eq(LOCK_ID), eq(75)); }
@Override public void setUp() throws Exception { super.setUp(); hiveConf.set(MetastoreConf.ConfVars.CREATE_TABLES_AS_ACID.getVarname(), "true"); }
/** Reopens the session that was found to not be running. */ @Override public TezSessionState reopen(TezSessionState sessionState) throws Exception { HiveConf sessionConf = sessionState.getConf(); if (sessionState.getQueueName() != null && sessionConf.get(TezConfiguration.TEZ_QUEUE_NAME) == null) { sessionConf.set(TezConfiguration.TEZ_QUEUE_NAME, sessionState.getQueueName()); } reopenInternal(sessionState); return sessionState; }