Search in sources :

Example 6 with ConfVars

use of org.apache.hadoop.hive.conf.HiveConf.ConfVars in project hive by apache.

the class TezSessionPoolManager method getSession.

private TezSessionState getSession(HiveConf conf, boolean doOpen) throws Exception {
    String queueName = conf.get(TezConfiguration.TEZ_QUEUE_NAME);
    boolean hasQueue = (queueName != null) && !queueName.isEmpty();
    if (hasQueue) {
        switch(customQueueAllowed) {
            case FALSE:
                throw new HiveException("Specifying " + TezConfiguration.TEZ_QUEUE_NAME + " is not allowed");
            case IGNORE:
                {
                    LOG.warn("User has specified " + queueName + " queue; ignoring the setting");
                    queueName = null;
                    hasQueue = false;
                    conf.unset(TezConfiguration.TEZ_QUEUE_NAME);
                }
            // All good.
            default:
        }
    }
    for (ConfVars var : restrictedHiveConf) {
        String userValue = HiveConf.getVarWithoutType(conf, var), serverValue = HiveConf.getVarWithoutType(initConf, var);
        // Note: with some trickery, we could add logic for each type in ConfVars; for now the
        // potential spurious mismatches (e.g. 0 and 0.0 for float) should be easy to work around.
        validateRestrictedConfigValues(var.varname, userValue, serverValue);
    }
    for (String var : restrictedNonHiveConf) {
        String userValue = conf.get(var), serverValue = initConf.get(var);
        validateRestrictedConfigValues(var, userValue, serverValue);
    }
    // TODO Session re-use completely disabled for doAs=true. Always launches a new session.
    boolean nonDefaultUser = conf.getBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS);
    /*
     * if the user has specified a queue name themselves, we create a new session.
     * also a new session is created if the user tries to submit to a queue using
     * their own credentials. We expect that with the new security model, things will
     * run as user hive in most cases.
     */
    if (nonDefaultUser || !hasInitialSessions || hasQueue) {
        LOG.info("QueueName: {} nonDefaultUser: {} defaultQueuePool: {} hasInitialSessions: {}", queueName, nonDefaultUser, defaultQueuePool, hasInitialSessions);
        return getNewSessionState(conf, queueName, doOpen);
    }
    LOG.info("Choosing a session from the defaultQueuePool");
    while (true) {
        TezSessionPoolSession result = defaultQueuePool.take();
        if (result.tryUse())
            return result;
        LOG.info("Couldn't use a session [" + result + "]; attempting another one");
    }
}
Also used : HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) ConfVars(org.apache.hadoop.hive.conf.HiveConf.ConfVars)

Example 7 with ConfVars

use of org.apache.hadoop.hive.conf.HiveConf.ConfVars in project hive by apache.

the class HiveMetaStoreClient method isCompatibleWith.

@Override
public boolean isCompatibleWith(HiveConf conf) {
    // Make a copy of currentMetaVars, there is a race condition that
    // currentMetaVars might be changed during the execution of the method
    Map<String, String> currentMetaVarsCopy = currentMetaVars;
    if (currentMetaVarsCopy == null) {
        // recreate
        return false;
    }
    boolean compatible = true;
    for (ConfVars oneVar : HiveConf.metaVars) {
        // Since metaVars are all of different types, use string for comparison
        String oldVar = currentMetaVarsCopy.get(oneVar.varname);
        String newVar = conf.get(oneVar.varname, "");
        if (oldVar == null || (oneVar.isCaseSensitive() ? !oldVar.equals(newVar) : !oldVar.equalsIgnoreCase(newVar))) {
            LOG.info("Mestastore configuration " + oneVar.varname + " changed from " + oldVar + " to " + newVar);
            compatible = false;
        }
    }
    return compatible;
}
Also used : ConfVars(org.apache.hadoop.hive.conf.HiveConf.ConfVars)

Aggregations

ConfVars (org.apache.hadoop.hive.conf.HiveConf.ConfVars)7 Configuration (org.apache.hadoop.conf.Configuration)2 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)2 RPC (org.apache.hadoop.ipc.RPC)2 DataOutputStream (java.io.DataOutputStream)1 FSDataOutputStream (org.apache.hadoop.fs.FSDataOutputStream)1 HiveConf (org.apache.hadoop.hive.conf.HiveConf)1 LlapDaemonPolicyProvider (org.apache.hadoop.hive.llap.security.LlapDaemonPolicyProvider)1