Retention rule fast trash removal throw error when trash has no space key

XMLWordPrintable

    • 2
    • Severity 3 - Minor
    • 7

      Issue Summary

       

      Retention rule fast trash removal throw error when trash has no space key. Investigation shows that this seems to be some dirty data issue from previous confluence or interrupted migration. e.g. inline-serialized-highlights  for the inline comment  in new confluence, when it is deleted from the UI, it is directly removed from db, it will not be marked as deleted.

      Steps to Reproduce

      1. Set spaceId as null for some deleted content records
      2. Run Trash Removal (Soft) or Trash Removal (Hard)

      Expected Results

      Records are correctly removed

      Actual Results

      The below exception is thrown in the xxxxxxx.log file:

      2024-12-11 15:09:25,554 ERROR [Caesium-1-4] [impl.retention.fast.FastTrashRemovalManager] lambda$removeTrashContents$5 error fast trash removal
      java.lang.NullPointerException: Cannot invoke "com.atlassian.confluence.spaces.Space.getKey()" because the return value of "com.atlassian.confluence.core.SpaceContentEntityObject.getSpace()" is null
      at com.atlassian.confluence.impl.retention.rules.DefaultTrashRuleEvaluator.findSpaceRetentionRuleForTrash(DefaultTrashRuleEvaluator.java:68)
      at com.atlassian.confluence.impl.retention.rules.DefaultTrashRuleEvaluator.lambda$evaluate$0(DefaultTrashRuleEvaluator.java:39)
      at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
      at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
      at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
      at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
      at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
      at com.atlassian.confluence.impl.retention.rules.DefaultTrashRuleEvaluator.evaluate(DefaultTrashRuleEvaluator.java:44)
      at com.atlassian.confluence.impl.retention.fast.FastTrashRemovalManager.lambda$removeTrashContents$5(FastTrashRemovalManager.java:202)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
      at com.atlassian.confluence.impl.retention.fast.FastTrashRemovalManager.removeTrashContents(FastTrashRemovalManager.java:196)
      at com.atlassian.confluence.impl.retention.fast.FastTrashRemovalManager.removeTrashContentsWithRetry(FastTrashRemovalManager.java:168)
      at com.atlassian.confluence.impl.retention.fast.FastTrashRemovalManager.removeTrashesOfOnePolicy(FastTrashRemovalManager.java:143)
      at com.atlassian.confluence.impl.retention.fast.FastTrashRemovalManager.removeTrashesOfOneSpace(FastTrashRemovalManager.java:130)
      at com.atlassian.confluence.impl.retention.fast.FastTrashRemovalManager.lambda$internalSoftRemove$1(FastTrashRemovalManager.java:116)
      at java.base/java.util.ArrayList.forEach(Unknown Source)
      at com.atlassian.confluence.impl.retention.fast.FastTrashRemovalManager.internalSoftRemove(FastTrashRemovalManager.java:116)
      at com.atlassian.confluence.impl.retention.fast.FastTrashRemovalManager.lambda$softRemove$0(FastTrashRemovalManager.java:90)
      at com.atlassian.confluence.impl.cluster.lock.ClusterLockExecutionService.doWithLock(ClusterLockExecutionService.java:29)
      at com.atlassian.confluence.impl.retention.fast.FastTrashRemovalManager.softRemove(FastTrashRemovalManager.java:89)
      at com.atlassian.confluence.impl.retention.schedule.TrashSoftRemovalScheduledJob.runJob(TrashSoftRemovalScheduledJob.java:49)
      at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.doRunJob(JobRunnerWrapper.java:121)
      at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.runJob(JobRunnerWrapper.java:83)
      at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$JobRunnerWithStats.runJob(CaesiumSchedulerService.java:743)
      at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134)
      at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106)
      at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90)
      at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:545)
      at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJobWithRetryOnFailure(CaesiumSchedulerService.java:500)
      at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:440)
      at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66)
      at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60)
      at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35)
      at java.base/java.lang.Thread.run(Unknown Source) 

      Workaround

      Option 1: You can simply ignore this issue as the fast trash removal will auto skip these records and move to next batch of trash to remove.

      Option 2: You can query these deleted contents that has empty spaceId and manually delete them (notice: you may also need to remove the associated records in other tables)

      SELECT *
      FROM CONTENT content
      WHERE content.CONTENTTYPE IN ('PAGE', 'BLOGPOST', 'SPACEDESCRIPTION''ATTACHMENT', 'CUSTOM')
        AND content.CONTENT_STATUS = 'deleted'
        AND content.SPACEID IS NULL
        AND (content.PREVVER IS NULL) 

            Assignee:
            Jeffery Xie
            Reporter:
            Jeffery Xie
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: