Merge pull request #2498 from taosdata/hotfix/invalidWrite
check the application message length before passing it to server
This commit is contained in:
commit
f8cdaa7b22
|
@ -0,0 +1,51 @@
|
|||
package com.taosdata.jdbc.utils;
|
||||
|
||||
public class TDNode {
|
||||
|
||||
private int index;
|
||||
private int running;
|
||||
private int deployed;
|
||||
private boolean testCluster;
|
||||
private int valgrind;
|
||||
private String path;
|
||||
|
||||
public TDNode(int index) {
|
||||
this.index = index;
|
||||
running = 0;
|
||||
deployed = 0;
|
||||
testCluster = false;
|
||||
valgrind = 0;
|
||||
}
|
||||
|
||||
public void setTestCluster(boolean testCluster) {
|
||||
this.testCluster = testCluster;
|
||||
}
|
||||
|
||||
public void setValgrind(boolean valgrind) {
|
||||
this.valgrind = valgrind;
|
||||
}
|
||||
|
||||
public int getDataSize() {
|
||||
totalSize = 0;
|
||||
|
||||
if(deployed == 1) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
def getDataSize(self):
|
||||
totalSize = 0
|
||||
|
||||
if (self.deployed == 1):
|
||||
for dirpath, dirnames, filenames in .walk(self.dataDir):
|
||||
for f in filenames:
|
||||
fp = os.path.join(dirpath, f)
|
||||
|
||||
if not os.path.islink(fp):
|
||||
totalSize = totalSize + os.path.getsize(fp)
|
||||
|
||||
return totalSize
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1034,15 +1034,20 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
|
|||
rpcMsg.ahandle = pConn->ahandle;
|
||||
|
||||
if ( rpcIsReq(pHead->msgType) ) {
|
||||
rpcMsg.handle = pConn;
|
||||
rpcAddRef(pRpc); // add the refCount for requests
|
||||
if (rpcMsg.contLen > 0) {
|
||||
rpcMsg.handle = pConn;
|
||||
rpcAddRef(pRpc); // add the refCount for requests
|
||||
|
||||
// start the progress timer to monitor the response from server app
|
||||
if (pConn->connType != RPC_CONN_TCPS)
|
||||
pConn->pTimer = taosTmrStart(rpcProcessProgressTimer, tsProgressTimer, pConn, pRpc->tmrCtrl);
|
||||
// start the progress timer to monitor the response from server app
|
||||
if (pConn->connType != RPC_CONN_TCPS)
|
||||
pConn->pTimer = taosTmrStart(rpcProcessProgressTimer, tsProgressTimer, pConn, pRpc->tmrCtrl);
|
||||
|
||||
// notify the server app
|
||||
(*(pRpc->cfp))(&rpcMsg, NULL);
|
||||
// notify the server app
|
||||
(*(pRpc->cfp))(&rpcMsg, NULL);
|
||||
} else {
|
||||
tDebug("%s, message body is empty, ignore", pConn->info);
|
||||
rpcFreeCont(rpcMsg.pCont);
|
||||
}
|
||||
} else {
|
||||
// it's a response
|
||||
SRpcReqContext *pContext = pConn->pContext;
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Coloured Echoes
|
||||
function red_echo { echo -e "\033[31m$@\033[0m"; }
|
||||
function green_echo { echo -e "\033[32m$@\033[0m"; }
|
||||
function yellow_echo { echo -e "\033[33m$@\033[0m"; }
|
||||
function white_echo { echo -e "\033[1;37m$@\033[0m"; }
|
||||
# Coloured Printfs
|
||||
function red_printf { printf "\033[31m$@\033[0m"; }
|
||||
function green_printf { printf "\033[32m$@\033[0m"; }
|
||||
function yellow_printf { printf "\033[33m$@\033[0m"; }
|
||||
function white_printf { printf "\033[1;37m$@\033[0m"; }
|
||||
# Debugging Outputs
|
||||
function white_brackets { local args="$@"; white_printf "["; printf "${args}"; white_printf "]"; }
|
||||
function echoInfo { local args="$@"; white_brackets $(green_printf "INFO") && echo " ${args}"; }
|
||||
function echoWarn { local args="$@"; echo "$(white_brackets "$(yellow_printf "WARN")" && echo " ${args}";)" 1>&2; }
|
||||
function echoError { local args="$@"; echo "$(white_brackets "$(red_printf "ERROR")" && echo " ${args}";)" 1>&2; }
|
||||
|
||||
function restartTaosd {
|
||||
systemctl stop taosd
|
||||
pkill -KILL -x taosd
|
||||
sleep 10
|
||||
|
||||
rm -rf /mnt/var/log/taos/*
|
||||
rm -rf /mnt/var/lib/taos/*
|
||||
|
||||
taosd 2>&1 > /dev/null &
|
||||
sleep 10
|
||||
}
|
||||
|
||||
function runCreateTableThenInsert {
|
||||
echoInfo "Restart Taosd"
|
||||
restartTaosd
|
||||
|
||||
/usr/bin/time -f "Total: %e" -o totaltime.out bash -c "yes | taosdemo 2>&1 | tee -a taosdemo-$1-$today.log"
|
||||
demoTableAndInsert=`grep "Total:" totaltime.out|awk '{print $2}'`
|
||||
demoRPS=`grep "records\/second" taosdemo-$1-$today.log | tail -n1 | awk '{print $13}'`
|
||||
}
|
||||
|
||||
function queryMetadata {
|
||||
echo "query metadata"
|
||||
|
||||
cd ../pytest/query
|
||||
python3 queryMetaData.py | tee -a queryResult.log
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
###################################################################
|
||||
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is proprietary and confidential to TAOS Technologies.
|
||||
# No part of this file may be reproduced, stored, transmitted,
|
||||
# disclosed or used in any form or by any means other than as
|
||||
# expressly provided by the written permission from Jianhui Tao
|
||||
#
|
||||
###################################################################
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import taos
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class QueryMetaData:
|
||||
def __init__(self):
|
||||
self.host = "127.0.0.1"
|
||||
self.user = "root"
|
||||
self.password = "taosdata"
|
||||
self.config = "/etc/taos"
|
||||
|
||||
def connectDB(self):
|
||||
self.conn = taos.connect(
|
||||
self.host,
|
||||
self.user,
|
||||
self.password,
|
||||
self.config)
|
||||
self.cursor = self.conn.cursor()
|
||||
|
||||
def queryData(self):
|
||||
print("===============query tag data===============")
|
||||
self.cursor.execute("use test")
|
||||
startTime = datetime.now()
|
||||
self.cursor.execute("select areaid from meters")
|
||||
data = self.cursor.fetchall()
|
||||
endTime = datetime.now()
|
||||
|
||||
print(endTime - startTime)
|
||||
|
||||
start = datetime.now()
|
||||
self.cursor.execute("select areaid, loc from meters")
|
||||
data2 = self.cursor.fetchall()
|
||||
end = datetime.now()
|
||||
|
||||
print(end - start)
|
||||
|
||||
def closeConn(self):
|
||||
self.cursor.close()
|
||||
self.conn.close()
|
||||
|
||||
|
||||
test = QueryMetaData()
|
||||
test.connectDB()
|
||||
test.queryData()
|
||||
test.closeConn()
|
Loading…
Reference in New Issue