IMPALA-8906: Fix flaky profile observability test

The test_query_profile_contains_query_compilation_metadata_load_events
is flaky because only non-zero stats are printed and the test is not
prepared to handle lines appearing based on conditions.

In general, zero values are printed in the profile as well, this makes
profile parsing simpler. Therefore, instead of changing the test the
condition has been removed as part of this change and the test is
updated accordingly.

Change-Id: I7f6172d75294c1dea8f6be086ebb303725c92620
Reviewed-on: http://gerrit.cloudera.org:8080/14704
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Csaba Ringhofer <csringhofer@cloudera.com>
diff --git a/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java b/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
index fd05ee5..f638408 100644
--- a/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
+++ b/fe/src/main/java/org/apache/impala/catalog/local/CatalogdMetaProvider.java
@@ -551,12 +551,8 @@
     profile.addToCounter(prefix + "Requests", TUnit.NONE, numHits + numMisses);
     profile.addToCounter(prefix + "Time", TUnit.TIME_MS,
         stopwatch.elapsed(TimeUnit.MILLISECONDS));
-    if (numHits > 0) {
-      profile.addToCounter(prefix + "Hits", TUnit.NONE, numHits);
-    }
-    if (numMisses > 0) {
-      profile.addToCounter(prefix + "Misses", TUnit.NONE, numMisses);
-    }
+    profile.addToCounter(prefix + "Hits", TUnit.NONE, numHits);
+    profile.addToCounter(prefix + "Misses", TUnit.NONE, numMisses);
   }
 
   /**
diff --git a/fe/src/test/java/org/apache/impala/catalog/local/CatalogdMetaProviderTest.java b/fe/src/test/java/org/apache/impala/catalog/local/CatalogdMetaProviderTest.java
index c4276d2..dcc922a 100644
--- a/fe/src/test/java/org/apache/impala/catalog/local/CatalogdMetaProviderTest.java
+++ b/fe/src/test/java/org/apache/impala/catalog/local/CatalogdMetaProviderTest.java
@@ -242,13 +242,15 @@
       profile = FrontendProfile.getCurrent();
     }
     TRuntimeProfileNode prof = profile.emitAsThrift();
-    assertEquals(3, prof.counters.size());
+    assertEquals(4, prof.counters.size());
     Collections.sort(prof.counters);
     assertEquals("TCounter(name:CatalogFetch.Tables.Hits, unit:NONE, value:1)",
         prof.counters.get(0).toString());
-    assertEquals("TCounter(name:CatalogFetch.Tables.Requests, unit:NONE, value:1)",
+    assertEquals("TCounter(name:CatalogFetch.Tables.Misses, unit:NONE, value:0)",
         prof.counters.get(1).toString());
-    assertEquals("CatalogFetch.Tables.Time", prof.counters.get(2).name);
+    assertEquals("TCounter(name:CatalogFetch.Tables.Requests, unit:NONE, value:1)",
+        prof.counters.get(2).toString());
+    assertEquals("CatalogFetch.Tables.Time", prof.counters.get(3).name);
   }
 
   @Test
diff --git a/tests/query_test/test_observability.py b/tests/query_test/test_observability.py
index 81840ca..9087852 100644
--- a/tests/query_test/test_observability.py
+++ b/tests/query_test/test_observability.py
@@ -311,16 +311,19 @@
     else:
       load_event_regexes = [
         r'Frontend:',
+        r'CatalogFetch.ColumnStats.Hits',
         r'CatalogFetch.ColumnStats.Misses',
         r'CatalogFetch.ColumnStats.Requests',
         r'CatalogFetch.ColumnStats.Time',
-        # The value of this counter may or not be present if it has a value of zero
-        r'CatalogFetch.Config.Misses|CatalogFetch.Config.Hits',
+        r'CatalogFetch.Config.Hits',
+        r'CatalogFetch.Config.Misses',
         r'CatalogFetch.Config.Requests',
         r'CatalogFetch.Config.Time',
         r'CatalogFetch.DatabaseList.Hits',
+        r'CatalogFetch.DatabaseList.Misses',
         r'CatalogFetch.DatabaseList.Requests',
         r'CatalogFetch.DatabaseList.Time',
+        r'CatalogFetch.PartitionLists.Hits',
         r'CatalogFetch.PartitionLists.Misses',
         r'CatalogFetch.PartitionLists.Requests',
         r'CatalogFetch.PartitionLists.Time',
@@ -333,8 +336,10 @@
         r'CatalogFetch.RPCs.Time',
         r'CatalogFetch.StorageLoad.Time',
         r'CatalogFetch.TableNames.Hits',
+        r'CatalogFetch.TableNames.Misses',
         r'CatalogFetch.TableNames.Requests',
         r'CatalogFetch.TableNames.Time',
+        r'CatalogFetch.Tables.Hits',
         r'CatalogFetch.Tables.Misses',
         r'CatalogFetch.Tables.Requests',
         r'CatalogFetch.Tables.Time']