ATLAS-5317: Resilient bulk purge with pre-validation, enriched respon…#702
Closed
sheetalshah1007 wants to merge 1 commit into
Closed
ATLAS-5317: Resilient bulk purge with pre-validation, enriched respon…#702sheetalshah1007 wants to merge 1 commit into
sheetalshah1007 wants to merge 1 commit into
Conversation
…ses, worker batches, and audit APIs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ses, worker batches, and audit APIs
Attachments
Summary
This PR implements resilient bulk purge according to the Resilient Bulk Purge in Atlas Using Transaction Batching design spec. It replaces the old, single-transaction REST bulk purge with a pre-validated, worker-batch processing model that is now shared by both REST and scheduled (cron) purges.
What changes were proposed in this pull request?
Key changes
Pre-validation before writes — REST purge GUIDs are verified (UUID format, graph existence, DELETED state, and registered type) before any mutations occur. Invalid or ineligible GUIDs are returned in
failedEntitieswith anerrorCodeanderrorMessage.Request size limit — New config
atlas.purge.api.max.request.size(default: 1000) limits GUIDs per REST purge request.Shared worker-batch path — Both REST and cron use
PurgeService.executePurgeWithWorkers→PurgeBatchOrchestrator/WorkItemManager, configured viaatlas.purge.worker.batch.size(default: 100) andatlas.purge.workers.count(default: 2).Isolated batch transactions — Each worker batch runs in its own graph transaction. Lock conflicts retry at batch level (500 ms, 1000 ms, 1500 ms; up to 3 attempts). Other batch failures roll back only that batch; processing continues.
Partial success — Earlier committed batches are preserved when a later batch fails permanently.
Enriched response —
EntityMutationResponseaddsfailedEntitiesandPurgeSummary(purgedDependenciesCount,failedDependenciesCount,executionFailed,runId).Two-tier purge audit with runId correlation — Each purge run (REST or cron) writes:
__AtlasAuditEntry(requested GUIDs inparams,PurgeSummaryJSON inresult)runIdpurgefailure.log([PURGE_FAILURE] runId=...)Default
POST /admin/auditsfor PURGE / AUTO_PURGE returns summary rows only. ArunId eqfilter returns all rows for a run.Admin audit read APIs — New endpoints for drill-down without loading full batch payloads in the default list:
GET /admin/audit/{summaryGuid}/purgedEntities— paginated purged GUIDs for the runGET /admin/audit/{summaryGuid}/batches— batch audit entry GUIDs for the runGET /admin/audit/{batchGuid}/details— per-batch entity drill-down (unchanged)Cron alignment — Scheduled purge keeps its worker-batch model; REST is aligned to the same path with shared orchestration, enriched accounting, batch retry, and shutdown reconciliation.
AdminResourceno longer writes one monolithic AUTO_PURGE audit row per run.Parallel-batch hardening
DeleteHandlerV1tolerates vertices/edges already removed by other workers (ATLAS-4766)accumulateDeletionCandidates()returnsSet<String>(GUIDs) for worker-safe enqueueingSchema updates
AUTO_PURGEadded toatlas_operationin0010-base_model.json(fresh installs)runIdon__AtlasAuditEntry(typedef patch009-base_model_add_audit_runid.json)Compatibility and behavior notes
accumulateDeletionCandidates()now returnsSet<String>instead ofSet<AtlasVertex>. CustomAtlasEntityStoreimplementations must update the method signature (Apache Atlas ships onlyAtlasEntityStoreV2).failedEntitieson REST (no longer silently ignored).summaryandfailedEntities(design HTTP 207/400/500 for some outcomes is not used).cronPurgeOperationLock.See attached implementation notes for full flow, design deviations, configuration, and review focus areas.
How was this patch tested?
Unit and integration tests added or extended:
PurgeTest— REST/cron purge, audit write/read, REST+cron overlapPurgeBatchOrchestratorTest,PurgeBatchExecutorTest— workers, retry, reconciliation, batch auditAtlasEntityStoreV2Test— pre-validation, batch primitives, concurrencyAdminResourceTest— size/auth guards, audit list filtering,/purgedEntities,/batchesAtlasClientV2Test,DeleteHandlerV1TestReplaced
AdminPurgeTestandPurgeServiceTest. Manual QE suggested for large partial-failure runs, REST+cron overlap, and audit drill-down byrunId.Performance testing
Load: 1,000
hive_tableentities (2 columns each) — 5,000 entities total (tables + columns).workers.count=2workers.count=1Regarding
atlas.purge.workers.countDefault = 2 — Cron purge historically used 2 workers; the new design keeps that. One batch can commit while another runs — solid speed-up without overwhelming the database.
Notes:
workers.countfor your cluster.