Uploaded image for project: 'Fedora Repository Project'
  1. Fedora Repository Project
  2. FCREPO-3362

Postgresql sql grammar problem with containment index

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Fedora 6.0.0
    • Fix Version/s: Fedora 6.0.0
    • Component/s: f4-core
    • Labels:
      None

      Description

      On startup of a fresh repository using postgresql:

       

       

      org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [UPDATE resources r SET r.is_deleted = TRUE WHERE EXISTS (SELECT * from transaction_operations t WHERE r.fedora_id = t.fedora_id AND t.transaction_id = ? AND t.operation = 'delete' AND r.parent = t.parent)]; nested exception is org.postgresql.util.PSQLException: ERROR: column "r" of relation "resources" does not exist Position: 24
      

       

       

      Stacktrace:

      [WARNING] Failed startup of context o.e.j.m.p.JettyWebAppContext@28b7646{Fedora Repository,/,file:///Users/danielbernstein/code/fcrepo4/fcrepo-webapp/src/main/webapp/,UNAVAILABLE}{file:///Users/danielbernstein/code/fcrepo4/fcrepo-webapp/src/main/webapp/} org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'repositoryInitializer': Invocation of init method failed; nested exception is org.fcrepo.kernel.api.exception.RepositoryRuntimeException: Unable to commit containment index transaction at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization (InitDestroyAnnotationBeanPostProcessor.java:160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization (AbstractAutowireCapableBeanFactory.java:416) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1788) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:595) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:323) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:202) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:893) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:879) at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:551) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext (ContextLoader.java:401) at org.springframework.web.context.ContextLoader.initWebApplicationContext (ContextLoader.java:292) at org.springframework.web.context.ContextLoaderListener.contextInitialized (ContextLoaderListener.java:103) at org.fcrepo.http.commons.FedoraContextLoaderListener.contextInitialized (FedoraContextLoaderListener.java:40) at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized (ContextHandler.java:930) at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized (ServletContextHandler.java:553) at org.eclipse.jetty.server.handler.ContextHandler.startContext (ContextHandler.java:889) at org.eclipse.jetty.servlet.ServletContextHandler.startContext (ServletContextHandler.java:356) at org.eclipse.jetty.webapp.WebAppContext.startWebapp (WebAppContext.java:1445) at org.eclipse.jetty.maven.plugin.JettyWebAppContext.startWebapp (JettyWebAppContext.java:328) at org.eclipse.jetty.webapp.WebAppContext.startContext (WebAppContext.java:1409) at org.eclipse.jetty.server.handler.ContextHandler.doStart (ContextHandler.java:822) at org.eclipse.jetty.servlet.ServletContextHandler.doStart (ServletContextHandler.java:275) at org.eclipse.jetty.webapp.WebAppContext.doStart (WebAppContext.java:524) at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart (JettyWebAppContext.java:397) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:72) at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:117) at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:100) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:72) at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:117) at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:100) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:72) at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169) at org.eclipse.jetty.server.Server.start (Server.java:407) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:110) at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:100) at org.eclipse.jetty.server.Server.doStart (Server.java:371) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:72) at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty (AbstractJettyMojo.java:450) at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute (AbstractJettyMojo.java:311) at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute (JettyRunMojo.java:152) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289) at org.apache.maven.cli.MavenCli.main (MavenCli.java:193) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) Caused by: org.fcrepo.kernel.api.exception.RepositoryRuntimeException: Unable to commit containment index transaction at org.fcrepo.kernel.impl.ContainmentIndexImpl.lambda$commitTransaction$0 (ContainmentIndexImpl.java:503) at org.springframework.transaction.support.TransactionTemplate.execute (TransactionTemplate.java:140) at org.fcrepo.kernel.impl.ContainmentIndexImpl.executeInDbTransaction (ContainmentIndexImpl.java:601) at org.fcrepo.kernel.impl.ContainmentIndexImpl.commitTransaction (ContainmentIndexImpl.java:490) at org.fcrepo.persistence.ocfl.impl.IndexBuilderImpl.rebuild (IndexBuilderImpl.java:157) at org.fcrepo.persistence.ocfl.impl.IndexBuilderImpl.rebuildIfNecessary (IndexBuilderImpl.java:75) at org.fcrepo.persistence.ocfl.RepositoryInitializer.initialize (RepositoryInitializer.java:74) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke (InitDestroyAnnotationBeanPostProcessor.java:389) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods (InitDestroyAnnotationBeanPostProcessor.java:333) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization (InitDestroyAnnotationBeanPostProcessor.java:157) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization (AbstractAutowireCapableBeanFactory.java:416) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1788) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:595) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:323) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:202) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:893) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:879) at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:551) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext (ContextLoader.java:401) at org.springframework.web.context.ContextLoader.initWebApplicationContext (ContextLoader.java:292) at org.springframework.web.context.ContextLoaderListener.contextInitialized (ContextLoaderListener.java:103) at org.fcrepo.http.commons.FedoraContextLoaderListener.contextInitialized (FedoraContextLoaderListener.java:40) at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized (ContextHandler.java:930) at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized (ServletContextHandler.java:553) at org.eclipse.jetty.server.handler.ContextHandler.startContext (ContextHandler.java:889) at org.eclipse.jetty.servlet.ServletContextHandler.startContext (ServletContextHandler.java:356) at org.eclipse.jetty.webapp.WebAppContext.startWebapp (WebAppContext.java:1445) at org.eclipse.jetty.maven.plugin.JettyWebAppContext.startWebapp (JettyWebAppContext.java:328) at org.eclipse.jetty.webapp.WebAppContext.startContext (WebAppContext.java:1409) at org.eclipse.jetty.server.handler.ContextHandler.doStart (ContextHandler.java:822) at org.eclipse.jetty.servlet.ServletContextHandler.doStart (ServletContextHandler.java:275) at org.eclipse.jetty.webapp.WebAppContext.doStart (WebAppContext.java:524) at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart (JettyWebAppContext.java:397) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:72) at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:117) at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:100) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:72) at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:117) at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:100) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:72) at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169) at org.eclipse.jetty.server.Server.start (Server.java:407) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:110) at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:100) at org.eclipse.jetty.server.Server.doStart (Server.java:371) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:72) at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty (AbstractJettyMojo.java:450) at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute (AbstractJettyMojo.java:311) at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute (JettyRunMojo.java:152) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289) at org.apache.maven.cli.MavenCli.main (MavenCli.java:193) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at 
      org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) Caused by: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [UPDATE resources r SET r.is_deleted = TRUE WHERE EXISTS (SELECT * from transaction_operations t WHERE r.fedora_id = t.fedora_id AND t.transaction_id = ? AND t.operation = 'delete' AND r.parent = t.parent)]; nested exception is org.postgresql.util.PSQLException: ERROR: column "r" of relation "resources" does not exist Position: 24
      
      

      Steps to reproduce:

      1. start postgres

      docker run --name f6-postgres -e POSTGRES_USER=fcrepo-user -e POSTGRES_PASSWORD=fcrepo-pw -e POSTGRES_DB=fcrepo -p 5432:5432 -d postgres:12.3

       

      2. start fedora

      mvn -Dfcrepo.db.url=jdbc:postgresql://localhost:5432/fcrepo -Dfcrepo.db.user=fcrepo-user -Dfcrepo.db.password=fcrepo-pw -Dfcrepo.external.content.allowed=fcrepo-http-api/src/test/resources/allowed_external_paths.txt -Dfcrepo.auth.webac.userAgent.baseUri=http://example.com/ -Dfcrepo.ocfl.staging.dir=target/fcrepo-data/staging -Dfcrepo.ocfl.storage.root.dir=target/fcrepo-data/ocfl-root -Dfcrepo.ocfl.work.dir=target/fcrepo-data/work jetty:run -pl fcrepo-webapp

       

      3. see stacktrace.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pwinckles Peter Winckles
              Reporter:
              dbernstein Danny Bernstein
              Reviewer:
              Andrew Woods
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: