Merge pull request #3540 from actiontech/fix/max

fix: front-end determines that the packet size cannot exceed the set value
This commit is contained in:
LUA
2022-12-10 15:22:11 +08:00
committed by GitHub

View File

@@ -20,6 +20,7 @@ import com.actiontech.dble.net.executor.ThreadContext;
import com.actiontech.dble.net.executor.ThreadPoolStatistic;
import com.actiontech.dble.net.mysql.AuthPacket;
import com.actiontech.dble.net.mysql.ErrorPacket;
import com.actiontech.dble.net.mysql.MySQLPacket;
import com.actiontech.dble.net.mysql.OkPacket;
import com.actiontech.dble.net.service.*;
import com.actiontech.dble.services.manager.ManagerService;
@@ -180,6 +181,10 @@ public abstract class FrontendService<T extends UserConfig> extends AbstractServ
if (!executeTask.isReuse()) {
this.setPacketId(executeTask.getLastSequenceId());
}
byte[] data = executeTask.getOrgData();
if (data.length - MySQLPacket.PACKET_HEADER_SIZE >= SystemConfig.getInstance().getMaxPacketSize()) {
throw new IllegalArgumentException("Packet for query is too large (" + data.length + " > " + SystemConfig.getInstance().getMaxPacketSize() + ").You can change maxPacketSize value in bootstrap.cnf.");
}
}
super.consumeSingleTask(serviceTask);