ok packet of conn heartbeat returns when heartTimeout isn't initialized (#2547)

This commit is contained in:
Collapsar
2021-03-23 13:16:22 +08:00
committed by GitHub
parent c719c56818
commit aba3be36c6
2 changed files with 6 additions and 3 deletions

View File

@@ -43,11 +43,13 @@ public class ConnectionHeartBeatHandler implements ResponseHandler {
}
public boolean ping(long timeout) {
conn.getService().writeDirectly(PingPacket.PING);
if (heartbeatLock != null) {
conn.getService().writeDirectly(PingPacket.PING);
synchronized (heartbeatLock) {
try {
heartbeatLock.wait(timeout);
while (!finished) {
heartbeatLock.wait(timeout);
}
} catch (InterruptedException e) {
finished = false;
}
@@ -55,6 +57,7 @@ public class ConnectionHeartBeatHandler implements ResponseHandler {
return finished;
} else {
heartbeatTimeout = TimerHolder.getTimer().newTimeout(timeout1 -> conn.businessClose("conn heart timeout"), timeout, TimeUnit.MILLISECONDS);
conn.getService().writeDirectly(PingPacket.PING);
return true;
}
}

View File

@@ -87,7 +87,7 @@ public class SqlLog extends ManagerBaseTable {
} else {
map.put(COLUMN_SQL_STMT, sqlRecord.getStmt());
}
map.put(COLUMN_SQL_TYPE, sqlRecord.getSqlId() + "");
map.put(COLUMN_SQL_TYPE, sqlRecord.getSqlType() + "");
map.put(COLUMN_TX_ID, sqlRecord.getTxId() + "");
map.put(COLUMN_ENTRY, sqlRecord.getEntry() + "");
map.put(COLUMN_USER, sqlRecord.getUser());