Skip to content

Commit e84bc49

Browse files
committed
Process footer changes
1 parent 45db826 commit e84bc49

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataexport/ExportManager.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ public ExportReport startExport(
105105
isFirstBatch,
106106
exportReport));
107107
}
108-
processFooter(exportOptions, tableMetadata, bufferedWriter);
109-
} catch (IOException | UnknownTransactionStatusException | CrudException e) {
108+
} catch (UnknownTransactionStatusException | CrudException e) {
110109
logger.error("Error during export: ", e);
111110
} finally {
112111
executorService.shutdown();
@@ -120,7 +119,18 @@ public ExportReport startExport(
120119
Thread.currentThread().interrupt();
121120
logger.error("Interrupted while waiting for executor termination", e);
122121
}
123-
bufferedWriter.flush();
122+
// Process footer after all tasks are complete
123+
try {
124+
processFooter(exportOptions, tableMetadata, bufferedWriter);
125+
} catch (IOException e) {
126+
logger.error("Error processing footer", e);
127+
}
128+
// Flush buffered writer
129+
try {
130+
bufferedWriter.flush();
131+
} catch (IOException e) {
132+
logger.error("Error flushing writer", e);
133+
}
124134
}
125135
} catch (ExportOptionsValidationException | IOException | ScalarDbDaoException e) {
126136
logger.error("Error during export: {}", e.getMessage());

0 commit comments

Comments
 (0)