Uploaded image for project: 'Aurora'
  1. Aurora
  2. AURORA-605

Tests fail on duplicate table in H2

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.6.0
    • None
    • None

    Description

      Here's example output from a failing test:

      java.lang.IllegalStateException: Expected the service to be RUNNING, but the service has FAILED
      	at com.google.common.util.concurrent.AbstractService.checkCurrentState(AbstractService.java:334)
      	at com.google.common.util.concurrent.AbstractService.awaitRunning(AbstractService.java:277)
      	at com.google.common.util.concurrent.AbstractIdleService.awaitRunning(AbstractIdleService.java:177)
      	at org.apache.aurora.scheduler.storage.db.DbStorage.prepare(DbStorage.java:148)
      	at org.apache.aurora.scheduler.storage.db.DbSchedulerStoreTest.setUp(DbSchedulerStoreTest.java:41)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
      	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
      	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
      	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
      	at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
      	at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
      	at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
      	at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
      	at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
      	at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
      	at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
      	at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
      	at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
      	at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:744)
      Caused by: org.apache.ibatis.exceptions.PersistenceException: 
      ### Error updating database.  Cause: org.h2.jdbc.JdbcSQLException: Table "FRAMEWORK_ID" already exists; SQL statement:
      /**
       * Licensed under the Apache License, Version 2.0 (the "License");
       * you may not use this file except in compliance with the License.
       * You may obtain a copy of the License at
       *
       *     http://www.apache.org/licenses/LICENSE-2.0
       *
       * Unless required by applicable law or agreed to in writing, software
       * distributed under the License is distributed on an "AS IS" BASIS,
       * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       * See the License for the specific language governing permissions and
       * limitations under the License.
       */
      
      -- schema for h2 engine.
      
      CREATE TABLE framework_id(
        id INT PRIMARY KEY,
        framework_id VARCHAR NOT NULL,
      
        UNIQUE(framework_id)
      );
      
      CREATE TABLE job_keys(
        id INT IDENTITY,
        role VARCHAR NOT NULL,
        environment VARCHAR NOT NULL,
        name VARCHAR NOT NULL,
      
        UNIQUE(role, environment, name)
      );
      
      CREATE TABLE locks(
        id INT IDENTITY,
        job_key_id INT NOT NULL REFERENCES job_keys(id),
        token VARCHAR NOT NULL,
        user VARCHAR NOT NULL,
        timestampMs BIGINT NOT NULL,
        message VARCHAR,
      
        UNIQUE(job_key_id)
      );
      
      CREATE TABLE quotas(
        id INT IDENTITY,
        role VARCHAR NOT NULL,
        num_cpus FLOAT NOT NULL,
        ram_mb INT NOT NULL,
        disk_mb INT NOT NULL,
      
        UNIQUE(role)
      );
      
      CREATE TABLE maintenance_modes(
        id INT PRIMARY KEY,
        name VARCHAR NOT NULL,
      
        UNIQUE(name)
      );
      
      CREATE TABLE host_attributes(
        id INT IDENTITY,
        host VARCHAR NOT NULL,
        mode TINYINT NOT NULL REFERENCES maintenance_modes(id),
        slave_id VARCHAR NOT NULL,
      
        UNIQUE(host),
        UNIQUE(slave_id),
      );
      
      CREATE TABLE host_attribute_values(
        id INT IDENTITY,
        host_attribute_id INT NOT NULL REFERENCES host_attributes(id)
        ON DELETE CASCADE,
        name VARCHAR NOT NULL,
        value VARCHAR NOT NULL,
      
        UNIQUE(host_attribute_id, name, value)
      );
       [42101-177]
      ### The error may involve defaultParameterMap
      ### The error occurred while setting parameters
      ### SQL: /**  * Licensed under the Apache License, Version 2.0 (the "License");  * you may not use this file except in compliance with the License.  * You may obtain a copy of the License at  *  *     http://www.apache.org/licenses/LICENSE-2.0  *  * Unless required by applicable law or agreed to in writing, software  * distributed under the License is distributed on an "AS IS" BASIS,  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  * See the License for the specific language governing permissions and  * limitations under the License.  */  -- schema for h2 engine.  CREATE TABLE framework_id(   id INT PRIMARY KEY,   framework_id VARCHAR NOT NULL,    UNIQUE(framework_id) );  CREATE TABLE job_keys(   id INT IDENTITY,   role VARCHAR NOT NULL,   environment VARCHAR NOT NULL,   name VARCHAR NOT NULL,    UNIQUE(role, environment, name) );  CREATE TABLE locks(   id INT IDENTITY,   job_key_id INT NOT NULL REFERENCES job_keys(id),   token VARCHAR NOT NULL,   user VARCHAR NOT NULL,   timestampMs BIGINT NOT NULL,   message VARCHAR,    UNIQUE(job_key_id) );  CREATE TABLE quotas(   id INT IDENTITY,   role VARCHAR NOT NULL,   num_cpus FLOAT NOT NULL,   ram_mb INT NOT NULL,   disk_mb INT NOT NULL,    UNIQUE(role) );  CREATE TABLE maintenance_modes(   id INT PRIMARY KEY,   name VARCHAR NOT NULL,    UNIQUE(name) );  CREATE TABLE host_attributes(   id INT IDENTITY,   host VARCHAR NOT NULL,   mode TINYINT NOT NULL REFERENCES maintenance_modes(id),   slave_id VARCHAR NOT NULL,    UNIQUE(host),   UNIQUE(slave_id), );  CREATE TABLE host_attribute_values(   id INT IDENTITY,   host_attribute_id INT NOT NULL REFERENCES host_attributes(id)   ON DELETE CASCADE,   name VARCHAR NOT NULL,   value VARCHAR NOT NULL,    UNIQUE(host_attribute_id, name, value) );
      ### Cause: org.h2.jdbc.JdbcSQLException: Table "FRAMEWORK_ID" already exists; SQL statement:
      /**
       * Licensed under the Apache License, Version 2.0 (the "License");
       * you may not use this file except in compliance with the License.
       * You may obtain a copy of the License at
       *
       *     http://www.apache.org/licenses/LICENSE-2.0
       *
       * Unless required by applicable law or agreed to in writing, software
       * distributed under the License is distributed on an "AS IS" BASIS,
       * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       * See the License for the specific language governing permissions and
       * limitations under the License.
       */
      
      -- schema for h2 engine.
      
      CREATE TABLE framework_id(
        id INT PRIMARY KEY,
        framework_id VARCHAR NOT NULL,
      
        UNIQUE(framework_id)
      );
      
      CREATE TABLE job_keys(
        id INT IDENTITY,
        role VARCHAR NOT NULL,
        environment VARCHAR NOT NULL,
        name VARCHAR NOT NULL,
      
        UNIQUE(role, environment, name)
      );
      
      CREATE TABLE locks(
        id INT IDENTITY,
        job_key_id INT NOT NULL REFERENCES job_keys(id),
        token VARCHAR NOT NULL,
        user VARCHAR NOT NULL,
        timestampMs BIGINT NOT NULL,
        message VARCHAR,
      
        UNIQUE(job_key_id)
      );
      
      CREATE TABLE quotas(
        id INT IDENTITY,
        role VARCHAR NOT NULL,
        num_cpus FLOAT NOT NULL,
        ram_mb INT NOT NULL,
        disk_mb INT NOT NULL,
      
        UNIQUE(role)
      );
      
      CREATE TABLE maintenance_modes(
        id INT PRIMARY KEY,
        name VARCHAR NOT NULL,
      
        UNIQUE(name)
      );
      
      CREATE TABLE host_attributes(
        id INT IDENTITY,
        host VARCHAR NOT NULL,
        mode TINYINT NOT NULL REFERENCES maintenance_modes(id),
        slave_id VARCHAR NOT NULL,
      
        UNIQUE(host),
        UNIQUE(slave_id),
      );
      
      CREATE TABLE host_attribute_values(
        id INT IDENTITY,
        host_attribute_id INT NOT NULL REFERENCES host_attributes(id)
        ON DELETE CASCADE,
        name VARCHAR NOT NULL,
        value VARCHAR NOT NULL,
      
        UNIQUE(host_attribute_id, name, value)
      );
       [42101-177]
      	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:154)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:145)
      	at org.apache.aurora.scheduler.storage.db.DbStorage.startUp(DbStorage.java:176)
      	at org.mybatis.guice.transactional.TransactionalMethodInterceptor.invoke(TransactionalMethodInterceptor.java:101)
      	at com.google.common.util.concurrent.AbstractIdleService$2$1.run(AbstractIdleService.java:54)
      	at com.google.common.util.concurrent.Callables$3.run(Callables.java:93)
      	... 1 more
      Caused by: org.h2.jdbc.JdbcSQLException: Table "FRAMEWORK_ID" already exists; SQL statement:
      /**
       * Licensed under the Apache License, Version 2.0 (the "License");
       * you may not use this file except in compliance with the License.
       * You may obtain a copy of the License at
       *
       *     http://www.apache.org/licenses/LICENSE-2.0
       *
       * Unless required by applicable law or agreed to in writing, software
       * distributed under the License is distributed on an "AS IS" BASIS,
       * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       * See the License for the specific language governing permissions and
       * limitations under the License.
       */
      
      -- schema for h2 engine.
      
      CREATE TABLE framework_id(
        id INT PRIMARY KEY,
        framework_id VARCHAR NOT NULL,
      
        UNIQUE(framework_id)
      );
      
      CREATE TABLE job_keys(
        id INT IDENTITY,
        role VARCHAR NOT NULL,
        environment VARCHAR NOT NULL,
        name VARCHAR NOT NULL,
      
        UNIQUE(role, environment, name)
      );
      
      CREATE TABLE locks(
        id INT IDENTITY,
        job_key_id INT NOT NULL REFERENCES job_keys(id),
        token VARCHAR NOT NULL,
        user VARCHAR NOT NULL,
        timestampMs BIGINT NOT NULL,
        message VARCHAR,
      
        UNIQUE(job_key_id)
      );
      
      CREATE TABLE quotas(
        id INT IDENTITY,
        role VARCHAR NOT NULL,
        num_cpus FLOAT NOT NULL,
        ram_mb INT NOT NULL,
        disk_mb INT NOT NULL,
      
        UNIQUE(role)
      );
      
      CREATE TABLE maintenance_modes(
        id INT PRIMARY KEY,
        name VARCHAR NOT NULL,
      
        UNIQUE(name)
      );
      
      CREATE TABLE host_attributes(
        id INT IDENTITY,
        host VARCHAR NOT NULL,
        mode TINYINT NOT NULL REFERENCES maintenance_modes(id),
        slave_id VARCHAR NOT NULL,
      
        UNIQUE(host),
        UNIQUE(slave_id),
      );
      
      CREATE TABLE host_attribute_values(
        id INT IDENTITY,
        host_attribute_id INT NOT NULL REFERENCES host_attributes(id)
        ON DELETE CASCADE,
        name VARCHAR NOT NULL,
        value VARCHAR NOT NULL,
      
        UNIQUE(host_attribute_id, name, value)
      );
       [42101-177]
      	at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
      	at org.h2.message.DbException.get(DbException.java:178)
      	at org.h2.message.DbException.get(DbException.java:154)
      	at org.h2.command.ddl.CreateTable.update(CreateTable.java:110)
      	at org.h2.command.CommandContainer.update(CommandContainer.java:79)
      	at org.h2.command.Command.executeUpdate(Command.java:254)
      	at org.h2.command.CommandList.update(CommandList.java:43)
      	at org.h2.command.Command.executeUpdate(Command.java:254)
      	at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:199)
      	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:44)
      	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:69)
      	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:48)
      	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:105)
      	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:71)
      	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:152)
      	... 6 more
      

      Attachments

        Activity

          People

            wfarner Bill Farner
            wfarner Bill Farner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: