Search in sources :

Example 21 with Tuple

use of org.apache.hadoop.hive.ql.parse.WarehouseInstance.Tuple in project hive by apache.

the class TestReplicationScenariosAcrossInstances method testIncrementalDumpEmptyDumpDirectory.

@Test
public void testIncrementalDumpEmptyDumpDirectory() throws Throwable {
    WarehouseInstance.Tuple tuple = primary.dump(primaryDbName);
    replica.load(replicatedDbName, primaryDbName).status(replicatedDbName).verifyResult(tuple.lastReplicationId);
    tuple = primary.dump(primaryDbName, Collections.emptyList());
    replica.load(replicatedDbName, primaryDbName).status(replicatedDbName).verifyResult(tuple.lastReplicationId);
    // create events for some other database and then dump the primaryDbName to dump an empty directory.
    String testDbName = primaryDbName + "_test";
    tuple = primary.run(" create database " + testDbName).run("create table " + testDbName + ".tbl (fld int)").dump(primaryDbName, Collections.emptyList());
    // Incremental load to existing database with empty dump directory should set the repl id to the last event at src.
    replica.load(replicatedDbName, primaryDbName).status(replicatedDbName).verifyResult(tuple.lastReplicationId);
    // Bootstrap load from an empty dump directory should return empty load directory error.
    tuple = primary.dump("someJunkDB", Collections.emptyList());
    try {
        replica.runCommand("REPL LOAD someJunkDB into someJunkDB");
        assert false;
    } catch (CommandProcessorException e) {
        assertTrue(e.getMessage().toLowerCase().contains("semanticException no data to load in path".toLowerCase()));
    }
    primary.run(" drop database if exists " + testDbName + " cascade");
}
Also used : CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) Tuple(org.apache.hadoop.hive.ql.parse.WarehouseInstance.Tuple) Test(org.junit.Test)

Aggregations

Tuple (org.apache.hadoop.hive.ql.parse.WarehouseInstance.Tuple)21 Test (org.junit.Test)21 Path (org.apache.hadoop.fs.Path)5 BehaviourInjection (org.apache.hadoop.hive.metastore.InjectableBehaviourObjectStore.BehaviourInjection)4 CallerArguments (org.apache.hadoop.hive.metastore.InjectableBehaviourObjectStore.CallerArguments)4 ArrayList (java.util.ArrayList)3 Nullable (javax.annotation.Nullable)2 List (java.util.List)1 Partition (org.apache.hadoop.hive.metastore.api.Partition)1 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)1 CommandProcessorException (org.apache.hadoop.hive.ql.processors.CommandProcessorException)1