use of io.mycat.net.mysql.ErrorPacket in project Mycat-Server by MyCATApache.
the class SingleNodeHandler method executeException.
private void executeException(BackendConnection c, Exception e) {
ErrorPacket err = new ErrorPacket();
err.packetId = ++packetId;
err.errno = ErrorCode.ERR_FOUND_EXCEPION;
err.message = StringUtil.encode(e.toString(), session.getSource().getCharset());
this.backConnectionErr(err, c);
}
use of io.mycat.net.mysql.ErrorPacket in project Mycat-Server by MyCATApache.
the class SingleNodeHandler method connectionError.
@Override
public void connectionError(Throwable e, BackendConnection conn) {
endRunning();
ErrorPacket err = new ErrorPacket();
err.packetId = ++packetId;
err.errno = ErrorCode.ER_NEW_ABORTING_CONNECTION;
err.message = StringUtil.encode(e.getMessage(), session.getSource().getCharset());
ServerConnection source = session.getSource();
source.write(err.write(allocBuffer(), source, true));
}
use of io.mycat.net.mysql.ErrorPacket in project Mycat-Server by MyCATApache.
the class FrontendConnection method writeErrMessage.
public void writeErrMessage(byte id, int errno, String msg) {
ErrorPacket err = new ErrorPacket();
err.packetId = id;
err.errno = errno;
err.message = encodeString(msg, charset);
err.write(this);
}
use of io.mycat.net.mysql.ErrorPacket in project Mycat-Server by MyCATApache.
the class SequenceVal method errorResponse.
@Override
public void errorResponse(byte[] data, BackendConnection conn) {
SequenceVal seqVal = ((SequenceVal) conn.getAttachment());
seqVal.dbfinished = true;
ErrorPacket err = new ErrorPacket();
err.read(data);
String errMsg = new String(err.message);
LOGGER.warn("errorResponse " + err.errno + " " + errMsg);
IncrSequenceMySQLHandler.latestErrors.put(seqVal.seqName, errMsg);
conn.release();
}
use of io.mycat.net.mysql.ErrorPacket in project Mycat-Server by MyCATApache.
the class Heartbeat method response.
public static void response(ServerConnection c, byte[] data) {
HeartbeatPacket hp = new HeartbeatPacket();
hp.read(data);
if (MycatServer.getInstance().isOnline()) {
OkPacket ok = new OkPacket();
ok.packetId = 1;
ok.affectedRows = hp.id;
ok.serverStatus = 2;
ok.write(c);
if (HEARTBEAT.isInfoEnabled()) {
HEARTBEAT.info(responseMessage("OK", c, hp.id));
}
} else {
ErrorPacket error = new ErrorPacket();
error.packetId = 1;
error.errno = ErrorCode.ER_SERVER_SHUTDOWN;
error.message = String.valueOf(hp.id).getBytes();
error.write(c);
if (HEARTBEAT.isInfoEnabled()) {
HEARTBEAT.info(responseMessage("ERROR", c, hp.id));
}
}
}
Aggregations