This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 5cf4c93791 [core] Check file size after write bundle of records (#4685)
5cf4c93791 is described below
commit 5cf4c93791c460cb35bdd53a5e0b512b964781a5
Author: YeJunHao <[email protected]>
AuthorDate: Wed Dec 11 15:14:03 2024 +0800
[core] Check file size after write bundle of records (#4685)
---
.../src/main/java/org/apache/paimon/io/RollingFileWriter.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/io/RollingFileWriter.java
b/paimon-core/src/main/java/org/apache/paimon/io/RollingFileWriter.java
index 109b757430..29b9223b9a 100644
--- a/paimon-core/src/main/java/org/apache/paimon/io/RollingFileWriter.java
+++ b/paimon-core/src/main/java/org/apache/paimon/io/RollingFileWriter.java
@@ -64,10 +64,9 @@ public class RollingFileWriter<T, R> implements
FileWriter<T, List<R>> {
return targetFileSize;
}
- @VisibleForTesting
- boolean rollingFile() throws IOException {
+ private boolean rollingFile(boolean forceCheck) throws IOException {
return currentWriter.reachTargetSize(
- recordCount % CHECK_ROLLING_RECORD_CNT == 0, targetFileSize);
+ forceCheck || recordCount % CHECK_ROLLING_RECORD_CNT == 0,
targetFileSize);
}
@Override
@@ -81,7 +80,7 @@ public class RollingFileWriter<T, R> implements FileWriter<T,
List<R>> {
currentWriter.write(row);
recordCount += 1;
- if (rollingFile()) {
+ if (rollingFile(false)) {
closeCurrentWriter();
}
} catch (Throwable e) {
@@ -105,7 +104,7 @@ public class RollingFileWriter<T, R> implements
FileWriter<T, List<R>> {
currentWriter.writeBundle(bundle);
recordCount += bundle.rowCount();
- if (rollingFile()) {
+ if (rollingFile(true)) {
closeCurrentWriter();
}
} catch (Throwable e) {