From bd9245cc3d7518c79c5cde276482acc5f8ad56dd Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Fri, 8 Sep 2023 13:44:24 +0300 Subject: [PATCH] Avoid deleting the assignment-records in case of a "parquet-data creation, upload or insertion" problem, in order to avoid double-processing of the urls, until the report has been retried by the scheduler. --- .../openaire/urls_controller/services/UrlsServiceImpl.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java b/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java index ada378b..8b1c8d0 100644 --- a/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java +++ b/src/main/java/eu/openaire/urls_controller/services/UrlsServiceImpl.java @@ -375,12 +375,7 @@ public class UrlsServiceImpl implements UrlsService { logger.warn("The current thread was interrupted when waiting for the worker-threads to finish inserting into the tables: " + ie.getMessage()); // This is a very rare case. At the moment, we just move on with table-merging. } catch (RuntimeException re) { - DatabaseConnector.databaseLock.lock(); - String assignmentErrorMsg = deleteAssignmentsBatch(curReportAssignmentsCounter); - DatabaseConnector.databaseLock.unlock(); String errorMsg = re.getMessage(); - if ( assignmentErrorMsg != null ) - errorMsg += "\n" + assignmentErrorMsg; logger.error(errorMsg); postReportResultToWorker(curWorkerId, curReportAssignmentsCounter, errorMsg); return false; @@ -404,6 +399,7 @@ public class UrlsServiceImpl implements UrlsService { } // Delete the assignments each time, as they are bound to the "current" assignmentsCounter. Otherwise, they will never be deleted! + // If this method exits sooner, due tio an error, then the assignments are not deleted in order to wait for the schedulers to retry them and not be given to workers, to avoid reprocessing the urls. DatabaseConnector.databaseLock.lock(); String deleteErrorMsg = deleteAssignmentsBatch(curReportAssignmentsCounter); if ( deleteErrorMsg != null ) {