Skip to content

Commit a5fcf4c

Browse files
committed
* log-exporter: export action and event in parquet format
Signed-off-by: neo <1100909+neowu@users.noreply.github.com>
1 parent b70deab commit a5fcf4c

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

ext/log-exporter/src/main/java/core/log/service/ArchiveService.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,17 @@ public class ArchiveService {
4040

4141
public void uploadArchive(LocalDate date) throws IOException {
4242
logger.info("uploading begin, date={}", date);
43+
upload(localActionLogFilePath(date), remoteActionLogPath(date));
44+
upload(localEventFilePath(date), remoteEventPath(date));
45+
logger.info("uploading end, date={}", date);
46+
}
4347

44-
Path actionLogFilePath = localActionLogFilePath(date);
45-
if (exists(actionLogFilePath)) {
46-
Path actionLogParquetFilePath = convertToParquet(actionLogFilePath);
47-
String remoteActionLogPath = remoteActionLogPath(date);
48-
uploadService.upload(actionLogParquetFilePath, remoteActionLogPath);
49-
Files.delete(actionLogParquetFilePath);
50-
}
51-
52-
Path eventFilePath = localEventFilePath(date);
53-
if (exists(eventFilePath)) {
54-
Path eventParquetFilePath = convertToParquet(actionLogFilePath);
55-
String remoteEventPath = remoteEventPath(date);
56-
uploadService.upload(eventParquetFilePath, remoteEventPath);
57-
Files.delete(eventParquetFilePath);
48+
private void upload(Path localFilePath, String remotePath) throws IOException {
49+
if (exists(localFilePath)) {
50+
Path parquetFilePath = convertToParquet(localFilePath);
51+
uploadService.upload(parquetFilePath, remotePath);
52+
Files.delete(parquetFilePath);
5853
}
59-
60-
logger.info("uploading end, date={}", date);
6154
}
6255

6356
Path convertToParquet(Path sourcePath) throws IOException {

0 commit comments

Comments
 (0)