Search in sources :

Example 6 with IncrementalLoadMetricCollector

use of org.apache.hadoop.hive.ql.parse.repl.load.metric.IncrementalLoadMetricCollector in project hive by apache.

the class TestReplicationMetricUpdateOnFailure method testRecoverableDDLFailureWithStageMissing.

@Test
public void testRecoverableDDLFailureWithStageMissing() throws Exception {
    // task-setup for DDL-Task
    DDLWork ddlWork = Mockito.mock(DDLWork.class);
    Context context = Mockito.mock(Context.class);
    Mockito.when(context.getExplainAnalyze()).thenReturn(ExplainConfiguration.AnalyzeState.ANALYZING);
    Mockito.when(ddlWork.isReplication()).thenReturn(true);
    String dumpDir = TEST_PATH + Path.SEPARATOR + testName.getMethodName();
    Mockito.when(ddlWork.getDumpDirectory()).thenReturn(dumpDir);
    Task<DDLWork> ddlTask = TaskFactory.get(ddlWork, conf);
    ddlTask.initialize(null, null, null, context);
    MetricCollector.getInstance().deinit();
    IncrementalLoadMetricCollector metricCollector = new IncrementalLoadMetricCollector(null, TEST_PATH, 1, conf);
    // ensure stages are missing initially and execute without reporting start metrics
    Assert.assertEquals(0, MetricCollector.getInstance().getMetrics().size());
    Map<String, Long> metricMap = new HashMap<>();
    Mockito.when(ddlWork.getMetricCollector()).thenReturn(metricCollector);
    Mockito.when(ddlWork.getDDLDesc()).thenThrow(recoverableException);
    // test recoverable error during DDL-Task
    ddlTask.execute();
    performRecoverableChecks("REPL_LOAD");
}
Also used : Context(org.apache.hadoop.hive.ql.Context) DDLWork(org.apache.hadoop.hive.ql.ddl.DDLWork) HashMap(java.util.HashMap) IncrementalLoadMetricCollector(org.apache.hadoop.hive.ql.parse.repl.load.metric.IncrementalLoadMetricCollector) Test(org.junit.Test)

Example 7 with IncrementalLoadMetricCollector

use of org.apache.hadoop.hive.ql.parse.repl.load.metric.IncrementalLoadMetricCollector in project hive by apache.

the class TestReplicationMetricUpdateOnFailure method testNonRecoverableDDLFailureWithStageMissing.

@Test
public void testNonRecoverableDDLFailureWithStageMissing() throws Exception {
    // task-setup for DDL-Task
    DDLWork ddlWork = Mockito.mock(DDLWork.class);
    Context context = Mockito.mock(Context.class);
    Mockito.when(context.getExplainAnalyze()).thenReturn(ExplainConfiguration.AnalyzeState.ANALYZING);
    Mockito.when(ddlWork.isReplication()).thenReturn(true);
    String dumpDir = TEST_PATH + Path.SEPARATOR + testName.getMethodName();
    Mockito.when(ddlWork.getDumpDirectory()).thenReturn(dumpDir);
    Task<DDLWork> ddlTask = TaskFactory.get(ddlWork, conf);
    ddlTask.initialize(null, null, null, context);
    MetricCollector.getInstance().deinit();
    IncrementalLoadMetricCollector metricCollector = new IncrementalLoadMetricCollector(null, TEST_PATH, 1, conf);
    // ensure stages are missing initially and execute without reporting start metrics
    Assert.assertEquals(0, MetricCollector.getInstance().getMetrics().size());
    Map<String, Long> metricMap = new HashMap<>();
    Mockito.when(ddlWork.getMetricCollector()).thenReturn(metricCollector);
    Mockito.when(ddlWork.getDDLDesc()).thenThrow(nonRecoverableException);
    // test non-recoverable error during DDL-Task, without initializing stage
    ddlTask.execute();
    performNonRecoverableChecks(dumpDir, "REPL_LOAD");
}
Also used : Context(org.apache.hadoop.hive.ql.Context) DDLWork(org.apache.hadoop.hive.ql.ddl.DDLWork) HashMap(java.util.HashMap) IncrementalLoadMetricCollector(org.apache.hadoop.hive.ql.parse.repl.load.metric.IncrementalLoadMetricCollector) Test(org.junit.Test)

Aggregations

IncrementalLoadMetricCollector (org.apache.hadoop.hive.ql.parse.repl.load.metric.IncrementalLoadMetricCollector)7 Test (org.junit.Test)6 HashMap (java.util.HashMap)3 Path (org.apache.hadoop.fs.Path)3 Context (org.apache.hadoop.hive.ql.Context)3 DDLWork (org.apache.hadoop.hive.ql.ddl.DDLWork)3 Task (org.apache.hadoop.hive.ql.exec.Task)3 ReplLoadWork (org.apache.hadoop.hive.ql.exec.repl.ReplLoadWork)3 HiveConf (org.apache.hadoop.hive.conf.HiveConf)1 TaskQueue (org.apache.hadoop.hive.ql.TaskQueue)1 DDLTask (org.apache.hadoop.hive.ql.ddl.DDLTask)1 MoveTask (org.apache.hadoop.hive.ql.exec.MoveTask)1 ReplStatsTracker (org.apache.hadoop.hive.ql.exec.repl.ReplStatsTracker)1 SnapshotUtils (org.apache.hadoop.hive.ql.exec.repl.util.SnapshotUtils)1 BootstrapLoadMetricCollector (org.apache.hadoop.hive.ql.parse.repl.load.metric.BootstrapLoadMetricCollector)1 ReplicationMetricCollector (org.apache.hadoop.hive.ql.parse.repl.metric.ReplicationMetricCollector)1 Metadata (org.apache.hadoop.hive.ql.parse.repl.metric.event.Metadata)1 Metric (org.apache.hadoop.hive.ql.parse.repl.metric.event.Metric)1 Progress (org.apache.hadoop.hive.ql.parse.repl.metric.event.Progress)1 ReplicationMetric (org.apache.hadoop.hive.ql.parse.repl.metric.event.ReplicationMetric)1