Search in sources :

Example 6 with IncrementalDumpMetricCollector

use of org.apache.hadoop.hive.ql.parse.repl.dump.metric.IncrementalDumpMetricCollector in project hive by apache.

the class TestReplicationMetricUpdateOnFailure method testReplDumpNonRecoverableMissingStage.

@Test
public void testReplDumpNonRecoverableMissingStage() throws Exception {
    String dumpDir = TEST_PATH + Path.SEPARATOR + testName.getMethodName();
    MetricCollector.getInstance().deinit();
    IncrementalDumpMetricCollector metricCollector = new IncrementalDumpMetricCollector(null, TEST_PATH, conf);
    ReplDumpWork replDumpWork = Mockito.mock(ReplDumpWork.class);
    Mockito.when(replDumpWork.getCurrentDumpPath()).thenReturn(new Path(dumpDir));
    Mockito.when(replDumpWork.getMetricCollector()).thenReturn(metricCollector);
    Mockito.when(replDumpWork.dataCopyIteratorsInitialized()).thenThrow(nonRecoverableException);
    Task replDumpTask = TaskFactory.get(replDumpWork, conf);
    // ensure stages are missing initially and execute without reporting start metrics
    Assert.assertEquals(0, MetricCollector.getInstance().getMetrics().size());
    Assert.assertThrows(RuntimeException.class, () -> replDumpTask.execute());
    performNonRecoverableChecks(dumpDir, "REPL_DUMP");
}
Also used : Path(org.apache.hadoop.fs.Path) Task(org.apache.hadoop.hive.ql.exec.Task) IncrementalDumpMetricCollector(org.apache.hadoop.hive.ql.parse.repl.dump.metric.IncrementalDumpMetricCollector) ReplDumpWork(org.apache.hadoop.hive.ql.exec.repl.ReplDumpWork) Test(org.junit.Test)

Aggregations

IncrementalDumpMetricCollector (org.apache.hadoop.hive.ql.parse.repl.dump.metric.IncrementalDumpMetricCollector)6 Test (org.junit.Test)6 HashMap (java.util.HashMap)4 ReplStatsTracker (org.apache.hadoop.hive.ql.exec.repl.ReplStatsTracker)4 SnapshotUtils (org.apache.hadoop.hive.ql.exec.repl.util.SnapshotUtils)4 Metadata (org.apache.hadoop.hive.ql.parse.repl.metric.event.Metadata)3 Metric (org.apache.hadoop.hive.ql.parse.repl.metric.event.Metric)3 Progress (org.apache.hadoop.hive.ql.parse.repl.metric.event.Progress)3 ReplicationMetric (org.apache.hadoop.hive.ql.parse.repl.metric.event.ReplicationMetric)3 Stage (org.apache.hadoop.hive.ql.parse.repl.metric.event.Stage)3 Path (org.apache.hadoop.fs.Path)2 GetReplicationMetricsRequest (org.apache.hadoop.hive.metastore.api.GetReplicationMetricsRequest)2 ReplicationMetricList (org.apache.hadoop.hive.metastore.api.ReplicationMetricList)2 Task (org.apache.hadoop.hive.ql.exec.Task)2 ReplDumpWork (org.apache.hadoop.hive.ql.exec.repl.ReplDumpWork)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ReplicationMetrics (org.apache.hadoop.hive.metastore.api.ReplicationMetrics)1 BootstrapDumpMetricCollector (org.apache.hadoop.hive.ql.parse.repl.dump.metric.BootstrapDumpMetricCollector)1 ProgressMapper (org.apache.hadoop.hive.ql.parse.repl.metric.event.ProgressMapper)1 StageMapper (org.apache.hadoop.hive.ql.parse.repl.metric.event.StageMapper)1