Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-12957

Fix recursive removal under MySQL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.8-SNAPSHOT
    • Fix Version/s: 5.8
    • Component/s: Core

      Description

      The following tests seem to show that recursive removal is not handled correctly when using mysql:
      https://qa.nuxeo.org/jenkins/view/Critical/job/nuxeo-master-fullbuild-part1-multidb-linux/727/Slave=MULTIDB_LINUX,dbprofile=mssql,jdk=openjdk-7-jdk/testReport/junit/org.nuxeo.ecm.core.storage.sql/TestSQLRepositoryAPI/testFulltextReindexOnCreateDelete/
      org.nuxeo.ecm.core.storage.sql.TestSQLBackendNoProxies.testRecursiveRemoval

      org.nuxeo.ecm.core.storage.StorageException: Could not delete: hierarchy
      	at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.deleteRowsDirect(JDBCRowMapper.java:909)
      	at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.remove(JDBCRowMapper.java:1326)
      	at org.nuxeo.ecm.core.storage.sql.SoftRefCachingRowMapper.remove(SoftRefCachingRowMapper.java:504)
      	at org.nuxeo.ecm.core.storage.sql.PersistenceContext.removeNode(PersistenceContext.java:916)
      	at org.nuxeo.ecm.core.storage.sql.SessionImpl.removeNode(SessionImpl.java:1089)
      	at org.nuxeo.ecm.core.storage.sql.TestSQLBackend.testRecursiveRemoval(TestSQLBackend.java:278)
      	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.internal.runners.TestMethod.invoke(TestMethod.java:66)
      	at org.jmock.integration.junit4.JMock$1.invoke(JMock.java:37)
      	at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:105)
      	at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
      	at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:94)
      	at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
      	at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
      	at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:98)
      	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
      	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54)
      	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
      	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
      	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52)
      	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
      	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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
      	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
      	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
      	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`bandersnatch`.`hierarchy`, CONSTRAINT `hierarchy_parentid_hierarchy_fk` FOREIGN KEY (`parentid`) REFERENCES `hierarchy` (`id`) ON DELETE CASCADE)
      	at sun.reflect.GeneratedConstructorAccessor100.newInstance(Unknown Source)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
      	at com.mysql.jdbc.Util.getInstance(Util.java:386)
      	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
      	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
      	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
      	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
      	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330)
      	at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:875)
      	at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.deleteRowsDirect(JDBCRowMapper.java:901)
      	... 34 more
      

      https://qa.nuxeo.org/jenkins/view/Critical/job/nuxeo-master-fullbuild-part1-multidb-linux/727/Slave=MULTIDB_LINUX,dbprofile=mysql,jdk=openjdk-7-jdk/testReport/junit/org.nuxeo.ecm.core.storage.sql/TestSQLBackend/testRecursiveRemoval/
      org.nuxeo.ecm.core.storage.sql.TestSQLBackend.testRecursiveRemoval

      org.nuxeo.ecm.core.storage.StorageException: Could not delete: hierarchy
      	at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.deleteRowsDirect(JDBCRowMapper.java:909)
      	at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.remove(JDBCRowMapper.java:1326)
      	at org.nuxeo.ecm.core.storage.sql.SoftRefCachingRowMapper.remove(SoftRefCachingRowMapper.java:504)
      	at org.nuxeo.ecm.core.storage.sql.PersistenceContext.removeNode(PersistenceContext.java:916)
      	at org.nuxeo.ecm.core.storage.sql.SessionImpl.removeNode(SessionImpl.java:1089)
      	at org.nuxeo.ecm.core.storage.sql.TestSQLBackend.testRecursiveRemoval(TestSQLBackend.java:278)
      	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.internal.runners.TestMethod.invoke(TestMethod.java:66)
      	at org.jmock.integration.junit4.JMock$1.invoke(JMock.java:37)
      	at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:105)
      	at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
      	at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:94)
      	at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
      	at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
      	at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:98)
      	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
      	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54)
      	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
      	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
      	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52)
      	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
      	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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
      	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
      	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
      	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`bandersnatch`.`hierarchy`, CONSTRAINT `hierarchy_parentid_hierarchy_fk` FOREIGN KEY (`parentid`) REFERENCES `hierarchy` (`id`) ON DELETE CASCADE)
      	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 com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
      	at com.mysql.jdbc.Util.getInstance(Util.java:386)
      	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
      	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
      	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
      	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
      	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330)
      	at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:875)
      	at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.deleteRowsDirect(JDBCRowMapper.java:901)
      	... 34 more
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: