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

Deleted ocfl IDs are not removed from the database

    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:

      Description

      When a tombstone is deleted from OCFL it's mapping should be removed from the database, it is not and so re-adding that ID causes a stack trace.

      #########

      > curl -ufedoraAdmin:fedoraAdmin -XPUT -i "http://localhost:8080/rest/something"
      HTTP/1.1 201 Created
      Date: Mon, 22 Jun 2020 21:21:41 GMT
      Set-Cookie: JSESSIONID=node0tt6wrq9hkvva1qavfj0gwl2ov3011.node0; Path=/
      Expires: Thu, 01 Jan 1970 00:00:00 GMT
      Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 21-Jun-2020 21:21:41 GMT
      ETag: W/"D6FA4F59033650886B53E3B71715716D"
      X-State-Token: D6FA4F59033650886B53E3B71715716D
      Last-Modified: Mon, 22 Jun 2020 21:21:41 GMT
      Link: <http://localhost:8080/rest/something>; rel="timegate"
      Link: <http://localhost:8080/rest/something>; rel="original"
      Link: <http://localhost:8080/rest/something/fcr:versions>; rel="timemap"
      Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel="type"
      Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
      Link: <http://mementoweb.org/ns#OriginalResource>; rel="type"
      Link: <http://mementoweb.org/ns#TimeGate>; rel="type"
      Link: <http://www.w3.org/ns/ldp#RDFSource>; rel="type"
      Link: <http://www.w3.org/ns/ldp#Container>; rel="type"
      Link: <http://fedora.info/definitions/v4/repository#Container>; rel="type"
      Link: <http://fedora.info/definitions/v4/repository#Resource>; rel="type"
      Link: <http://localhost:8080/rest/something/fcr:acl>; rel="acl"
      Location: http://localhost:8080/rest/something
      Content-Type: text/plain
      Content-Length: 36
      Server: Jetty(9.4.24.v20191120)

      http://localhost:8080/rest/something%

      > curl -ufedoraAdmin:fedoraAdmin -XDELETE -i "http://localhost:8080/rest/something"
      HTTP/1.1 204 No Content
      Date: Mon, 22 Jun 2020 21:21:52 GMT
      Set-Cookie: JSESSIONID=node0vxgp35q6h2ksa5xmkq092trc3012.node0; Path=/
      Expires: Thu, 01 Jan 1970 00:00:00 GMT
      Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 21-Jun-2020 21:21:52 GMT
      Server: Jetty(9.4.24.v20191120)

      > curl -ufedoraAdmin:fedoraAdmin -XDELETE -i "http://localhost:8080/rest/something/fcr:tombstone"
      HTTP/1.1 204 No Content
      Date: Mon, 22 Jun 2020 21:22:00 GMT
      Set-Cookie: JSESSIONID=node0osxp9w0cyf1g1afuer0232th23013.node0; Path=/
      Expires: Thu, 01 Jan 1970 00:00:00 GMT
      Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 21-Jun-2020 21:22:00 GMT
      Server: Jetty(9.4.24.v20191120)

      > curl -ufedoraAdmin:fedoraAdmin -XGET -i "http://localhost:8080/rest/something"
      HTTP/1.1 404 Not Found
      Date: Mon, 22 Jun 2020 21:22:13 GMT
      Set-Cookie: JSESSIONID=node011h0aljg6a0hgkmxzl0es2dc13014.node0; Path=/
      Expires: Thu, 01 Jan 1970 00:00:00 GMT
      Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 21-Jun-2020 21:22:13 GMT
      Content-Type: text/turtle;charset=utf-8
      Content-Length: 173
      Server: Jetty(9.4.24.v20191120)

      Error: org.fcrepo.persistence.api.exceptions.PersistentItemNotFoundException: Unable to read .fcrepo/something.json from object something version null, object was not found.%

      > curl -ufedoraAdmin:fedoraAdmin -XPUT -i "http://localhost:8080/rest/something"
      HTTP/1.1 500 Internal Server Error
      Date: Mon, 22 Jun 2020 21:22:19 GMT
      Set-Cookie: JSESSIONID=node01rgfmcxqh43zx1mz8rk3shcql03015.node0; Path=/
      Expires: Thu, 01 Jan 1970 00:00:00 GMT
      Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 21-Jun-2020 21:22:19 GMT
      Content-Type: text/plain;charset=utf-8
      Transfer-Encoding: chunked
      Server: Jetty(9.4.24.v20191120)

      org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO ocfl_id_map (fedora_id, fedora_root_id, ocfl_id) VALUES (?, ?, ?)]; Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_6 ON PUBLIC.OCFL_ID_MAP(FEDORA_ID) VALUES 909"; SQL statement:
      INSERT INTO ocfl_id_map (fedora_id, fedora_root_id, ocfl_id) VALUES (?, ?, ?) [23505-200]; nested exception is org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_6 ON PUBLIC.OCFL_ID_MAP(FEDORA_ID) VALUES 909"; SQL statement:
      INSERT INTO ocfl_id_map (fedora_id, fedora_root_id, ocfl_id) VALUES (?, ?, ?) [23505-200]
      at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:243)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
      at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1443)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:862)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:883)
      at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update(NamedParameterJdbcTemplate.java:321)
      at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update(NamedParameterJdbcTemplate.java:326)
      at org.fcrepo.persistence.ocfl.impl.DbFedoraToOcflObjectIndex.addMapping(DbFedoraToOcflObjectIndex.java:103)
      at org.fcrepo.persistence.ocfl.impl.CreateRDFSourcePersister.persist(CreateRDFSourcePersister.java:76)
      at org.fcrepo.persistence.ocfl.impl.OCFLPersistentStorageSession.persist(OCFLPersistentStorageSession.java:164)
      at org.fcrepo.kernel.impl.services.CreateResourceServiceImpl.perform(CreateResourceServiceImpl.java:160)
      at org.fcrepo.http.api.FedoraLdp.createOrReplaceObjectRdf(FedoraLdp.java:467)
      at jdk.internal.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)
      at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:469)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:391)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:80)
      at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:253)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
      at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:232)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680)
      at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:392)
      at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:365)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:318)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
      at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1400)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:760)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617)
      at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
      at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
      at org.fcrepo.auth.webac.WebACFilter.doFilterInternal(WebACFilter.java:231)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
      at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
      at org.fcrepo.auth.common.AbstractPrincipalProvider.doFilter(AbstractPrincipalProvider.java:86)
      at org.fcrepo.auth.common.HttpHeaderPrincipalProvider.doFilter(HttpHeaderPrincipalProvider.java:38)
      at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
      at org.fcrepo.auth.common.ServletContainerAuthFilter.doFilter(ServletContainerAuthFilter.java:89)
      at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
      at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
      at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
      at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
      at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
      at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
      at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
      at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1596)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:555)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1607)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1577)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221)
      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
      at org.eclipse.jetty.server.Server.handle(Server.java:500)
      at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
      at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270)
      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
      at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
      at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
      at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
      at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_6 ON PUBLIC.OCFL_ID_MAP(FEDORA_ID) VALUES 909"; SQL statement:
      INSERT INTO ocfl_id_map (fedora_id, fedora_root_id, ocfl_id) VALUES (?, ?, ?) [23505-200]
      at org.h2.message.DbException.getJdbcSQLException(DbException.java:459)
      at org.h2.message.DbException.getJdbcSQLException(DbException.java:429)
      at org.h2.message.DbException.get(DbException.java:205)
      at org.h2.message.DbException.get(DbException.java:181)
      at org.h2.index.BaseIndex.getDuplicateKeyException(BaseIndex.java:103)
      at org.h2.mvstore.db.MVSecondaryIndex.checkUnique(MVSecondaryIndex.java:221)
      at org.h2.mvstore.db.MVSecondaryIndex.add(MVSecondaryIndex.java:196)
      at org.h2.mvstore.db.MVTable.addRow(MVTable.java:531)
      at org.h2.command.dml.Insert.insertRows(Insert.java:195)
      at org.h2.command.dml.Insert.update(Insert.java:151)
      at org.h2.command.CommandContainer.update(CommandContainer.java:198)
      at org.h2.command.Command.executeUpdate(Command.java:251)
      at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:191)
      at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:152)
      at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:1502)
      at org.springframework.jdbc.core.JdbcTemplate.lambda$update$0(JdbcTemplate.java:867)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)
      ... 91 more

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              whikloj Jared Whiklo
              Reporter:
              whikloj Jared Whiklo
              Reviewer:
              Andrew Woods
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: