Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-1642

CatalogServer need to check meta table first.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.11.0, 0.10.2
    • Component/s: Catalog
    • Labels:
      None

      Description

      When I start up tajo-0.11.0-SNAPSHOT with the catalog-site.xml which is set for tajo-0.10.1-SNAPSHOT, I failed to start up TajoMaster as following

      09 11:20:52 INFO store.XMLCatalogSchemaManager: Skip to create META databse object. Already exists.
      15/06/09 11:20:52 INFO store.XMLCatalogSchemaManager: Skip to create TABLESPACES databse object. Already exists.
      15/06/09 11:20:52 INFO store.XMLCatalogSchemaManager: Skip to create DATABASES_ databse object. Already exists.
      15/06/09 11:20:52 INFO store.XMLCatalogSchemaManager: Skip to create TABLES databse object. Already exists.
      15/06/09 11:20:52 INFO store.XMLCatalogSchemaManager: Skip to create COLUMNS databse object. Already exists.
      15/06/09 11:20:52 INFO store.XMLCatalogSchemaManager: Skip to create OPTIONS databse object. Already exists.
      15/06/09 11:20:52 INFO store.XMLCatalogSchemaManager: Skip to create INDEXES databse object. Already exists.
      15/06/09 11:20:52 INFO store.XMLCatalogSchemaManager: Skip to create STATS databse object. Already exists.
      15/06/09 11:20:52 INFO store.XMLCatalogSchemaManager: Skip to create PARTITION_METHODS databse object. Already exists.
      15/06/09 11:20:52 INFO store.XMLCatalogSchemaManager: Skip to create PARTITIONS databse object. Already exists.
      15/06/09 11:20:52 WARN store.XMLCatalogSchemaManager: Failed to drop database objects TABLE TABLESPACES,TABLE DATABASES_,TABLE TABLES,TABLE PARTITION_KEYS
      15/06/09 11:20:52 ERROR catalog.CatalogServer: CatalogServer initialization failed
      java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      	at org.apache.tajo.catalog.CatalogServer.serviceInit(CatalogServer.java:135)
      	at org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
      	at org.apache.hadoop.service.CompositeService.serviceInit(CompositeService.java:107)
      	at org.apache.tajo.master.TajoMaster.serviceInit(TajoMaster.java:214)
      	at org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
      	at org.apache.tajo.master.TajoMaster.main(TajoMaster.java:603)
      Caused by: org.apache.tajo.catalog.exception.CatalogException: Cannot initialize the persistent storage of Catalog
      	at org.apache.tajo.catalog.store.AbstractDBStore.<init>(AbstractDBStore.java:162)
      	at org.apache.tajo.catalog.store.MySQLStore.<init>(MySQLStore.java:36)
      	... 10 more
      Caused by: org.apache.tajo.catalog.exception.CatalogException: Cannot add foreign key constraint
      	at org.apache.tajo.catalog.store.XMLCatalogSchemaManager.createBaseSchema(XMLCatalogSchemaManager.java:305)
      	at org.apache.tajo.catalog.store.AbstractDBStore.createBaseTable(AbstractDBStore.java:86)
      	at org.apache.tajo.catalog.store.AbstractDBStore.<init>(AbstractDBStore.java:150)
      	... 11 more
      Caused by: java.sql.SQLException: Cannot add foreign key constraint
      	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
      	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
      	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
      	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2531)
      	at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1618)
      	at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1549)
      	at org.apache.tajo.catalog.store.XMLCatalogSchemaManager.createBaseSchema(XMLCatalogSchemaManager.java:301)
      	... 13 more
      

      The cause of above error is that table schema difference with tajo-0.10.1-SNAPSHOT and tajo-0.11.0-SNAPSHOT. A few new tables for table partition management is added to tajo-0.11.0-SNAPSHOT.

      I thought that the error was trivial. But I found that it had seriously affected to existing catalog because all column informations had been deleted.

      Fortunately, I found some problem of AbstractDBStore and I pland to send a PR today.

        Issue Links

          Activity

          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Tajo-master-build #735 (See https://builds.apache.org/job/Tajo-master-build/735/)
          TAJO-1642: CatalogServer need to check meta table first. (jaehwa) (blrunner: rev b24d18f5b3cf9ed3c4a4a41bff654c965521542f)

          • CHANGES
          • tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/XMLCatalogSchemaManager.java
          • tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #735 (See https://builds.apache.org/job/Tajo-master-build/735/ ) TAJO-1642 : CatalogServer need to check meta table first. (jaehwa) (blrunner: rev b24d18f5b3cf9ed3c4a4a41bff654c965521542f) CHANGES tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/XMLCatalogSchemaManager.java tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
          Hide
          hudson Hudson added a comment -

          ABORTED: Integrated in Tajo-master-CODEGEN-build #374 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/374/)
          TAJO-1642: CatalogServer need to check meta table first. (jaehwa) (blrunner: rev b24d18f5b3cf9ed3c4a4a41bff654c965521542f)

          • tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
          • CHANGES
          • tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/XMLCatalogSchemaManager.java
          Show
          hudson Hudson added a comment - ABORTED: Integrated in Tajo-master-CODEGEN-build #374 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/374/ ) TAJO-1642 : CatalogServer need to check meta table first. (jaehwa) (blrunner: rev b24d18f5b3cf9ed3c4a4a41bff654c965521542f) tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java CHANGES tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/XMLCatalogSchemaManager.java
          Hide
          blrunner Jaehwa Jung added a comment -

          Thanks Jihoon Son

          I've just committed the patch to master branch and 0.10.2 branch.

          Show
          blrunner Jaehwa Jung added a comment - Thanks Jihoon Son I've just committed the patch to master branch and 0.10.2 branch.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/tajo/pull/600

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tajo/pull/600
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jihoonson commented on the pull request:

          https://github.com/apache/tajo/pull/600#issuecomment-114512668

          +1 LGTM!

          Show
          githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on the pull request: https://github.com/apache/tajo/pull/600#issuecomment-114512668 +1 LGTM!
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user blrunner commented on the pull request:

          https://github.com/apache/tajo/pull/600#issuecomment-114068664

          Hi @jihoonson

          Thanks for your review.
          I've just updated the patch using your comments.

          Show
          githubbot ASF GitHub Bot added a comment - Github user blrunner commented on the pull request: https://github.com/apache/tajo/pull/600#issuecomment-114068664 Hi @jihoonson Thanks for your review. I've just updated the patch using your comments.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jihoonson commented on the pull request:

          https://github.com/apache/tajo/pull/600#issuecomment-112603544

          @blrunner thanks for your patch.
          I left one comment.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on the pull request: https://github.com/apache/tajo/pull/600#issuecomment-112603544 @blrunner thanks for your patch. I left one comment.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jihoonson commented on a diff in the pull request:

          https://github.com/apache/tajo/pull/600#discussion_r32583451

          — Diff: tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/XMLCatalogSchemaManager.java —
          @@ -344,6 +345,16 @@ public void upgradeBaseSchema(Connection conn, int currentVersion)

          { CatalogUtil.closeQuietly(stmt); }

          + public boolean catalogAlreadyExists(Connection conn) throws CatalogException {
          + boolean result = false;
          + try {
          + result = checkExistence(conn, DatabaseObjectType.TABLE, CatalogConstants.TB_META);
          — End diff –

          I think that every database object should be checked.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on a diff in the pull request: https://github.com/apache/tajo/pull/600#discussion_r32583451 — Diff: tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/XMLCatalogSchemaManager.java — @@ -344,6 +345,16 @@ public void upgradeBaseSchema(Connection conn, int currentVersion) { CatalogUtil.closeQuietly(stmt); } + public boolean catalogAlreadyExists(Connection conn) throws CatalogException { + boolean result = false; + try { + result = checkExistence(conn, DatabaseObjectType.TABLE, CatalogConstants.TB_META); — End diff – I think that every database object should be checked.
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user blrunner opened a pull request:

          https://github.com/apache/tajo/pull/600

          TAJO-1642: CatalogServer need to check meta table first.

          I tested this patch on my laptop. When I tried to start up tajo-0.11.0-SNAPSHOT with the catalog-site.xml file for tajo-0.10.1-SNAPSHOT, TajoMaster printed following messages.

          ```
          15/06/09 11:38:11 INFO store.MySQLStore: The meta table of CatalogServer already is created.
          15/06/09 11:38:11 ERROR store.MySQLStore: Catalog version (2) and current driver version (4) are mismatch to each other
          15/06/09 11:38:11 ERROR store.MySQLStore: =========================================================================
          15/06/09 11:38:11 ERROR store.MySQLStore: | Catalog Store Migration Is Needed |
          15/06/09 11:38:11 ERROR store.MySQLStore: =========================================================================
          15/06/09 11:38:11 ERROR store.MySQLStore: | You might downgrade or upgrade Apache Tajo. Downgrading or upgrading |
          15/06/09 11:38:11 ERROR store.MySQLStore: | Tajo without migration process is only available in some versions. |
          15/06/09 11:38:11 ERROR store.MySQLStore: | In order to learn how to migration Apache Tajo instance, |
          15/06/09 11:38:11 ERROR store.MySQLStore: | please refer http://s.apache.org/0_8_migration. |
          15/06/09 11:38:11 ERROR store.MySQLStore: =========================================================================
          ```

          And I found that existing column informations exists normally. For the reference, I succeed to test with only tajo-0.11.0-SNAPSHOT.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/blrunner/tajo TAJO-1642

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/tajo/pull/600.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #600


          commit 97fb598fdd7826a5c4da4019bb2ecdc48e31d8cd
          Author: JaeHwa Jung <blrunner@apache.org>
          Date: 2015-06-09T02:39:00Z

          TAJO-1642: CatalogServer need to check meta table first.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user blrunner opened a pull request: https://github.com/apache/tajo/pull/600 TAJO-1642 : CatalogServer need to check meta table first. I tested this patch on my laptop. When I tried to start up tajo-0.11.0-SNAPSHOT with the catalog-site.xml file for tajo-0.10.1-SNAPSHOT, TajoMaster printed following messages. ``` 15/06/09 11:38:11 INFO store.MySQLStore: The meta table of CatalogServer already is created. 15/06/09 11:38:11 ERROR store.MySQLStore: Catalog version (2) and current driver version (4) are mismatch to each other 15/06/09 11:38:11 ERROR store.MySQLStore: ========================================================================= 15/06/09 11:38:11 ERROR store.MySQLStore: | Catalog Store Migration Is Needed | 15/06/09 11:38:11 ERROR store.MySQLStore: ========================================================================= 15/06/09 11:38:11 ERROR store.MySQLStore: | You might downgrade or upgrade Apache Tajo. Downgrading or upgrading | 15/06/09 11:38:11 ERROR store.MySQLStore: | Tajo without migration process is only available in some versions. | 15/06/09 11:38:11 ERROR store.MySQLStore: | In order to learn how to migration Apache Tajo instance, | 15/06/09 11:38:11 ERROR store.MySQLStore: | please refer http://s.apache.org/0_8_migration . | 15/06/09 11:38:11 ERROR store.MySQLStore: ========================================================================= ``` And I found that existing column informations exists normally. For the reference, I succeed to test with only tajo-0.11.0-SNAPSHOT. You can merge this pull request into a Git repository by running: $ git pull https://github.com/blrunner/tajo TAJO-1642 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tajo/pull/600.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #600 commit 97fb598fdd7826a5c4da4019bb2ecdc48e31d8cd Author: JaeHwa Jung <blrunner@apache.org> Date: 2015-06-09T02:39:00Z TAJO-1642 : CatalogServer need to check meta table first.

            People

            • Assignee:
              blrunner Jaehwa Jung
              Reporter:
              blrunner Jaehwa Jung
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development