fix delete_datafiles issue.

This commit is contained in:
Shuduo Sang 2020-06-08 18:32:21 +08:00
parent 414f9653c0
commit 49eeb2abdb
4 changed files with 34 additions and 19 deletions

View File

@ -205,7 +205,7 @@ class Test (Thread):
global written global written
dnodesDir = tdDnodes.getDnodesRootDir() dnodesDir = tdDnodes.getDnodesRootDir()
dataDir = dnodesDir + '/dnode1/*' dataDir = dnodesDir + '/dnode1/data/*'
deleteCmd = 'rm -rf %s' % dataDir deleteCmd = 'rm -rf %s' % dataDir
os.system(deleteCmd) os.system(deleteCmd)

View File

@ -208,7 +208,7 @@ class Test (threading.Thread):
global written global written
dnodesDir = tdDnodes.getDnodesRootDir() dnodesDir = tdDnodes.getDnodesRootDir()
dataDir = dnodesDir + '/dnode1/*' dataDir = dnodesDir + '/dnode1/data/*'
deleteCmd = 'rm -rf %s' % dataDir deleteCmd = 'rm -rf %s' % dataDir
os.system(deleteCmd) os.system(deleteCmd)

View File

@ -31,21 +31,26 @@ class TDTestCase:
tdSql.prepare() tdSql.prepare()
tdLog.info("===== step1 =====") tdLog.info("===== step1 =====")
tdSql.execute("create table stb0(ts timestamp, col1 int, col2 float) tags(tgcol int)") tdSql.execute(
"create table stb0(ts timestamp, col1 int, col2 float) tags(tgcol int)")
for i in range(tbNum): for i in range(tbNum):
tdSql.execute("create table tb%d using stb0 tags(%d)" % (i, i)) tdSql.execute("create table tb%d using stb0 tags(%d)" % (i, i))
for j in range(rowNum): for j in range(rowNum):
tdSql.execute("insert into tb%d values (now - %dm, %d, %d)" % (i, 1440 - j, j, j)) tdSql.execute(
"insert into tb%d values (now - %dm, %d, %d)" %
(i, 1440 - j, j, j))
time.sleep(0.1) time.sleep(0.1)
tdLog.info("===== step2 =====") tdLog.info("===== step2 =====")
tdSql.query("select count(*), count(col1), count(col2) from tb0 interval(1d)") tdSql.query(
"select count(*), count(col1), count(col2) from tb0 interval(1d)")
tdSql.checkData(0, 1, rowNum) tdSql.checkData(0, 1, rowNum)
tdSql.checkData(0, 2, rowNum) tdSql.checkData(0, 2, rowNum)
tdSql.checkData(0, 3, rowNum) tdSql.checkData(0, 3, rowNum)
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum) tdSql.checkRows(tbNum)
tdSql.execute("create table s0 as select count(*), count(col1), count(col2) from tb0 interval(1d)") tdSql.execute(
"create table s0 as select count(*), count(col1), count(col2) from tb0 interval(1d)")
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum + 1) tdSql.checkRows(tbNum + 1)
@ -67,7 +72,8 @@ class TDTestCase:
tdLog.info("===== step6 =====") tdLog.info("===== step6 =====")
time.sleep(0.1) time.sleep(0.1)
tdSql.execute("create table s0 as select count(*), count(col1), count(col2) from tb0 interval(1d)") tdSql.execute(
"create table s0 as select count(*), count(col1), count(col2) from tb0 interval(1d)")
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum + 1) tdSql.checkRows(tbNum + 1)
@ -81,14 +87,16 @@ class TDTestCase:
tdSql.checkData(0, 3, rowNum) tdSql.checkData(0, 3, rowNum)
tdLog.info("===== step8 =====") tdLog.info("===== step8 =====")
tdSql.query("select count(*), count(col1), count(col2) from stb0 interval(1d)") tdSql.query(
"select count(*), count(col1), count(col2) from stb0 interval(1d)")
tdSql.checkData(0, 1, rowNum * tbNum) tdSql.checkData(0, 1, rowNum * tbNum)
tdSql.checkData(0, 2, rowNum * tbNum) tdSql.checkData(0, 2, rowNum * tbNum)
tdSql.checkData(0, 3, rowNum * tbNum) tdSql.checkData(0, 3, rowNum * tbNum)
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum + 1) tdSql.checkRows(tbNum + 1)
tdSql.execute("create table s1 as select count(*), count(col1), count(col2) from stb0 interval(1d)") tdSql.execute(
"create table s1 as select count(*), count(col1), count(col2) from stb0 interval(1d)")
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum + 2) tdSql.checkRows(tbNum + 2)
@ -110,7 +118,8 @@ class TDTestCase:
tdSql.error("select * from s1") tdSql.error("select * from s1")
tdLog.info("===== step12 =====") tdLog.info("===== step12 =====")
tdSql.execute("create table s1 as select count(*), count(col1), count(col2) from stb0 interval(1d)") tdSql.execute(
"create table s1 as select count(*), count(col1), count(col2) from stb0 interval(1d)")
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum + 2) tdSql.checkRows(tbNum + 2)

View File

@ -24,7 +24,6 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql) tdSql.init(conn.cursor(), logSql)
def run(self): def run(self):
tbNum = 10 tbNum = 10
rowNum = 20 rowNum = 20
@ -33,11 +32,14 @@ class TDTestCase:
tdSql.prepare() tdSql.prepare()
tdLog.info("===== step1 =====") tdLog.info("===== step1 =====")
tdSql.execute("create table stb0(ts timestamp, col1 int, col2 float) tags(tgcol int)") tdSql.execute(
"create table stb0(ts timestamp, col1 int, col2 float) tags(tgcol int)")
for i in range(tbNum): for i in range(tbNum):
tdSql.execute("create table tb%d using stb0 tags(%d)" % (i, i)) tdSql.execute("create table tb%d using stb0 tags(%d)" % (i, i))
for j in range(rowNum): for j in range(rowNum):
tdSql.execute("insert into tb%d values (now - %dm, %d, %d)" % (i, 1440 - j, j, j)) tdSql.execute(
"insert into tb%d values (now - %dm, %d, %d)" %
(i, 1440 - j, j, j))
time.sleep(0.1) time.sleep(0.1)
tdLog.info("===== step2 =====") tdLog.info("===== step2 =====")
@ -45,7 +47,8 @@ class TDTestCase:
tdSql.checkData(0, 1, rowNum) tdSql.checkData(0, 1, rowNum)
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum) tdSql.checkRows(tbNum)
tdSql.execute("create table s0 as select count(col1) from tb0 interval(1d)") tdSql.execute(
"create table s0 as select count(col1) from tb0 interval(1d)")
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum + 1) tdSql.checkRows(tbNum + 1)
@ -63,7 +66,8 @@ class TDTestCase:
tdSql.error("select * from s0") tdSql.error("select * from s0")
tdLog.info("===== step6 =====") tdLog.info("===== step6 =====")
tdSql.execute("create table s0 as select count(*), count(col1), count(col2) from tb0 interval(1d)") tdSql.execute(
"create table s0 as select count(*), count(col1), count(col2) from tb0 interval(1d)")
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum + 1) tdSql.checkRows(tbNum + 1)
@ -75,13 +79,15 @@ class TDTestCase:
tdSql.checkData(0, 3, rowNum) tdSql.checkData(0, 3, rowNum)
tdLog.info("===== step8 =====") tdLog.info("===== step8 =====")
tdSql.query("select count(*), count(col1), count(col2) from stb0 interval(1d)") tdSql.query(
"select count(*), count(col1), count(col2) from stb0 interval(1d)")
tdSql.checkData(0, 1, totalNum) tdSql.checkData(0, 1, totalNum)
tdSql.checkData(0, 2, totalNum) tdSql.checkData(0, 2, totalNum)
tdSql.checkData(0, 3, totalNum) tdSql.checkData(0, 3, totalNum)
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum + 1) tdSql.checkRows(tbNum + 1)
tdSql.execute("create table s1 as select count(*), count(col1), count(col2) from stb0 interval(1d)") tdSql.execute(
"create table s1 as select count(*), count(col1), count(col2) from stb0 interval(1d)")
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum + 2) tdSql.checkRows(tbNum + 2)
@ -101,7 +107,8 @@ class TDTestCase:
tdSql.error("select * from s1") tdSql.error("select * from s1")
tdLog.info("===== step12 =====") tdLog.info("===== step12 =====")
tdSql.execute("create table s1 as select count(col1) from stb0 interval(1d)") tdSql.execute(
"create table s1 as select count(col1) from stb0 interval(1d)")
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(tbNum + 2) tdSql.checkRows(tbNum + 2)
@ -112,7 +119,6 @@ class TDTestCase:
#tdSql.checkData(0, 2, None) #tdSql.checkData(0, 2, None)
#tdSql.checkData(0, 3, None) #tdSql.checkData(0, 3, None)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)