Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-4549

backup with RepositoryCopier.copy() fails on second method call

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      I am trying to backup a jackrabbit repository with a quartz cron scheduler. The target repository is then zipped, and deleted.

      The first time it works fine, but all subsequent backups fail with:

      javax.jcr.RepositoryException: Failed to copy content
      
      	at org.apache.jackrabbit.core.RepositoryCopier.copy(RepositoryCopier.java:210)
      	at org.apache.jackrabbit.core.RepositoryCopier.copy(RepositoryCopier.java:150)
      	at org.apache.jackrabbit.core.RepositoryCopier.copy(RepositoryCopier.java:132)
      	at org.apache.jackrabbit.core.RepositoryCopierTest.testRepositoryCopyWithDeleteTarget(RepositoryCopierTest.java:92)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at junit.framework.TestCase.runTest(TestCase.java:176)
      	at junit.framework.TestCase.runBare(TestCase.java:141)
      	at junit.framework.TestResult$1.protect(TestResult.java:122)
      	at junit.framework.TestResult.runProtected(TestResult.java:142)
      	at junit.framework.TestResult.run(TestResult.java:125)
      	at junit.framework.TestCase.run(TestCase.java:129)
      	at junit.framework.TestSuite.runTest(TestSuite.java:252)
      	at junit.framework.TestSuite.run(TestSuite.java:247)
      	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
      	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
      	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
      Caused by: org.apache.jackrabbit.core.data.DataStoreException: Record 6a68c154fa43477a0d7386e8ba0e9c33a2e7b2060cf43188a16421b03dd5a839 does not exist
      	at org.apache.jackrabbit.core.data.AbstractDataStore.getRecord(AbstractDataStore.java:59)
      	at org.apache.jackrabbit.core.value.BLOBInDataStore.getDataRecord(BLOBInDataStore.java:151)
      	at org.apache.jackrabbit.core.value.BLOBInDataStore.getStream(BLOBInDataStore.java:104)
      	at org.apache.jackrabbit.core.value.InternalValue.getStream(InternalValue.java:662)
      	at org.apache.jackrabbit.core.persistence.PersistenceCopier.copy(PersistenceCopier.java:157)
      	at org.apache.jackrabbit.core.persistence.PersistenceCopier.copy(PersistenceCopier.java:114)
      	at org.apache.jackrabbit.core.persistence.PersistenceCopier.copy(PersistenceCopier.java:111)
      	at org.apache.jackrabbit.core.RepositoryCopier.copyWorkspaces(RepositoryCopier.java:276)
      	at org.apache.jackrabbit.core.RepositoryCopier.copy(RepositoryCopier.java:208)
      	... 21 more
      

      From my analysis, the copy method in PersistenceCopier is changing the source values in

      InternalValue[] values = sourceState.getValues();
      if (sourceState.getType() == PropertyType.BINARY) {
          for (int i = 0; i < values.length; i++) {
              InputStream stream = values[i].getStream();
              try {
                  values[i] = InternalValue.create(stream, store);
              } finally {
                  stream.close();
              }
          }
      }
      targetState.setValues(values);
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            reschke Julian Reschke
            froque Filipe Roque
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment