Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-4870

LoggingPhoenixConnection should log metrics when AutoCommit is set to True.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.14.0
    • 4.15.0, 5.1.0, 4.14.2
    • None
    • None

    Description

      When LoggingPhoenixConnection calls commit or close, metrics logs are written properly, however, when LoggingPhoenixConnection is explicitly set with AutoCommit as true, metrics don't get logged at all. This bug can also be tested by adding the following test scenario in PhoenixLoggingMetricsIT.java class. 

      @Test
      public void testPhoenixMetricsLoggedOnAutoCommit() throws Exception {
          // Autocommit is turned on explicitly
          loggedConn.setAutoCommit(true);
          //with executeUpdate() method
          // run SELECT to verify read metrics are logged
          String query = "SELECT * FROM " + tableName1;
          verifyQueryLevelMetricsLogging(query);
          // run UPSERT SELECT to verify mutation metrics are logged
          String upsertSelect = "UPSERT INTO " + tableName2 + " SELECT * FROM " + tableName1;
          loggedConn.createStatement().executeUpdate(upsertSelect);
          // Autocommit is turned on explicitly
          // Hence mutation metrics are expected during implicit commit
          assertTrue("Mutation write metrics are not logged for " + tableName2,
                  mutationWriteMetricsMap.size()  > 0);
          assertTrue("Mutation read metrics for not found for " + tableName1,
                  mutationReadMetricsMap.get(tableName1).size() > 0);
          //with execute() method
          loggedConn.createStatement().execute(upsertSelect);
          // Autocommit is turned on explicitly
          // Hence mutation metrics are expected during implicit commit
          assertTrue("Mutation write metrics are not logged for " + tableName2,
                  mutationWriteMetricsMap.size()  > 0);
          assertTrue("Mutation read metrics for not found for " + tableName1,
                  mutationReadMetricsMap.get(tableName1).size() > 0);
      
          clearAllTestMetricMaps();
      }
      

       

      Attachments

        1. PHOENIX-4870.patch
          15 kB
          Swaroopa Kadam
        2. PHOENIX-4870-4.x-HBase-1.4.patch
          15 kB
          Swaroopa Kadam

        Activity

          People

            swaroopa Swaroopa Kadam
            swaroopa Swaroopa Kadam
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m