提交 9560f319 编写于 作者: S Shuduo Sang

add insert/sparseData.py to test compressing sparse file content.

[TD-412]
上级 dfbe9ace
...@@ -29,7 +29,8 @@ class TDTestCase: ...@@ -29,7 +29,8 @@ class TDTestCase:
tdSql.prepare() tdSql.prepare()
tdLog.info("=============== step1") tdLog.info("=============== step1")
tdSql.execute('create table tb (ts timestamp, speed int, temp float, note binary(5), flag bool)') tdSql.execute(
'create table tb (ts timestamp, speed int, temp float, note binary(5), flag bool)')
numOfRecords = 0 numOfRecords = 0
randomList = [10, 50, 100, 500, 1000, 5000] randomList = [10, 50, 100, 500, 1000, 5000]
...@@ -38,23 +39,24 @@ class TDTestCase: ...@@ -38,23 +39,24 @@ class TDTestCase:
tdLog.info("will insert %d records" % num) tdLog.info("will insert %d records" % num)
for x in range(0, num): for x in range(0, num):
tdLog.info( tdLog.info(
'insert into tb values (now + %da, NULL, NULL, NULL, TRUE)' % x) 'insert into tb values (now + %da, NULL, NULL, NULL, TRUE)' %
x)
tdSql.execute( tdSql.execute(
'insert into tb values (now + %da, NULL, NULL, NULL, TRUE)' % x) 'insert into tb values (now + %da, NULL, NULL, NULL, TRUE)' %
x)
numOfRecords = numOfRecords + num numOfRecords = numOfRecords + num
tdSql.query("select * from tb") tdSql.query("select * from tb")
tdSql.checkRows(numOfRecords) tdSql.checkRows(numOfRecords)
tdSql.checkData(numOfRecords-num, 1, None) tdSql.checkData(numOfRecords - num, 1, None)
tdSql.checkData(numOfRecords-1, 2, None) tdSql.checkData(numOfRecords - 1, 2, None)
tdLog.info("stop dnode to commit data to disk") tdLog.info("stop dnode to commit data to disk")
tdDnodes.stop(1) tdDnodes.stop(1)
tdDnodes.start(1) tdDnodes.start(1)
tdLog.sleep(5) tdLog.sleep(5)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __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
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
tdLog.info("=============== step1")
tdSql.execute(
'create table tb (ts timestamp, speed int, temp float, note binary(4000), flag bool)')
numOfRecords = 1000000
dividend = 1000
tdLog.info("will insert %d records" % numOfRecords)
ts = 1500000000000
for i in range(0, numOfRecords):
if (i % dividend):
print(".", end="")
tdSql.execute(
'insert into tb values (%d + %da, NULL, NULL, NULL, TRUE)' %
(ts, i))
else:
print("a", end="")
tdSql.execute(
'insert into tb values (%d + %da, NULL, NULL, "a", FALSE)' %
(ts, i))
tdSql.query("select * from tb")
tdSql.checkRows(numOfRecords)
tdSql.checkData(numOfRecords - dividend, 3, 'a')
tdSql.checkData(numOfRecords - dividend - 1, 3, None)
tdLog.info("stop dnode to commit data to disk")
tdDnodes.stop(1)
tdLog.info("dnodes:%d size is %d" % (1, tdDnodes.getDataSize(1)))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
...@@ -121,6 +121,7 @@ class Test: ...@@ -121,6 +121,7 @@ class Test:
tdDnodes.start(1) tdDnodes.start(1)
tdSql.prepare() tdSql.prepare()
class TDTestCase: class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
......
...@@ -98,12 +98,16 @@ class TDTestCase: ...@@ -98,12 +98,16 @@ class TDTestCase:
# create a super table with name exceed max length # create a super table with name exceed max length
sname = self.generateString(maxTableNameLen + 1) sname = self.generateString(maxTableNameLen + 1)
tdLog.info("create a super table with length %d" % len(sname)) tdLog.info("create a super table with length %d" % len(sname))
tdSql.error("create table %s (ts timestamp, value int) tags(id int)" % sname) tdSql.error(
"create table %s (ts timestamp, value int) tags(id int)" %
sname)
# create a super table with name of max length # create a super table with name of max length
sname = self.generateString(maxTableNameLen) sname = self.generateString(maxTableNameLen)
tdLog.info("create a super table with length %d" % len(sname)) tdLog.info("create a super table with length %d" % len(sname))
tdSql.execute("create table %s (ts timestamp, value int) tags(id int)" % sname) tdSql.execute(
"create table %s (ts timestamp, value int) tags(id int)" %
sname)
tdLog.info("check table count, should be one") tdLog.info("check table count, should be one")
tdSql.query('show stables') tdSql.query('show stables')
tdSql.checkRows(1) tdSql.checkRows(1)
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -82,10 +82,10 @@ class TDTestCase: ...@@ -82,10 +82,10 @@ class TDTestCase:
(tb, ms, x)) (tb, ms, x))
# TSIM: $x = $x + 1 # TSIM: $x = $x + 1
x = x + 1 x = x + 1
#TSIM: endw # TSIM: endw
# TSIM: $i = $i + 1 # TSIM: $i = $i + 1
i = i + 1 i = i + 1
#TSIM: endw # TSIM: endw
# TSIM: while $i < 10 # TSIM: while $i < 10
while (i < 10): while (i < 10):
# TSIM: $tb = $tbPrefix . $i # TSIM: $tb = $tbPrefix . $i
...@@ -108,10 +108,10 @@ class TDTestCase: ...@@ -108,10 +108,10 @@ class TDTestCase:
(tb, ms, x)) (tb, ms, x))
# TSIM: $x = $x + 1 # TSIM: $x = $x + 1
x = x + 1 x = x + 1
#TSIM: endw # TSIM: endw
# TSIM: $i = $i + 1 # TSIM: $i = $i + 1
i = i + 1 i = i + 1
#TSIM: endw # TSIM: endw
# TSIM: # TSIM:
# TSIM: print =============== step2 # TSIM: print =============== step2
tdLog.info('=============== step2') tdLog.info('=============== step2')
...@@ -123,7 +123,7 @@ class TDTestCase: ...@@ -123,7 +123,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow($rowNum)') tdLog.info('tdSql.checkRow($rowNum)')
tdSql.checkRows(rowNum) tdSql.checkRows(rowNum)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m # TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb)) tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb)) tdSql.query('select * from %s where ts < now + 4m' % (tb))
...@@ -131,7 +131,7 @@ class TDTestCase: ...@@ -131,7 +131,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(5)') tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5) tdSql.checkRows(5)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m # TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb)) tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb)) tdSql.query('select * from %s where ts <= now + 4m' % (tb))
...@@ -139,7 +139,7 @@ class TDTestCase: ...@@ -139,7 +139,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(5)') tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5) tdSql.checkRows(5)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m # TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb)) tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb)) tdSql.query('select * from %s where ts > now + 4m' % (tb))
...@@ -147,7 +147,7 @@ class TDTestCase: ...@@ -147,7 +147,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(15)') tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15) tdSql.checkRows(15)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m # TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb)) tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb)) tdSql.query('select * from %s where ts >= now + 4m' % (tb))
...@@ -155,7 +155,7 @@ class TDTestCase: ...@@ -155,7 +155,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(15)') tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15) tdSql.checkRows(15)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
tdLog.info( tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' % 'select * from %s where ts > now + 4m and ts < now + 5m' %
...@@ -167,7 +167,7 @@ class TDTestCase: ...@@ -167,7 +167,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(1)') tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1) tdSql.checkRows(1)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
tdLog.info( tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' % 'select * from %s where ts < now + 4m and ts > now + 5m' %
...@@ -179,7 +179,7 @@ class TDTestCase: ...@@ -179,7 +179,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(0)') tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0) tdSql.checkRows(0)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $tb where ts > 100000 and ts < 100000 # TSIM: sql select * from $tb where ts > 100000 and ts < 100000
tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb))
tdSql.query( tdSql.query(
...@@ -189,7 +189,7 @@ class TDTestCase: ...@@ -189,7 +189,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(0)') tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0) tdSql.checkRows(0)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
tdLog.info( tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' % 'select * from %s where ts > now + 4m and ts < now + 3m' %
...@@ -201,7 +201,7 @@ class TDTestCase: ...@@ -201,7 +201,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(0)') tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0) tdSql.checkRows(0)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m # ts < now + 6m
tdLog.info( tdLog.info(
...@@ -214,7 +214,7 @@ class TDTestCase: ...@@ -214,7 +214,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(1)') tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1) tdSql.checkRows(1)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step3 # TSIM: print =============== step3
tdLog.info('=============== step3') tdLog.info('=============== step3')
...@@ -225,7 +225,7 @@ class TDTestCase: ...@@ -225,7 +225,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow($totalNum)') tdLog.info('tdSql.checkRow($totalNum)')
tdSql.checkRows(totalNum) tdSql.checkRows(totalNum)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where ts < now + 4m # TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt)) tdLog.info('select * from %s where ts < now + 4m' % (mt))
...@@ -234,7 +234,7 @@ class TDTestCase: ...@@ -234,7 +234,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(50)') tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50) tdSql.checkRows(50)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m # TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt))
...@@ -242,7 +242,7 @@ class TDTestCase: ...@@ -242,7 +242,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(150)') tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150) tdSql.checkRows(150)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m # TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt))
...@@ -250,7 +250,7 @@ class TDTestCase: ...@@ -250,7 +250,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(0)') tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0) tdSql.checkRows(0)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
tdLog.info( tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' % 'select * from %s where ts > now + 4m and ts < now + 5m' %
...@@ -262,7 +262,7 @@ class TDTestCase: ...@@ -262,7 +262,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(10)') tdLog.info('tdSql.checkRow(10)')
tdSql.checkRows(10) tdSql.checkRows(10)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step4 # TSIM: print =============== step4
tdLog.info('=============== step4') tdLog.info('=============== step4')
...@@ -273,7 +273,7 @@ class TDTestCase: ...@@ -273,7 +273,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(100)') tdLog.info('tdSql.checkRow(100)')
tdSql.checkRows(100) tdSql.checkRows(100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where tgcol <> 0 # TSIM: sql select * from $mt where tgcol <> 0
tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdLog.info('select * from %s where tgcol <> 0' % (mt))
tdSql.query('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt))
...@@ -281,7 +281,7 @@ class TDTestCase: ...@@ -281,7 +281,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(100)') tdLog.info('tdSql.checkRow(100)')
tdSql.checkRows(100) tdSql.checkRows(100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where tgcol = 1 # TSIM: sql select * from $mt where tgcol = 1
tdLog.info('select * from %s where tgcol = 1' % (mt)) tdLog.info('select * from %s where tgcol = 1' % (mt))
tdSql.query('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt))
...@@ -289,7 +289,7 @@ class TDTestCase: ...@@ -289,7 +289,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(100)') tdLog.info('tdSql.checkRow(100)')
tdSql.checkRows(100) tdSql.checkRows(100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where tgcol <> 1 # TSIM: sql select * from $mt where tgcol <> 1
tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdLog.info('select * from %s where tgcol <> 1' % (mt))
tdSql.query('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt))
...@@ -297,7 +297,7 @@ class TDTestCase: ...@@ -297,7 +297,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(100)') tdLog.info('tdSql.checkRow(100)')
tdSql.checkRows(100) tdSql.checkRows(100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where tgcol = 1 # TSIM: sql select * from $mt where tgcol = 1
tdLog.info('select * from %s where tgcol = 1' % (mt)) tdLog.info('select * from %s where tgcol = 1' % (mt))
tdSql.query('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt))
...@@ -305,7 +305,7 @@ class TDTestCase: ...@@ -305,7 +305,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(100)') tdLog.info('tdSql.checkRow(100)')
tdSql.checkRows(100) tdSql.checkRows(100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where tgcol <> 1 # TSIM: sql select * from $mt where tgcol <> 1
tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdLog.info('select * from %s where tgcol <> 1' % (mt))
tdSql.query('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt))
...@@ -313,7 +313,7 @@ class TDTestCase: ...@@ -313,7 +313,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(100)') tdLog.info('tdSql.checkRow(100)')
tdSql.checkRows(100) tdSql.checkRows(100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where tgcol = 0 # TSIM: sql select * from $mt where tgcol = 0
tdLog.info('select * from %s where tgcol = 0' % (mt)) tdLog.info('select * from %s where tgcol = 0' % (mt))
tdSql.query('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt))
...@@ -321,7 +321,7 @@ class TDTestCase: ...@@ -321,7 +321,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(100)') tdLog.info('tdSql.checkRow(100)')
tdSql.checkRows(100) tdSql.checkRows(100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where tgcol <> 0 # TSIM: sql select * from $mt where tgcol <> 0
tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdLog.info('select * from %s where tgcol <> 0' % (mt))
tdSql.query('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt))
...@@ -329,7 +329,7 @@ class TDTestCase: ...@@ -329,7 +329,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(100)') tdLog.info('tdSql.checkRow(100)')
tdSql.checkRows(100) tdSql.checkRows(100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step5 # TSIM: print =============== step5
tdLog.info('=============== step5') tdLog.info('=============== step5')
...@@ -342,7 +342,7 @@ class TDTestCase: ...@@ -342,7 +342,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(75)') tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75) tdSql.checkRows(75)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
tdLog.info( tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' % 'select * from %s where ts > now + 4m and tgcol <> 1' %
...@@ -354,7 +354,7 @@ class TDTestCase: ...@@ -354,7 +354,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(75)') tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75) tdSql.checkRows(75)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
tdSql.query( tdSql.query(
...@@ -364,7 +364,7 @@ class TDTestCase: ...@@ -364,7 +364,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(25)') tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25) tdSql.checkRows(25)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
tdLog.info( tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' % 'select * from %s where ts < now + 4m and tgcol <> 0' %
...@@ -376,7 +376,7 @@ class TDTestCase: ...@@ -376,7 +376,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(25)') tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25) tdSql.checkRows(25)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
tdLog.info( tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' % 'select * from %s where ts <= now + 4m and tgcol = 0' %
...@@ -388,7 +388,7 @@ class TDTestCase: ...@@ -388,7 +388,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(25)') tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25) tdSql.checkRows(25)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
tdLog.info( tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' % 'select * from %s where ts <= now + 4m and tgcol <> 0' %
...@@ -400,7 +400,7 @@ class TDTestCase: ...@@ -400,7 +400,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(25)') tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25) tdSql.checkRows(25)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# tgcol <> 0 # tgcol <> 0
tdLog.info( tdLog.info(
...@@ -413,7 +413,7 @@ class TDTestCase: ...@@ -413,7 +413,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(5)') tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5) tdSql.checkRows(5)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m # < now + 5m
tdLog.info( tdLog.info(
...@@ -426,7 +426,7 @@ class TDTestCase: ...@@ -426,7 +426,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(5)') tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5) tdSql.checkRows(5)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step6 # TSIM: print =============== step6
tdLog.info('=============== step6') tdLog.info('=============== step6')
...@@ -444,7 +444,7 @@ class TDTestCase: ...@@ -444,7 +444,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 200)') tdLog.info('tdSql.checkData(0, 0, 200)')
tdSql.checkData(0, 0, 200) tdSql.checkData(0, 0, 200)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step7 # TSIM: print =============== step7
tdLog.info('=============== step7') tdLog.info('=============== step7')
...@@ -462,7 +462,7 @@ class TDTestCase: ...@@ -462,7 +462,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 100)') tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100) tdSql.checkData(0, 0, 100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step8 # TSIM: print =============== step8
tdLog.info('=============== step8') tdLog.info('=============== step8')
...@@ -480,7 +480,7 @@ class TDTestCase: ...@@ -480,7 +480,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 50)') tdLog.info('tdSql.checkData(0, 0, 50)')
tdSql.checkData(0, 0, 50) tdSql.checkData(0, 0, 50)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step9 # TSIM: print =============== step9
tdLog.info('=============== step9') tdLog.info('=============== step9')
...@@ -498,7 +498,7 @@ class TDTestCase: ...@@ -498,7 +498,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 100)') tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100) tdSql.checkData(0, 0, 100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step10 # TSIM: print =============== step10
tdLog.info('=============== step10') tdLog.info('=============== step10')
...@@ -517,7 +517,7 @@ class TDTestCase: ...@@ -517,7 +517,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 100)') tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100) tdSql.checkData(0, 0, 100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step11 # TSIM: print =============== step11
tdLog.info('=============== step11') tdLog.info('=============== step11')
...@@ -536,7 +536,7 @@ class TDTestCase: ...@@ -536,7 +536,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 25)') tdLog.info('tdSql.checkData(0, 0, 25)')
tdSql.checkData(0, 0, 25) tdSql.checkData(0, 0, 25)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: # TSIM:
# TSIM: print =============== step12 # TSIM: print =============== step12
...@@ -556,7 +556,7 @@ class TDTestCase: ...@@ -556,7 +556,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 1, 100)') tdLog.info('tdSql.checkData(0, 1, 100)')
tdSql.checkData(0, 1, 100) tdSql.checkData(0, 1, 100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== clear # TSIM: print =============== clear
tdLog.info('=============== clear') tdLog.info('=============== clear')
...@@ -570,7 +570,7 @@ class TDTestCase: ...@@ -570,7 +570,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(0)') tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0) tdSql.checkRows(0)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
# convert end # convert end
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -103,7 +103,7 @@ class TDTestCase: ...@@ -103,7 +103,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(4)') tdLog.info('tdSql.checkRow(4)')
tdSql.checkRows(4) tdSql.checkRows(4)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step3 # TSIM: print =============== step3
tdLog.info('=============== step3') tdLog.info('=============== step3')
...@@ -149,7 +149,7 @@ class TDTestCase: ...@@ -149,7 +149,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(1)') tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1) tdSql.checkRows(1)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step5 # TSIM: print =============== step5
tdLog.info('=============== step5') tdLog.info('=============== step5')
...@@ -160,7 +160,7 @@ class TDTestCase: ...@@ -160,7 +160,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(4)') tdLog.info('tdSql.checkRow(4)')
tdSql.checkRows(4) tdSql.checkRows(4)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select * from $mt where tgcol = 1 # TSIM: sql select * from $mt where tgcol = 1
tdLog.info('select * from %s where tgcol = 1' % (mt)) tdLog.info('select * from %s where tgcol = 1' % (mt))
...@@ -169,7 +169,7 @@ class TDTestCase: ...@@ -169,7 +169,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(1)') tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1) tdSql.checkRows(1)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== clear # TSIM: print =============== clear
tdLog.info('=============== clear') tdLog.info('=============== clear')
...@@ -183,7 +183,7 @@ class TDTestCase: ...@@ -183,7 +183,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(0)') tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0) tdSql.checkRows(0)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
# convert end # convert end
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -120,7 +120,7 @@ class TDTestCase: ...@@ -120,7 +120,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 100)') tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100) tdSql.checkData(0, 0, 100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where tg = '1' -x # max(tbcol), first(tbcol), last(tbcol) from $mt where tg = '1' -x
...@@ -162,12 +162,12 @@ class TDTestCase: ...@@ -162,12 +162,12 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(1)') tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1) tdSql.checkRows(1)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: if $data00 != 10 then # TSIM: if $data00 != 10 then
tdLog.info('tdSql.checkData(0, 0, 10)') tdLog.info('tdSql.checkData(0, 0, 10)')
tdSql.checkData(0, 0, 10) tdSql.checkData(0, 0, 10)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step5 # TSIM: print =============== step5
tdLog.info('=============== step5') tdLog.info('=============== step5')
...@@ -194,7 +194,7 @@ class TDTestCase: ...@@ -194,7 +194,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 200)') tdLog.info('tdSql.checkData(0, 0, 200)')
tdSql.checkData(0, 0, 200) tdSql.checkData(0, 0, 200)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step6 # TSIM: print =============== step6
tdLog.info('=============== step6') tdLog.info('=============== step6')
...@@ -263,7 +263,7 @@ class TDTestCase: ...@@ -263,7 +263,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 100)') tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100) tdSql.checkData(0, 0, 100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step11 # TSIM: print =============== step11
tdLog.info('=============== step11') tdLog.info('=============== step11')
...@@ -293,7 +293,7 @@ class TDTestCase: ...@@ -293,7 +293,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 100)') tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100) tdSql.checkData(0, 0, 100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step14 # TSIM: print =============== step14
tdLog.info('=============== step14') tdLog.info('=============== step14')
...@@ -313,7 +313,7 @@ class TDTestCase: ...@@ -313,7 +313,7 @@ class TDTestCase:
# TSIM: print expect 100, actual $data00 # TSIM: print expect 100, actual $data00
tdLog.info('expect 100, actual $data00') tdLog.info('expect 100, actual $data00')
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== step15 # TSIM: print =============== step15
tdLog.info('=============== step15') tdLog.info('=============== step15')
...@@ -344,7 +344,7 @@ class TDTestCase: ...@@ -344,7 +344,7 @@ class TDTestCase:
tdLog.info('tdSql.checkData(0, 0, 100)') tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100) tdSql.checkData(0, 0, 100)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: print =============== clear # TSIM: print =============== clear
tdLog.info('=============== clear') tdLog.info('=============== clear')
...@@ -358,7 +358,7 @@ class TDTestCase: ...@@ -358,7 +358,7 @@ class TDTestCase:
tdLog.info('tdSql.checkRow(0)') tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0) tdSql.checkRows(0)
# TSIM: return -1 # TSIM: return -1
#TSIM: endi # TSIM: endi
# TSIM: # TSIM:
# TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
# convert end # convert end
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -99,6 +99,19 @@ class TDDnode: ...@@ -99,6 +99,19 @@ class TDDnode:
def setValgrind(self, value): def setValgrind(self, value):
self.valgrind = value self.valgrind = value
def getDataSize(self):
totalSize = 0
if (self.deployed == 1):
for dirpath, dirnames, filenames in os.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
def deploy(self): def deploy(self):
self.logDir = "%s/pysim/dnode%d/log" % (self.path, self.index) self.logDir = "%s/pysim/dnode%d/log" % (self.path, self.index)
self.dataDir = "%s/pysim/dnode%d/data" % (self.path, self.index) self.dataDir = "%s/pysim/dnode%d/data" % (self.path, self.index)
...@@ -384,6 +397,10 @@ class TDDnodes: ...@@ -384,6 +397,10 @@ class TDDnodes:
self.check(index) self.check(index)
self.dnodes[index - 1].stop() self.dnodes[index - 1].stop()
def getDataSize(self, index):
self.check(index)
return self.dnodes[index - 1].getDataSize()
def forcestop(self, index): def forcestop(self, index):
self.check(index) self.check(index)
self.dnodes[index - 1].forcestop() self.dnodes[index - 1].forcestop()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册