Adjusted crash_gen tool to accommodate new default database called log
This commit is contained in:
parent
78b3d1f271
commit
061a2161ff
|
@ -643,7 +643,7 @@ class DbConn:
|
||||||
self.execute("use {}".format(dbName))
|
self.execute("use {}".format(dbName))
|
||||||
|
|
||||||
def hasDatabases(self):
|
def hasDatabases(self):
|
||||||
return self.query("show databases") > 0
|
return self.query("show databases") > 1 # We now have a "log" database by default
|
||||||
|
|
||||||
def hasTables(self):
|
def hasTables(self):
|
||||||
return self.query("show tables") > 0
|
return self.query("show tables") > 0
|
||||||
|
@ -850,6 +850,7 @@ class DbConnNative(DbConn):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Cannot execute database commands until connection is open")
|
"Cannot execute database commands until connection is open")
|
||||||
logger.debug("[SQL] Executing SQL: {}".format(sql))
|
logger.debug("[SQL] Executing SQL: {}".format(sql))
|
||||||
|
self._lastSql = sql
|
||||||
nRows = self._tdSql.execute(sql)
|
nRows = self._tdSql.execute(sql)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"[SQL] Execution Result, nRows = {}, SQL = {}".format(
|
"[SQL] Execution Result, nRows = {}, SQL = {}".format(
|
||||||
|
@ -861,6 +862,7 @@ class DbConnNative(DbConn):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Cannot query database until connection is open")
|
"Cannot query database until connection is open")
|
||||||
logger.debug("[SQL] Executing SQL: {}".format(sql))
|
logger.debug("[SQL] Executing SQL: {}".format(sql))
|
||||||
|
self._lastSql = sql
|
||||||
nRows = self._tdSql.query(sql)
|
nRows = self._tdSql.query(sql)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"[SQL] Query Result, nRows = {}, SQL = {}".format(
|
"[SQL] Query Result, nRows = {}, SQL = {}".format(
|
||||||
|
@ -1771,6 +1773,9 @@ class TdSuperTable:
|
||||||
def __init__(self, stName):
|
def __init__(self, stName):
|
||||||
self._stName = stName
|
self._stName = stName
|
||||||
|
|
||||||
|
def getName(self):
|
||||||
|
return self._stName
|
||||||
|
|
||||||
def create(self, dbc, cols: dict, tags: dict):
|
def create(self, dbc, cols: dict, tags: dict):
|
||||||
sql = "CREATE TABLE db.{} ({}) TAGS ({})".format(
|
sql = "CREATE TABLE db.{} ({}) TAGS ({})".format(
|
||||||
self._stName,
|
self._stName,
|
||||||
|
@ -1864,16 +1869,29 @@ class TaskReadData(StateTransitionTask):
|
||||||
wt.getDbConn().close()
|
wt.getDbConn().close()
|
||||||
wt.getDbConn().open()
|
wt.getDbConn().open()
|
||||||
|
|
||||||
for rTbName in sTable.getRegTables(wt.getDbConn()): # regular tables
|
dbc = wt.getDbConn()
|
||||||
aggExpr = Dice.choice(['*', 'count(*)', 'avg(speed)',
|
for rTbName in sTable.getRegTables(dbc): # regular tables
|
||||||
|
aggExpr = Dice.choice([
|
||||||
|
'*',
|
||||||
|
'count(*)',
|
||||||
|
'avg(speed)',
|
||||||
# 'twa(speed)', # TODO: this one REQUIRES a where statement, not reasonable
|
# 'twa(speed)', # TODO: this one REQUIRES a where statement, not reasonable
|
||||||
'sum(speed)', 'stddev(speed)',
|
'sum(speed)',
|
||||||
'min(speed)', 'max(speed)', 'first(speed)', 'last(speed)']) # TODO: add more from 'top'
|
'stddev(speed)',
|
||||||
|
'min(speed)',
|
||||||
|
'max(speed)',
|
||||||
|
'first(speed)',
|
||||||
|
'last(speed)']) # TODO: add more from 'top'
|
||||||
|
filterExpr = Dice.choice([ # TODO: add various kind of WHERE conditions
|
||||||
|
None
|
||||||
|
])
|
||||||
try:
|
try:
|
||||||
self.execWtSql(wt, "select {} from db.{}".format(aggExpr, rTbName))
|
dbc.execute("select {} from db.{}".format(aggExpr, rTbName))
|
||||||
|
if aggExpr not in ['stddev(speed)']: #TODO: STDDEV not valid for super tables?!
|
||||||
|
dbc.execute("select {} from db.{}".format(aggExpr, sTable.getName()))
|
||||||
except taos.error.ProgrammingError as err:
|
except taos.error.ProgrammingError as err:
|
||||||
errno2 = err.errno if (err.errno > 0) else 0x80000000 + err.errno
|
errno2 = err.errno if (err.errno > 0) else 0x80000000 + err.errno
|
||||||
logger.debug("[=] Read Failure: errno=0x{:X}, msg: {}, SQL: {}".format(errno2, err, wt.getDbConn().getLastSql()))
|
logger.debug("[=] Read Failure: errno=0x{:X}, msg: {}, SQL: {}".format(errno2, err, dbc.getLastSql()))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
class TaskDropSuperTable(StateTransitionTask):
|
class TaskDropSuperTable(StateTransitionTask):
|
||||||
|
@ -2204,8 +2222,8 @@ class SvcManager:
|
||||||
# print("Process: {}".format(proc.name()))
|
# print("Process: {}".format(proc.name()))
|
||||||
|
|
||||||
self.svcMgrThread = ServiceManagerThread() # create the object
|
self.svcMgrThread = ServiceManagerThread() # create the object
|
||||||
self.svcMgrThread.start()
|
|
||||||
print("Attempting to start TAOS service started, printing out output...")
|
print("Attempting to start TAOS service started, printing out output...")
|
||||||
|
self.svcMgrThread.start()
|
||||||
self.svcMgrThread.procIpcBatch(
|
self.svcMgrThread.procIpcBatch(
|
||||||
trimToTarget=10,
|
trimToTarget=10,
|
||||||
forceOutput=True) # for printing 10 lines
|
forceOutput=True) # for printing 10 lines
|
||||||
|
@ -2222,8 +2240,8 @@ class SvcManager:
|
||||||
if self.svcMgrThread.isStopped():
|
if self.svcMgrThread.isStopped():
|
||||||
self.svcMgrThread.procIpcBatch(outputLines) # one last time
|
self.svcMgrThread.procIpcBatch(outputLines) # one last time
|
||||||
self.svcMgrThread = None
|
self.svcMgrThread = None
|
||||||
print("----- End of TDengine Service Output -----\n")
|
print("End of TDengine Service Output")
|
||||||
print("SMT execution terminated")
|
print("----- TDengine Service (managed by SMT) is now terminated -----\n")
|
||||||
else:
|
else:
|
||||||
print("WARNING: SMT did not terminate as expected")
|
print("WARNING: SMT did not terminate as expected")
|
||||||
|
|
||||||
|
@ -2330,6 +2348,8 @@ class ServiceManagerThread:
|
||||||
self._status = MainExec.STATUS_STOPPING
|
self._status = MainExec.STATUS_STOPPING
|
||||||
retCode = self._tdeSubProcess.stop()
|
retCode = self._tdeSubProcess.stop()
|
||||||
print("Attempted to stop sub process, got return code: {}".format(retCode))
|
print("Attempted to stop sub process, got return code: {}".format(retCode))
|
||||||
|
if (retCode==-11): # SGV
|
||||||
|
logger.error("[[--ERROR--]]: TDengine service SEGV fault (check core file!)")
|
||||||
|
|
||||||
if self._tdeSubProcess.isRunning(): # still running
|
if self._tdeSubProcess.isRunning(): # still running
|
||||||
print("FAILED to stop sub process, it is still running... pid = {}".format(
|
print("FAILED to stop sub process, it is still running... pid = {}".format(
|
||||||
|
@ -2624,12 +2644,12 @@ class ClientManager:
|
||||||
def _printLastNumbers(self): # to verify data durability
|
def _printLastNumbers(self): # to verify data durability
|
||||||
dbManager = DbManager(resetDb=False)
|
dbManager = DbManager(resetDb=False)
|
||||||
dbc = dbManager.getDbConn()
|
dbc = dbManager.getDbConn()
|
||||||
if dbc.query("show databases") == 0: # no databae
|
if dbc.query("show databases") <= 1: # no database (we have a default called "log")
|
||||||
return
|
return
|
||||||
|
dbc.execute("use db")
|
||||||
if dbc.query("show tables") == 0: # no tables
|
if dbc.query("show tables") == 0: # no tables
|
||||||
return
|
return
|
||||||
|
|
||||||
dbc.execute("use db")
|
|
||||||
sTbName = dbManager.getFixedSuperTableName()
|
sTbName = dbManager.getFixedSuperTableName()
|
||||||
|
|
||||||
# get all regular tables
|
# get all regular tables
|
||||||
|
|
Loading…
Reference in New Issue