Repository navigation
Import export improvements - #25542
Conversation
… circular dependency, generated changeEvents (#25582) * Fix tag clearing and circular dependency detection in batch CSV imports - **Tag clearing fix**: Add deleteTagsByTarget before applying new tags in batch imports to match single entity import behavior, ensuring empty CSV fields properly clear existing tags - **Circular dependency detection fix**: Pre-track entities in dryRunCreatedEntities before parent resolution to enable proper circular reference validation during CSV team imports - Resolves test failures in TeamResourceIT.test_importCsv_circularDependency_trueRun and tag-related import issues - Maintains batch import performance while restoring pre-batch-import validation contracts * improve storeRelationshipsInternal internal methods - make them truly batched operations * - Add storeEntities override to all repositories (57 repos) - Add batch lock check to HierarchicalLockManager - Add batch cache write to EntityRepository - Fix createManyEntitiesForImport with batched operations - Fix updateManyEntitiesForImport with batched operations - Add change event creation in flushPendingEntityOperations --------- Co-authored-by: sonika-shah <[email protected]>
|
🔍 CI failure analysis for 6866b4b: py-run-tests (3.10) (job 62636898036) failed for commit 6866b4b with 'cannot schedule new futures after shutdown' error. This is a transient infrastructure/executor shutdown issue. Other py-run-tests runs succeeded. Unrelated to CSV batching.IssueNew Finding: py-run-tests (3.10) (job 62636898036) for commit Error Details:
Previous Context:
Root CauseTransient Infrastructure Issue: The failure is due to a Python executor shutdown error, not actual test failures: Error: This error occurs when:
Evidence of Transient Nature: Multiple py-run-tests (3.10) runs for the same commit:
Relationship to PR Changes: This failure is completely unrelated to the CSV batching implementation (PR #25542):
CSV Batching Scope:
DetailsCombined CI Status for Commit Backend Integration Tests:
Python Tests:
E2E Tests:
Maven/Frontend Tests:
CSV Batching Implementation Status: ✅ Empty CSV handling: FIXED Python Test Failure Analysis: The executor shutdown error indicates:
Impact Assessment: The py-run-tests failure:
Historical Context: Python test failures with executor shutdown errors are common in CI/CD environments:
ConclusionCSV Batching Status: Production Ready ✅ The CSV import/export batching implementation is working correctly:
The py-run-tests failure is a transient infrastructure issue (executor shutdown) that is unrelated to the CSV batching implementation. Multiple other py-run-tests runs succeeded for the same commit, confirming this is not a code quality issue. Code Review 👍 Approved with suggestions 5 resolved / 7 findingsWell-structured batch processing implementation for CSV import/export with good error handling and fallback mechanisms. Two minor edge cases remain: potential division by zero in export progress and unused batchNumber parameter. 💡 Edge Case: Unused batchNumber parameter in CsvImportProgressCallback📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/EntityResource.java:887 The void onProgress(int rowsProcessed, int totalRows, int batchNumber, String message);However, in CsvImportProgressCallback progressCallback =
(rowsProcessed, totalRows, batchNumber, message) ->
WebsocketNotificationHandler.sendCsvImportProgressNotification(
jobId, securityContext, rowsProcessed, totalRows, message); // batchNumber not passedThis means the batch number information is lost when sending WebSocket notifications, even though it's available. Suggested fix: Either pass 💡 Edge Case: Potential division by zero in export progress calculationIn the EntityExportModalProvider component, the progress percentage is calculated without checking if percent={Math.round((csvExportJob.progress / csvExportJob.total) * 100)}If The BulkEntityImportPage correctly guards against this with Fix: Add a guard similar to the import page: {csvExportJob.status === 'IN_PROGRESS' &&
csvExportJob.progress !== undefined &&
csvExportJob.total !== undefined &&
csvExportJob.total > 0 && ( // Add this check
<div className="m-b-md">
<Progress
percent={Math.round((csvExportJob.progress / csvExportJob.total) * 100)}
status="active"
/>✅ 5 resolved✅ Bug: Race condition in flushPendingChangeEvents async task
✅ Bug: PendingEntityOperation records deleted CSV failures incorrectly
✅ Bug: Missing change event generation in batch entity operations
✅ Bug: Entity version not incremented on batch updates
✅ Bug: Division by zero possible in progress calculation
Rules ✅ All requirements metGitar Rules
2 rules not applicable. Show all rules by commenting Tip Comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
@gitar-bot check this Bug: Race condition in flushPendingChangeEvents async task again, i have fixed it |
I've reviewed the race condition fix in What was fixed: The previous code had a race condition where Current implementation (commit List<String> eventsToInsert = new ArrayList<>(pendingChangeEvents);
pendingChangeEvents.clear(); // Clear immediately to avoid race condition
AsyncService.getInstance()
.getExecutorService()
.submit(
() -> {
try {
Entity.getCollectionDAO().changeEventDAO().insertBatch(eventsToInsert);
LOG.info("Batch inserted {} change events", eventsToInsert.size());
} catch (Exception e) {
LOG.error("Error batch inserting change events", e);
}
});Why this fixes the race condition:
This ensures that any new events added after the clear operation will be part of the next batch, and the async task processes a stable snapshot of events. Great fix! 👍 |
|
|
Failed to cherry-pick changes to the 1.11.9 branch. |



Describe your changes:
Fixes
I worked on ... because ...
Summary by Gitar
This PR implements batched CSV import/export operations to significantly improve performance for large datasets:
insertMany()/updateMany()instead of individual INSERT/UPDATE statementsupdateEntitiesBulk()Type of change:
Checklist:
Fixes <issue-number>: <short explanation>