You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2019/04/18 17:10:58 UTC

[impala] 01/03: IMPALA-8426: Logging error in DROP_TABLE event processing

This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 2ab23088849fa1da33e14b25816622837e50e99e
Author: Bharath Krishna <bh...@cloudera.com>
AuthorDate: Wed Apr 17 09:17:23 2019 -0700

    IMPALA-8426: Logging error in DROP_TABLE event processing
    
    Fixing the bug in condition check while logging in
    DROP_TABLE event processing. Also updating EVENTS_SKIPPED
    metric to keep track of the number of drop table events
    skipped when CREATION_TIME matches.
    
    Testing:
     - Added metric check to unit test.
     - Ran existing unit tests.
    
    Change-Id: I0a2ca10f82d183fd2821014e30b109b9f4474db4
    Reviewed-on: http://gerrit.cloudera.org:8080/13056
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 .../java/org/apache/impala/catalog/events/MetastoreEvents.java |  8 +++++---
 .../impala/catalog/events/MetastoreEventsProcessorTest.java    | 10 ++++++++--
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/fe/src/main/java/org/apache/impala/catalog/events/MetastoreEvents.java b/fe/src/main/java/org/apache/impala/catalog/events/MetastoreEvents.java
index a876c61..4f2b6e7 100644
--- a/fe/src/main/java/org/apache/impala/catalog/events/MetastoreEvents.java
+++ b/fe/src/main/java/org/apache/impala/catalog/events/MetastoreEvents.java
@@ -786,11 +786,13 @@ public class MetastoreEvents {
       Table removedTable = catalog_.removeTableIfExists(msTbl_, tblWasFound, tblMatched);
       if (removedTable != null) {
         infoLog("Removed table {} ", getFullyQualifiedTblName());
+      } else if (!tblWasFound.getRef()) {
+        debugLog("Table {} was not removed since it did not exist in catalog.",
+            tblName_);
       } else if (!tblMatched.getRef()) {
-        LOG.warn(debugString("Table %s was not removed from "
+        infoLog(debugString("Table %s was not removed from "
             + "catalog since the creation time of the table did not match", tblName_));
-      } else if (!tblWasFound.getRef()) {
-        debugLog("Table {} was not removed since it did not exist in catalog.", tblName_);
+        metrics_.getCounter(MetastoreEventsProcessor.EVENTS_SKIPPED_METRIC).inc();
       }
     }
   }
diff --git a/fe/src/test/java/org/apache/impala/catalog/events/MetastoreEventsProcessorTest.java b/fe/src/test/java/org/apache/impala/catalog/events/MetastoreEventsProcessorTest.java
index 7ab48e7..b9982e9 100644
--- a/fe/src/test/java/org/apache/impala/catalog/events/MetastoreEventsProcessorTest.java
+++ b/fe/src/test/java/org/apache/impala/catalog/events/MetastoreEventsProcessorTest.java
@@ -313,9 +313,9 @@ public class MetastoreEventsProcessorTest {
     // than that in the DROP_DB notification event. Two events are filtered here,
     // 1 : first CREATE_DATABASE as it is followed by another create of the same name.
     // 2 : DROP_DATABASE as it is trying to drop a database which is again created.
-    assertEquals(2, eventsProcessor_.getMetrics()
+    assertEquals(filteredCount + 2, eventsProcessor_.getMetrics()
         .getCounter(MetastoreEventsProcessor.EVENTS_SKIPPED_METRIC)
-        .getCount() - filteredCount);
+        .getCount());
 
     // Teardown step - Drop the created DB
     dropDatabaseCascadeFromImpala(TEST_DB_NAME);
@@ -716,7 +716,13 @@ public class MetastoreEventsProcessorTest {
     //second event should be drop_table. This event should also be skipped since
     // catalog state is more recent than the event
     assertEquals("DROP_TABLE", events.get(1).getEventType());
+    long numFilteredEvents =
+        eventsProcessor_.getMetrics()
+            .getCounter(MetastoreEventsProcessor.EVENTS_SKIPPED_METRIC).getCount();
     eventsProcessor_.processEvents(Lists.newArrayList(events.get(1)));
+    // Verify that the drop_table event is skipped and the metric is incremented.
+    assertEquals(numFilteredEvents + 1, eventsProcessor_.getMetrics()
+        .getCounter(MetastoreEventsProcessor.EVENTS_SKIPPED_METRIC).getCount());
     // even after drop table event, the table should still exist
     assertNotNull("Table should have existed since catalog state is current and event "
         + "is stale", catalog_.getTable(TEST_DB_NAME, testTblName));