Merge pull request #2615 from taosdata/feature/sangshuduo/test-compressMsgSize
add test case for compressMsgSize
This commit is contained in:
commit
71b13e2359
|
@ -1366,6 +1366,7 @@ static int32_t rpcCompressRpcMsg(char* pCont, int32_t contLen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t compLen = LZ4_compress_default(pCont, buf, contLen, contLen + overhead);
|
int32_t compLen = LZ4_compress_default(pCont, buf, contLen, contLen + overhead);
|
||||||
|
tDebug("compress rpc msg, before:%d, after:%d, overhead:%d", contLen, compLen, overhead);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* only the compressed size is less than the value of contLen - overhead, the compression is applied
|
* only the compressed size is less than the value of contLen - overhead, the compression is applied
|
||||||
|
@ -1378,7 +1379,7 @@ static int32_t rpcCompressRpcMsg(char* pCont, int32_t contLen) {
|
||||||
memcpy(pCont + overhead, buf, compLen);
|
memcpy(pCont + overhead, buf, compLen);
|
||||||
|
|
||||||
pHead->comp = 1;
|
pHead->comp = 1;
|
||||||
//tDebug("compress rpc msg, before:%d, after:%d", contLen, compLen);
|
tDebug("compress rpc msg, before:%d, after:%d", contLen, compLen);
|
||||||
finalLen = compLen + overhead;
|
finalLen = compLen + overhead;
|
||||||
} else {
|
} else {
|
||||||
finalLen = contLen;
|
finalLen = contLen;
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -22,23 +22,47 @@ class TDSimClient:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.testCluster = False
|
self.testCluster = False
|
||||||
|
|
||||||
|
self.cfgDict = {
|
||||||
|
"numOfLogLines": "100000000",
|
||||||
|
"numOfThreadsPerCore": "2.0",
|
||||||
|
"locale": "en_US.UTF-8",
|
||||||
|
"charset": "UTF-8",
|
||||||
|
"asyncLog": "0",
|
||||||
|
"anyIp": "0",
|
||||||
|
"sdbDebugFlag": "135",
|
||||||
|
"rpcDebugFlag": "135",
|
||||||
|
"tmrDebugFlag": "131",
|
||||||
|
"cDebugFlag": "135",
|
||||||
|
"udebugFlag": "135",
|
||||||
|
"jnidebugFlag": "135",
|
||||||
|
"qdebugFlag": "135",
|
||||||
|
}
|
||||||
|
|
||||||
def init(self, path):
|
def init(self, path):
|
||||||
self.__init__()
|
self.__init__()
|
||||||
self.path = path
|
self.path = path
|
||||||
|
|
||||||
|
def getLogDir(self):
|
||||||
|
self.logDir = "%s/sim/psim/log" % (self.path)
|
||||||
|
return self.logDir
|
||||||
|
|
||||||
def getCfgDir(self):
|
def getCfgDir(self):
|
||||||
|
self.cfgDir = "%s/sim/psim/cfg" % (self.path)
|
||||||
return self.cfgDir
|
return self.cfgDir
|
||||||
|
|
||||||
def setTestCluster(self, value):
|
def setTestCluster(self, value):
|
||||||
self.testCluster = value
|
self.testCluster = value
|
||||||
|
|
||||||
|
def addExtraCfg(self, option, value):
|
||||||
|
self.cfgDict.update({option: value})
|
||||||
|
|
||||||
def cfg(self, option, value):
|
def cfg(self, option, value):
|
||||||
cmd = "echo '%s %s' >> %s" % (option, value, self.cfgPath)
|
cmd = "echo '%s %s' >> %s" % (option, value, self.cfgPath)
|
||||||
if os.system(cmd) != 0:
|
if os.system(cmd) != 0:
|
||||||
tdLog.exit(cmd)
|
tdLog.exit(cmd)
|
||||||
|
|
||||||
def deploy(self):
|
def deploy(self):
|
||||||
self.logDir = "%s/sim/psim/log" % (self.path,)
|
self.logDir = "%s/sim/psim/log" % (self.path)
|
||||||
self.cfgDir = "%s/sim/psim/cfg" % (self.path)
|
self.cfgDir = "%s/sim/psim/cfg" % (self.path)
|
||||||
self.cfgPath = "%s/sim/psim/cfg/taos.cfg" % (self.path)
|
self.cfgPath = "%s/sim/psim/cfg/taos.cfg" % (self.path)
|
||||||
|
|
||||||
|
@ -46,11 +70,11 @@ class TDSimClient:
|
||||||
if os.system(cmd) != 0:
|
if os.system(cmd) != 0:
|
||||||
tdLog.exit(cmd)
|
tdLog.exit(cmd)
|
||||||
|
|
||||||
cmd = "rm -rf " + self.cfgDir
|
cmd = "mkdir -p " + self.logDir
|
||||||
if os.system(cmd) != 0:
|
if os.system(cmd) != 0:
|
||||||
tdLog.exit(cmd)
|
tdLog.exit(cmd)
|
||||||
|
|
||||||
cmd = "mkdir -p " + self.logDir
|
cmd = "rm -rf " + self.cfgDir
|
||||||
if os.system(cmd) != 0:
|
if os.system(cmd) != 0:
|
||||||
tdLog.exit(cmd)
|
tdLog.exit(cmd)
|
||||||
|
|
||||||
|
@ -66,19 +90,10 @@ class TDSimClient:
|
||||||
self.cfg("masterIp", "192.168.0.1")
|
self.cfg("masterIp", "192.168.0.1")
|
||||||
self.cfg("secondIp", "192.168.0.2")
|
self.cfg("secondIp", "192.168.0.2")
|
||||||
self.cfg("logDir", self.logDir)
|
self.cfg("logDir", self.logDir)
|
||||||
self.cfg("numOfLogLines", "100000000")
|
|
||||||
self.cfg("numOfThreadsPerCore", "2.0")
|
for key, value in self.cfgDict.items():
|
||||||
self.cfg("locale", "en_US.UTF-8")
|
self.cfg(key, value)
|
||||||
self.cfg("charset", "UTF-8")
|
|
||||||
self.cfg("asyncLog", "0")
|
|
||||||
self.cfg("anyIp", "0")
|
|
||||||
self.cfg("sdbDebugFlag", "135")
|
|
||||||
self.cfg("rpcDebugFlag", "135")
|
|
||||||
self.cfg("tmrDebugFlag", "131")
|
|
||||||
self.cfg("cDebugFlag", "135")
|
|
||||||
self.cfg("udebugFlag", "135")
|
|
||||||
self.cfg("jnidebugFlag", "135")
|
|
||||||
self.cfg("qdebugFlag", "135")
|
|
||||||
tdLog.debug("psim is deployed and configured by %s" % (self.cfgPath))
|
tdLog.debug("psim is deployed and configured by %s" % (self.cfgPath))
|
||||||
|
|
||||||
|
|
||||||
|
@ -378,6 +393,9 @@ class TDDnodes:
|
||||||
for i in range(len(self.dnodes)):
|
for i in range(len(self.dnodes)):
|
||||||
self.dnodes[i].init(self.path)
|
self.dnodes[i].init(self.path)
|
||||||
|
|
||||||
|
self.sim = TDSimClient()
|
||||||
|
self.sim.init(self.path)
|
||||||
|
|
||||||
def setTestCluster(self, value):
|
def setTestCluster(self, value):
|
||||||
self.testCluster = value
|
self.testCluster = value
|
||||||
|
|
||||||
|
@ -385,8 +403,6 @@ class TDDnodes:
|
||||||
self.valgrind = value
|
self.valgrind = value
|
||||||
|
|
||||||
def deploy(self, index):
|
def deploy(self, index):
|
||||||
self.sim = TDSimClient()
|
|
||||||
self.sim.init(self.path)
|
|
||||||
self.sim.setTestCluster(self.testCluster)
|
self.sim.setTestCluster(self.testCluster)
|
||||||
|
|
||||||
if (self.simDeployed == False):
|
if (self.simDeployed == False):
|
||||||
|
@ -474,5 +490,11 @@ class TDDnodes:
|
||||||
def getSimCfgPath(self):
|
def getSimCfgPath(self):
|
||||||
return self.sim.getCfgDir()
|
return self.sim.getCfgDir()
|
||||||
|
|
||||||
|
def getSimLogPath(self):
|
||||||
|
return self.sim.getLogDir()
|
||||||
|
|
||||||
|
def addSimExtraCfg(self, option, value):
|
||||||
|
self.sim.addExtraCfg(option, value)
|
||||||
|
|
||||||
|
|
||||||
tdDnodes = TDDnodes()
|
tdDnodes = TDDnodes()
|
||||||
|
|
Loading…
Reference in New Issue