- Fix not counting the files from the bulkImport-segment, which failed due to an exception.

- Write segment-exception-messages to the bulkImport-report.
This commit is contained in:
Lampros Smyrnaios 2024-04-30 23:43:52 +03:00
parent 0d117743c2
commit 8e14d4dbe0
1 changed files with 6 additions and 0 deletions

View File

@ -156,13 +156,19 @@ public class BulkImportServiceImpl implements BulkImportService {
// The failed-to-be-imported files, will not be deleted, even if the user specifies that he wants to delete the directory.
} catch (ExecutionException ee) { // These can be serious errors like an "out of memory exception" (Java HEAP).
numFailedSegments ++;
numAllFailedFiles += subLists.get(i).size(); // We assume all files of this segment failed, as all are passed through the same parts of code, so any serious exception should arise from the 1st files being processed and the rest of the files wil be skipped..
logger.error(GenericUtils.getSelectedStackTraceForCausedException(ee, "Task_" + i + " failed with: ", additionalLoggingMsg, 15));
bulkImportReport.addEvent("Segment_" + i + " failed with: " + ee.getCause().getMessage());
} catch (CancellationException ce) {
numFailedSegments ++;
numAllFailedFiles += subLists.get(i).size(); // We assume all files have failed.
logger.error("Task_" + i + " was cancelled: " + ce.getMessage() + additionalLoggingMsg);
bulkImportReport.addEvent("Segment_" + i + " failed with: " + ce.getMessage());
} catch (InterruptedException ie) {
numFailedSegments ++;
numAllFailedFiles += (subLists.get(i).size() / 3); // In this case, only some of the files will have failed (do not know how many).
logger.error("Task_" + i + " was interrupted: " + ie.getMessage());
bulkImportReport.addEvent("Segment_" + i + " failed with: " + ie.getMessage());
} catch (IndexOutOfBoundsException ioobe) {
logger.error("IOOBE for task_" + i + " in the futures-list! " + ioobe.getMessage() + additionalLoggingMsg);
}