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

upgrading CATALOG table fails when setting phoenix.connection.autoCommit=true

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.15.0, 5.1.0
    • None
    • None
    • HDP-3.1.4

    Description

      When setting phoenix.connection.autoCommit=true, upgrading CATALOG table fails with the following error:

      Error: java.util.NoSuchElementException (state=,code=0)
      java.sql.SQLException: java.util.NoSuchElementException
              at org.apache.phoenix.query.ConnectionQueryServicesImpl.upgradeSystemTables(ConnectionQueryServicesImpl.java:3211)
              at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2616)
              at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2533)
              at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:76)
              at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:2533)
              at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:255)
              at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:150)
              at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:221)
              at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)
              at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)
              at sqlline.Commands.connect(Commands.java:1064)
              at sqlline.Commands.connect(Commands.java:996)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
              at sqlline.SqlLine.dispatch(SqlLine.java:809)
              at sqlline.SqlLine.initArgs(SqlLine.java:588)
              at sqlline.SqlLine.begin(SqlLine.java:661)
              at sqlline.SqlLine.start(SqlLine.java:398)
              at sqlline.SqlLine.main(SqlLine.java:291)
      Caused by: java.util.NoSuchElementException
              at java.util.Collections$EmptyIterator.next(Collections.java:4189)
              at org.apache.phoenix.query.ConnectionQueryServicesImpl.addColumnQualifierColumn(ConnectionQueryServicesImpl.java:3267)
              at org.apache.phoenix.query.ConnectionQueryServicesImpl.upgradeSystemCatalogIfRequired(ConnectionQueryServicesImpl.java:2976)
              at org.apache.phoenix.query.ConnectionQueryServicesImpl.upgradeSystemTables(ConnectionQueryServicesImpl.java:3107)
              ... 21 more
      

      Looks like the following code assumes autoCommit=false, but autoCommit is true in this case, so upgrading fails:
      https://github.com/apache/phoenix/blob/5b84341d5b45421675fb2b0d1ffdd2cf46f8e395/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java#L3926-L4002

      I think we need to call PhoenixConnection.setAutoCommit(false) explicitly here.

      Attachments

        1. PHOENIX-5608.master.v1.patch
          1 kB
          Toshihiro Suzuki

        Issue Links

          Activity

            People

              brfrn169 Toshihiro Suzuki
              brfrn169 Toshihiro Suzuki
              Votes:
              0 Vote for this issue
              Watchers:
              4 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 - 50m
                  50m