Skip to content

Commit

Permalink
[fix](fe) avoid setting the value of batch_size excessively high (apa…
Browse files Browse the repository at this point in the history
…che#35941)

## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->
  • Loading branch information
mrhhsg authored Jun 6, 2024
1 parent 3bd6c2b commit 0abb2be
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.security.InvalidParameterException;
import java.security.SecureRandom;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
Expand Down Expand Up @@ -809,7 +810,7 @@ public class SessionVariable implements Serializable, Writable {
public boolean haveQueryCache = false;

// 4096 minus 16 + 16 bytes padding that in padding pod array
@VariableMgr.VarAttr(name = BATCH_SIZE, fuzzy = true)
@VariableMgr.VarAttr(name = BATCH_SIZE, fuzzy = true, checker = "checkBatchSize")
public int batchSize = 4064;

@VariableMgr.VarAttr(name = DISABLE_STREAMING_PREAGGREGATIONS, fuzzy = true)
Expand Down Expand Up @@ -3860,6 +3861,13 @@ public void checkSqlDialect(String sqlDialect) {
}
}

public void checkBatchSize(String batchSize) {
Long batchSizeValue = Long.valueOf(batchSize);
if (batchSizeValue < 1 || batchSizeValue > 65535) {
throw new InvalidParameterException("batch_size should be between 1 and 65535)");
}
}

public boolean isEnableInsertGroupCommit() {
return Config.wait_internal_group_commit_finish
|| GroupCommitBlockSink.parseGroupCommit(groupCommit) == TGroupCommitMode.ASYNC_MODE
Expand Down

0 comments on commit 0abb2be

Please sign in to comment.