This is an automated email from the ASF dual-hosted git repository. pboado pushed a commit to branch 5.x-cdh6 in repository https://gitbox.apache.org/repos/asf/phoenix.git
commit 3b529025478c2fe06181f724fb96ea69cdc4f9b9 Author: Chinmay Kulkarni <chinmayskulka...@gmail.com> AuthorDate: Fri Mar 8 00:43:53 2019 +0000 PHOENIX-5182: Deprecate getTotalSum API of the GlobalMetric interface --- .../apache/phoenix/execute/PartialCommitIT.java | 3 +- .../monitoring/PhoenixMetricsDisabledIT.java | 2 +- .../phoenix/monitoring/PhoenixMetricsIT.java | 100 ++++++++++----------- .../apache/phoenix/monitoring/GlobalMetric.java | 1 + 4 files changed, 53 insertions(+), 53 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java index 2b0c8b9..999927f 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java @@ -52,7 +52,6 @@ import org.apache.hadoop.hbase.wal.WALEdit; import org.apache.phoenix.end2end.BaseUniqueNamesOwnClusterIT; import org.apache.phoenix.execute.MutationState.MultiRowMutationState; import org.apache.phoenix.hbase.index.Indexer; -import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.monitoring.GlobalMetric; import org.apache.phoenix.monitoring.MetricType; @@ -249,7 +248,7 @@ public class PartialCommitIT extends BaseUniqueNamesOwnClusterIT { assertArrayEquals(expectedUncommittedStatementIndexes, uncommittedStatementIndexes); Map<String, Map<MetricType, Long>> mutationWriteMetrics = PhoenixRuntime.getWriteMetricInfoForMutationsSinceLastReset(con); assertEquals(expectedUncommittedStatementIndexes.length, mutationWriteMetrics.get(bFailureTable).get(MUTATION_BATCH_FAILED_SIZE).intValue()); - assertEquals(expectedUncommittedStatementIndexes.length, GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getTotalSum()); + assertEquals(expectedUncommittedStatementIndexes.length, GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getValue()); } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsDisabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsDisabledIT.java index 85cf1a3..1efbc46 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsDisabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsDisabledIT.java @@ -72,7 +72,7 @@ public class PhoenixMetricsDisabledIT extends BaseUniqueNamesOwnClusterIT { public void testResetGlobalPhoenixMetrics() { for (GlobalMetric m : PhoenixRuntime.getGlobalPhoenixClientMetrics()) { assertThat(m, CoreMatchers.<GlobalMetric>instanceOf(NoOpGlobalMetricImpl.class)); - assertEquals(NO_VALUE, m.getTotalSum()); + assertEquals(NO_VALUE, m.getValue()); assertEquals(NO_SAMPLES, m.getNumberOfSamples()); } } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java index 0764ff7..e00fab3 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java @@ -96,7 +96,7 @@ public class PhoenixMetricsIT extends BasePhoenixMetricsIT { resetGlobalMetrics(); for (GlobalMetric m : PhoenixRuntime.getGlobalPhoenixClientMetrics()) { assertThat(m, CoreMatchers.<GlobalMetric>instanceOf(GlobalMetricImpl.class)); - assertEquals(0, m.getTotalSum()); + assertEquals(0, m.getValue()); assertEquals(0, m.getNumberOfSamples()); } assertTrue(verifyMetricsFromSink()); @@ -114,25 +114,25 @@ public class PhoenixMetricsIT extends BasePhoenixMetricsIT { rs.getString(1); rs.getString(2); } - assertEquals(1, GLOBAL_NUM_PARALLEL_SCANS.getMetric().getTotalSum()); - assertEquals(1, GLOBAL_SELECT_SQL_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_REJECTED_TASK_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_QUERY_TIMEOUT_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_FAILED_QUERY_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_SPOOL_FILE_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_MUTATION_BATCH_SIZE.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_MUTATION_BYTES.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getTotalSum()); - - assertTrue(GLOBAL_SCAN_BYTES.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_QUERY_TIME.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_TASK_END_TO_END_TIME.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_TASK_EXECUTION_TIME.getMetric().getTotalSum() > 0); - - assertTrue(GLOBAL_HBASE_COUNT_RPC_CALLS.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_HBASE_COUNT_SCANNED_REGIONS.getMetric().getTotalSum() > 0); + assertEquals(1, GLOBAL_NUM_PARALLEL_SCANS.getMetric().getValue()); + assertEquals(1, GLOBAL_SELECT_SQL_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_REJECTED_TASK_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_QUERY_TIMEOUT_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_FAILED_QUERY_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_SPOOL_FILE_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_MUTATION_BATCH_SIZE.getMetric().getValue()); + assertEquals(0, GLOBAL_MUTATION_BYTES.getMetric().getValue()); + assertEquals(0, GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getValue()); + + assertTrue(GLOBAL_SCAN_BYTES.getMetric().getValue() > 0); + assertTrue(GLOBAL_QUERY_TIME.getMetric().getValue() > 0); + assertTrue(GLOBAL_TASK_END_TO_END_TIME.getMetric().getValue() > 0); + assertTrue(GLOBAL_TASK_EXECUTION_TIME.getMetric().getValue() > 0); + + assertTrue(GLOBAL_HBASE_COUNT_RPC_CALLS.getMetric().getValue() > 0); + assertTrue(GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.getMetric().getValue() > 0); + assertTrue(GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS.getMetric().getValue() > 0); + assertTrue(GLOBAL_HBASE_COUNT_SCANNED_REGIONS.getMetric().getValue() > 0); assertTrue(verifyMetricsFromSink()); } @@ -141,17 +141,17 @@ public class PhoenixMetricsIT extends BasePhoenixMetricsIT { public void testGlobalPhoenixMetricsForMutations() throws Exception { String tableName = generateUniqueName(); createTableAndInsertValues(tableName, true); - assertEquals(10, GLOBAL_MUTATION_BATCH_SIZE.getMetric().getTotalSum()); - assertEquals(10, GLOBAL_MUTATION_SQL_COUNTER.getMetric().getTotalSum()); - assertTrue(GLOBAL_MUTATION_BYTES.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_MUTATION_COMMIT_TIME.getMetric().getTotalSum() > 0); - assertEquals(0, GLOBAL_NUM_PARALLEL_SCANS.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_SELECT_SQL_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_REJECTED_TASK_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_QUERY_TIMEOUT_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_FAILED_QUERY_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_SPOOL_FILE_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getTotalSum()); + assertEquals(10, GLOBAL_MUTATION_BATCH_SIZE.getMetric().getValue()); + assertEquals(10, GLOBAL_MUTATION_SQL_COUNTER.getMetric().getValue()); + assertTrue(GLOBAL_MUTATION_BYTES.getMetric().getValue() > 0); + assertTrue(GLOBAL_MUTATION_COMMIT_TIME.getMetric().getValue() > 0); + assertEquals(0, GLOBAL_NUM_PARALLEL_SCANS.getMetric().getValue()); + assertEquals(0, GLOBAL_SELECT_SQL_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_REJECTED_TASK_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_QUERY_TIMEOUT_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_FAILED_QUERY_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_SPOOL_FILE_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getValue()); assertTrue(verifyMetricsFromSink()); } @@ -169,24 +169,24 @@ public class PhoenixMetricsIT extends BasePhoenixMetricsIT { String dml = "UPSERT INTO " + tableTo + " (K, V) SELECT K, V FROM " + tableFrom; conn.createStatement().executeUpdate(dml); conn.commit(); - assertEquals(10, GLOBAL_MUTATION_BATCH_SIZE.getMetric().getTotalSum()); - assertEquals(1, GLOBAL_MUTATION_SQL_COUNTER.getMetric().getTotalSum()); - assertEquals(1, GLOBAL_NUM_PARALLEL_SCANS.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_QUERY_TIME.getMetric().getTotalSum()); - assertTrue(GLOBAL_SCAN_BYTES.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_MUTATION_BYTES.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_MUTATION_COMMIT_TIME.getMetric().getTotalSum() > 0); - assertEquals(0, GLOBAL_SELECT_SQL_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_REJECTED_TASK_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_QUERY_TIMEOUT_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_FAILED_QUERY_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_SPOOL_FILE_COUNTER.getMetric().getTotalSum()); - assertEquals(0, GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getTotalSum()); - - assertTrue(GLOBAL_HBASE_COUNT_RPC_CALLS.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS.getMetric().getTotalSum() > 0); - assertTrue(GLOBAL_HBASE_COUNT_SCANNED_REGIONS.getMetric().getTotalSum() > 0); + assertEquals(10, GLOBAL_MUTATION_BATCH_SIZE.getMetric().getValue()); + assertEquals(1, GLOBAL_MUTATION_SQL_COUNTER.getMetric().getValue()); + assertEquals(1, GLOBAL_NUM_PARALLEL_SCANS.getMetric().getValue()); + assertEquals(0, GLOBAL_QUERY_TIME.getMetric().getValue()); + assertTrue(GLOBAL_SCAN_BYTES.getMetric().getValue() > 0); + assertTrue(GLOBAL_MUTATION_BYTES.getMetric().getValue() > 0); + assertTrue(GLOBAL_MUTATION_COMMIT_TIME.getMetric().getValue() > 0); + assertEquals(0, GLOBAL_SELECT_SQL_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_REJECTED_TASK_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_QUERY_TIMEOUT_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_FAILED_QUERY_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_SPOOL_FILE_COUNTER.getMetric().getValue()); + assertEquals(0, GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getValue()); + + assertTrue(GLOBAL_HBASE_COUNT_RPC_CALLS.getMetric().getValue() > 0); + assertTrue(GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.getMetric().getValue() > 0); + assertTrue(GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS.getMetric().getValue() > 0); + assertTrue(GLOBAL_HBASE_COUNT_SCANNED_REGIONS.getMetric().getValue() > 0); assertTrue(verifyMetricsFromSink()); } @@ -203,7 +203,7 @@ public class PhoenixMetricsIT extends BasePhoenixMetricsIT { private boolean verifyMetricsFromSink() { Map<String, Long> expectedMetrics = new HashMap<>(); for (GlobalMetric m : PhoenixRuntime.getGlobalPhoenixClientMetrics()) { - expectedMetrics.put(m.getMetricType().name(), m.getTotalSum()); + expectedMetrics.put(m.getMetricType().name(), m.getValue()); } for (int i = 0; i < MAX_RETRIES; i++) { diff --git a/phoenix-core/src/main/java/org/apache/phoenix/monitoring/GlobalMetric.java b/phoenix-core/src/main/java/org/apache/phoenix/monitoring/GlobalMetric.java index f3b562f..2a4af86 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/monitoring/GlobalMetric.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/monitoring/GlobalMetric.java @@ -33,5 +33,6 @@ public interface GlobalMetric extends Metric { /** * @return Sum of the values of the metric sampled since the last {@link #reset()} call. */ + @Deprecated public long getTotalSum(); }