use of com.alibaba.cobar.net.mysql.ErrorPacket in project cobar by alibaba.
the class CobarDetectorHandler method handleErrorPacket.
/**
* ERROR数据包处理
*/
private void handleErrorPacket(byte[] data) {
ErrorPacket err = new ErrorPacket();
err.read(data);
switch(err.errno) {
case ErrorCode.ER_SERVER_SHUTDOWN:
source.getHeartbeat().setResult(CobarHeartbeat.OFF_STATUS, source, false, err.message);
break;
default:
throw new HeartbeatException(new String(err.message));
}
}
use of com.alibaba.cobar.net.mysql.ErrorPacket in project cobar by alibaba.
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 com.alibaba.cobar.net.mysql.ErrorPacket in project cobar by alibaba.
the class SingleNodeHandler method executeException.
private void executeException(MySQLConnection c) {
c.setRunning(false);
endRunning();
session.clearConnections();
ErrorPacket err = new ErrorPacket();
err.packetId = ++packetId;
err.errno = ErrorCode.ER_YES;
err.message = StringUtil.encode("unknown backend charset: " + c.getCharset(), session.getSource().getCharset());
ServerConnection source = session.getSource();
source.write(err.write(buffer, source));
}
use of com.alibaba.cobar.net.mysql.ErrorPacket in project cobar by alibaba.
the class MultiNodeExecutor method notifyFailure.
/**
* 通知,执行异常
*
* @throws nothing never throws any exception
*/
private void notifyFailure(BlockingSession ss) {
try {
// 清理
ss.clear();
ServerConnection sc = ss.getSource();
sc.setTxInterrupt();
// 通知
ErrorPacket err = new ErrorPacket();
// ERROR_PACKET
err.packetId = ++packetId;
err.errno = errno;
err.message = StringUtil.encode(errMessage, sc.getCharset());
sc.write(err.write(buffer, sc));
} catch (Exception e) {
LOGGER.warn("exception happens in failure notification: " + ss.getSource(), e);
}
}
use of com.alibaba.cobar.net.mysql.ErrorPacket in project cobar by alibaba.
the class CommitNodeHandler method errorResponse.
@Override
public void errorResponse(byte[] data, MySQLConnection conn) {
ErrorPacket err = new ErrorPacket();
err.read(data);
backendConnError(conn, err);
}
Aggregations