[BatchUpdate 3/4] feat(dao): add batch orchestration pipeline for multi-aspect upsert#608
Open
[BatchUpdate 3/4] feat(dao): add batch orchestration pipeline for multi-aspect upsert#608
Conversation
…ti-aspect upsert Add addManyBatch/addManyBatchWithCallbacks to BaseLocalDAO for transactional multi-aspect upsert with MAE emission, callback execution, and retention enforcement. EbeanLocalDAO delegates batch SQL to EbeanLocalAccess.batchUpsert. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #608 +/- ##
============================================
+ Coverage 65.56% 65.79% +0.23%
- Complexity 1759 1776 +17
============================================
Files 144 144
Lines 6847 6909 +62
Branches 829 840 +11
============================================
+ Hits 4489 4546 +57
+ Misses 1996 1994 -2
- Partials 362 369 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3 tasks
chmeng0
reviewed
Apr 7, 2026
|
|
||
| // STEP 3: Execute batch SQL (1 query) - only for changed aspects | ||
| if (!contextsToWrite.isEmpty()) { | ||
| boolean isTestMode = contextsToWrite.stream() |
Contributor
There was a problem hiding this comment.
If one aspect has isTestMode=true and another has isTestMode=false, the entire batch runs in test mode
^^ I guess it makes sense. Do we flag this to caller somehow/somewhere so they're aware of this behavior, or better still never mix them in a batch?
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.
Summary
Third PR in the batch upsert series (split from #598). Adds the batch orchestration layer in
BaseLocalDAOthat coordinates multi-aspect upsert as a single transaction.What this adds:
addManyBatch(urn, aspects, auditStamp, trackingContext)— public entry point for batch upsert of raw aspectsaddManyBatchWithCallbacks(urn, lambdas, auditStamp, trackingContext)— entry point acceptingAspectUpdateLambdaobjects (supports collection aspects + IngestionParams)addManyBatchInternal()— orchestration: runsshouldUpdateAspect()filtering, delegates tobatchUpsertAspects(), emits MAEs, executes aspect callbacks, enforces retentionEbeanLocalDAO.batchUpsertAspects()— delegates toEbeanLocalAccess.batchUpsert()(from PR feat: add batch SQL layer for multi-aspect upsert and batch deletion #607)How it works:
shouldUpdateAspect()filteringbatchUpsert()call (one SQL roundtrip)Depends on:
Testing Done
BaseLocalDAOTest (unit tests, Mockito)
testAddManyBatchMAEEmissiontestAddManyBatchMAEEmissionWithEqualitySkiptestAddManyBatchPreUpdateHooktestAddManyBatchPostUpdateHooktestAddManyBatchTransactionBehaviortestAddManyBatchWithTrackingContexttestAddManyBatchRejectsDuplicateAspectstestAddManyBatchReturnsAllAspectstestAddManyBatchWithSingleAspectCallbacktestAddManyBatchWithSingleAspectCallbackSkippedtestAddManyBatchWithTwoAspectsWithCallbacksNeitherSkippedtestAddManyBatchWithTwoAspectsWithCallbacksOneSkippedtestAddManyBatchWithMixedCallbackRegistrationEbeanLocalDAOTest (integration tests, embedded MariaDB)
testAddManyBatchtestAddManyBatchUpsertBehaviortestAddManyBatchWithEqualitySkiptestAddManyBatchWithBackfillSkiptestAddManyBatchMixedEqualityChangestestAddManyBatchRelationshipsUpdateWithOldValuestestAddManyBatchAllAspectsRejectedByEqualitytestAddManyBatchRelationshipsNotWrittenWhenEqualityCheckFailstestAddManyBatchWithSingleAspectCallbackPersistedToDBtestAddManyBatchWithSingleAspectCallbackSkippedtestAddManyBatchWithTwoAspectsWithCallbacksNeitherSkippedtestAddManyBatchWithTwoAspectsWithCallbacksOneSkippedtestAddManyBatchWithMixedCallbackRegistrationtestAddManyBatchWithSingleLambdaFunctionPersistedToDBtestAddManyBatchWithTwoLambdaFunctionsNeitherSkippedtestAddManyBatchWithMixedLambdaRegistrationtestAddManyBatchWithLambdaMergingOldValuetestAddManyBatchComprehensiveWithAllCodePathsChecklist