[fix](fe) avoid setting the value of batch_size excessively high (#35941) (#40312)

Issue Number: close #xxx

pick #35941

## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->
This commit is contained in:
Jerry Hu
2024-09-03 19:49:26 +08:00
committed by GitHub
parent 67d46297f2
commit 3cf5d15b49

View File

@ -56,6 +56,7 @@ import java.io.DataOutput;
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;
@ -846,7 +847,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)
@ -4008,6 +4009,13 @@ public class SessionVariable implements Serializable, Writable {
}
}
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