提交 f8cdaa7b 编写于 作者: S Shengliang Guan 提交者: Ping Xiao

Merge pull request #2498 from taosdata/hotfix/invalidWrite

check the application message length before passing it to server
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
}
\ No newline at end of file
......@@ -1034,6 +1034,7 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
rpcMsg.ahandle = pConn->ahandle;
if ( rpcIsReq(pHead->msgType) ) {
if (rpcMsg.contLen > 0) {
rpcMsg.handle = pConn;
rpcAddRef(pRpc); // add the refCount for requests
......@@ -1043,6 +1044,10 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
// 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;
......
#!/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
}
\ No newline at end of file
###################################################################
# 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()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册