Uploaded image for project: 'Apache Lens (Retired)'
  1. Apache Lens (Retired)
  2. LENS-639

Error creating table finished_queries in MySQL when autocommit=true

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.3
    • server

    Description

      I am trying to persist the finished queries in a MySQL database by changing the following settings :

      <property>
      <name>lens.server.db.driver.name</name>
      <value>com.mysql.jdbc.Driver</value>
      <description>Database driver for database where Finished queries have to be stored.
      Also used for database based user config loaders</description>
      </property>
      <property>
      <name>lens.server.db.jdbc.url</name>
      <value>jdbc:mysql://localhost:3306/lens_db</value>
      <description>JDBC URL where the database for storing finished queries is located.
      Also used for database based user config loaders</description>
      </property>
      <property>
      <name>lens.server.db.jdbc.user</name>
      <value>username</value>
      <description>JDBC User for Finished queries table. Also used for database based user config loaders</description>
      </property>
      <property>
      <name>lens.server.db.jdbc.pass</name>
      <value>password</value>
      <description>JDBC Password for Finished queries table. Also used for database based user config loaders</description>
      </property>

      The following exception is thrown on when lens starts :

      30 Jun 2015 14:27:34,052 [main] WARN org.apache.lens.server.query.LensServerDAO - Unable to create finished queries table
      java.sql.SQLException: Can't call commit when autocommit=true
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:930)
      at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1597)
      at org.apache.commons.dbcp.DelegatingConnection.commit(DelegatingConnection.java:334)
      at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.commit(PoolingDataSource.java:211)
      at org.apache.lens.server.query.LensServerDAO.createFinishedQueriesTable(LensServerDAO.java:104)
      at org.apache.lens.server.query.QueryExecutionServiceImpl.initalizeFinishedQueryStore(QueryExecutionServiceImpl.java:890)
      at org.apache.lens.server.query.QueryExecutionServiceImpl.init(QueryExecutionServiceImpl.java:877)
      at org.apache.hive.service.CompositeService.init(CompositeService.java:59)
      at org.apache.lens.server.LensServices.init(LensServices.java:206)
      at org.apache.lens.server.LensServer.startServices(LensServer.java:137)
      at org.apache.lens.server.LensServer.<init>(LensServer.java:89)
      at org.apache.lens.server.LensServer.createLensServer(LensServer.java:78)
      at org.apache.lens.server.LensServer.main(LensServer.java:190)

      The bug lies in createFinishedQueriesTable() method in LensServerDAO. commit() method will throw this exception if autocommit is true. We must put a check so that we commit only when autocommit is false.

      Attachments

        1. LENS-639.02.patch
          4 kB
          Deepak Barr

        Issue Links

          Activity

            People

              deepak.barr Deepak Barr
              deepak.barr Deepak Barr
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: