Class DenormalisedContentPermissionsUpdater


  • @Internal
    public class DenormalisedContentPermissionsUpdater
    extends Object
    Updates denormalised content view permissions in accordance with real permissions.
    Since:
    7.11.0
    • Field Detail

      • DEFAULT_INITIAL_CONTENT_PROCESSING_LIMIT

        public static final int DEFAULT_INITIAL_CONTENT_PROCESSING_LIMIT
        See Also:
        Constant Field Values
      • PAGE_PROCESSING_BATCH_SIZE

        public static final int PAGE_PROCESSING_BATCH_SIZE
        The size of the page batch for updating permissions in one transaction. 1000 is used because any database support IN clause with 1000 elements.
    • Method Detail

      • setInitialContentProcessingBatchSize

        public static void setInitialContentProcessingBatchSize​(int limit)
      • updateAllContentPermissions

        public int updateAllContentPermissions​(AtomicBoolean schedulingEnabled,
                                               Supplier<DenormalisedPermissionServiceState> contentServiceStateSupplier)
                                        throws ExecutionException,
                                               InterruptedException
        Updates all content permissions. Content permissions are updated in batches, each batch is processed in its own separate transaction. First of all, we retrieve all real pages in batches of 10,000 pages. Then each batch is splitted into batches of 1000 elements. Then denormalised permissions are updated for each batch in its own transaction. If a server is restarted, we will need to repeat processing of the last 1000 pages. Denormalised permissions for all previously processed pages will not be lost.
        Parameters:
        schedulingEnabled - Reference to DenormalisedChangeLogListenerBase#schedulingEnabled Scheduled task (cron) can be disabled mid-processing, so it's necessary to keep a reference and check this value periodically. For example, it would happen when Confluence is shutting down.
        Throws:
        ExecutionException
        InterruptedException
      • updateContentViewPermissions

        public Set<Long> updateContentViewPermissions​(Set<Long> pageIds,
                                                      long deadline)
        Updates denormalised content permissions for the set of page ids.
        Parameters:
        pageIds - set of page ids to process
        deadline - deadline. Should stop stop processing records after the deadline
        Returns:
        processed page ids