Search in sources :

Example 26 with WMFullResourcePlan

use of org.apache.hadoop.hive.metastore.api.WMFullResourcePlan in project hive by apache.

the class HiveServer2 method startOrReconnectTezSessions.

private void startOrReconnectTezSessions() {
    LOG.info("Starting/Reconnecting tez sessions..");
    // TODO: add tez session reconnect after TEZ-3875
    WMFullResourcePlan resourcePlan = null;
    if (!StringUtils.isEmpty(wmQueue)) {
        try {
            resourcePlan = sessionHive.getActiveResourcePlan();
        } catch (HiveException e) {
            if (!HiveConf.getBoolVar(hiveConf, ConfVars.HIVE_IN_TEST_SSL)) {
                throw new RuntimeException(e);
            } else {
                // Ignore errors in SSL tests where the connection is misconfigured.
                resourcePlan = null;
            }
        }
        if (resourcePlan == null && HiveConf.getBoolVar(hiveConf, ConfVars.HIVE_IN_TEST)) {
            LOG.info("Creating a default resource plan for test");
            resourcePlan = createTestResourcePlan();
        }
    }
    initAndStartTezSessionPoolManager(resourcePlan);
    initAndStartWorkloadManager(resourcePlan);
}
Also used : WMFullResourcePlan(org.apache.hadoop.hive.metastore.api.WMFullResourcePlan) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException)

Example 27 with WMFullResourcePlan

use of org.apache.hadoop.hive.metastore.api.WMFullResourcePlan in project hive by apache.

the class ObjectStore method alterResourcePlan.

@Override
public WMFullResourcePlan alterResourcePlan(String name, WMNullableResourcePlan changes, boolean canActivateDisabled, boolean canDeactivate, boolean isReplace) throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException, MetaException {
    name = name == null ? null : normalizeIdentifier(name);
    if (isReplace && name == null) {
        throw new InvalidOperationException("Cannot replace without specifying the source plan");
    }
    boolean commited = false;
    Query query = null;
    // This method only returns the result when activating a resource plan.
    // We could also add a boolean flag to be specified by the caller to see
    // when the result might be needed.
    WMFullResourcePlan result = null;
    try {
        openTransaction();
        if (isReplace) {
            result = handleAlterReplace(name, changes);
        } else {
            result = handleSimpleAlter(name, changes, canActivateDisabled, canDeactivate);
        }
        commited = commitTransaction();
        return result;
    } catch (Exception e) {
        checkForConstraintException(e, "Resource plan name should be unique: ");
        throw e;
    } finally {
        rollbackAndCleanup(commited, query);
    }
}
Also used : WMFullResourcePlan(org.apache.hadoop.hive.metastore.api.WMFullResourcePlan) Query(javax.jdo.Query) InvalidOperationException(org.apache.hadoop.hive.metastore.api.InvalidOperationException) AlreadyExistsException(org.apache.hadoop.hive.metastore.api.AlreadyExistsException) InvalidInputException(org.apache.hadoop.hive.metastore.api.InvalidInputException) InvalidOperationException(org.apache.hadoop.hive.metastore.api.InvalidOperationException) SQLIntegrityConstraintViolationException(java.sql.SQLIntegrityConstraintViolationException) IOException(java.io.IOException) NoSuchObjectException(org.apache.hadoop.hive.metastore.api.NoSuchObjectException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException) JDOCanRetryException(javax.jdo.JDOCanRetryException) InvalidPartitionException(org.apache.hadoop.hive.metastore.api.InvalidPartitionException) UnknownPartitionException(org.apache.hadoop.hive.metastore.api.UnknownPartitionException) InvalidObjectException(org.apache.hadoop.hive.metastore.api.InvalidObjectException) JDOException(javax.jdo.JDOException) MissingTableException(org.datanucleus.store.rdbms.exceptions.MissingTableException) SQLException(java.sql.SQLException) UnknownDBException(org.apache.hadoop.hive.metastore.api.UnknownDBException) TException(org.apache.thrift.TException) JDODataStoreException(javax.jdo.JDODataStoreException) JDOObjectNotFoundException(javax.jdo.JDOObjectNotFoundException) UnknownTableException(org.apache.hadoop.hive.metastore.api.UnknownTableException)

Example 28 with WMFullResourcePlan

use of org.apache.hadoop.hive.metastore.api.WMFullResourcePlan in project hive by apache.

the class ObjectStore method fullFromMResourcePlan.

private WMFullResourcePlan fullFromMResourcePlan(MWMResourcePlan mplan) {
    if (mplan == null) {
        return null;
    }
    WMFullResourcePlan rp = new WMFullResourcePlan();
    rp.setPlan(fromMResourcePlan(mplan));
    for (MWMPool mPool : mplan.getPools()) {
        rp.addToPools(fromMPool(mPool, mplan.getName()));
        for (MWMTrigger mTrigger : mPool.getTriggers()) {
            rp.addToPoolTriggers(new WMPoolTrigger(mPool.getPath(), mTrigger.getName()));
        }
    }
    for (MWMTrigger mTrigger : mplan.getTriggers()) {
        rp.addToTriggers(fromMWMTrigger(mTrigger, mplan.getName()));
    }
    for (MWMMapping mMapping : mplan.getMappings()) {
        rp.addToMappings(fromMMapping(mMapping, mplan.getName()));
    }
    return rp;
}
Also used : WMFullResourcePlan(org.apache.hadoop.hive.metastore.api.WMFullResourcePlan) MWMPool(org.apache.hadoop.hive.metastore.model.MWMPool) MWMTrigger(org.apache.hadoop.hive.metastore.model.MWMTrigger) WMPoolTrigger(org.apache.hadoop.hive.metastore.api.WMPoolTrigger) MWMMapping(org.apache.hadoop.hive.metastore.model.MWMMapping)

Aggregations

WMFullResourcePlan (org.apache.hadoop.hive.metastore.api.WMFullResourcePlan)28 Test (org.junit.Test)15 HiveConf (org.apache.hadoop.hive.conf.HiveConf)13 CountDownLatch (java.util.concurrent.CountDownLatch)6 AtomicReference (java.util.concurrent.atomic.AtomicReference)6 WMResourcePlan (org.apache.hadoop.hive.metastore.api.WMResourcePlan)5 Trigger (org.apache.hadoop.hive.ql.wm.Trigger)5 WMPool (org.apache.hadoop.hive.metastore.api.WMPool)4 WMPoolTrigger (org.apache.hadoop.hive.metastore.api.WMPoolTrigger)4 ExecutionTrigger (org.apache.hadoop.hive.ql.wm.ExecutionTrigger)4 WMTrigger (org.apache.hadoop.hive.metastore.api.WMTrigger)3 WorkloadManager (org.apache.hadoop.hive.ql.exec.tez.WorkloadManager)3 IOException (java.io.IOException)2 ExecutionException (java.util.concurrent.ExecutionException)2 Query (javax.jdo.Query)2 InvalidOperationException (org.apache.hadoop.hive.metastore.api.InvalidOperationException)2 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)2 JsonNode (org.codehaus.jackson.JsonNode)2 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)2 Matchers.anyBoolean (org.mockito.Matchers.anyBoolean)2