Bulk Processing
Load and authorize groups of records, keep writes consistent, and bound background processing.
Bound mutation inputs
Content bulk mutations use MAX_BULK_OPERATION_SIZE, currently 500. Import it from bosca.content.configuration and reject oversized inputs before processing them:
Load and authorize in batches
This is the collection controller's deleteAll implementation. It loads records and evaluates permissions in batches, then calls the service for each allowed record inside one transaction. Missing or inaccessible records do not contribute to the returned count.
Batch loading does not mean the whole mutation issues one SQL statement. Service calls can perform additional writes, history updates, cache invalidation, and event dispatch. When adding a bulk service operation, preserve those effects.
Choose the failure behavior
Collection deleteAll and setReadyAll wrap allowed records in a transaction. A failure during that work rolls back the database writes. Other operations, such as metadata media processing, handle failures per item and return a success count.
For a new best-effort loop, propagate cancellation before catching ordinary failures. This illustrative excerpt assumes items and processItem are supplied by the caller:
Respect locked records
Collection bulk edits filter locked records before evaluating edit permissions, unless GroupEvaluator.hasSaGroup() grants the elevated path:
Process long-running work in chunks
Background indexing jobs page through records with an offset and limit. Advance the offset by the page size and stop when no records remain. Use the job's established distributed-lock pattern to avoid overlapping work.
Clear local request-cache data between completed pages when needed to bound memory. requestCache().clearLocal() also discards pending puts and removes, so use it after the page's database and cache work has finished. Follow the owning service's side-effect and transaction conventions rather than replacing it with direct SQL.