tweaked crash_gen tool

This commit is contained in:
Steven Li 2020-07-26 06:04:02 +00:00
parent 519a002511
commit 032d93b59a
1 changed files with 34 additions and 25 deletions

View File

@ -1192,7 +1192,8 @@ class StateMechine:
# case of multiple creation and drops # case of multiple creation and drops
if self._curState.canDropDb(): if self._curState.canDropDb():
self._curState.assertIfExistThenSuccess(tasks, TaskDropDb) if gSvcMgr == None: # only if we are not restarting service
self._curState.assertIfExistThenSuccess(tasks, TaskDropDb)
# self.assertAtMostOneSuccess(tasks, DropDbTask) # not really in # self.assertAtMostOneSuccess(tasks, DropDbTask) # not really in
# case of drop-create-drop # case of drop-create-drop
@ -1366,33 +1367,35 @@ class TaskExecutor():
def __init__(self, size=10): def __init__(self, size=10):
self._size = size self._size = size
self._list = [] self._list = []
self._lock = threading.Lock()
def add(self, n: int): def add(self, n: int):
if not self._list: # empty with self._lock:
self._list.append(n) if not self._list: # empty
return self._list.append(n)
# now we should insert return
nItems = len(self._list) # now we should insert
insPos = 0 nItems = len(self._list)
for i in range(nItems): insPos = 0
insPos = i for i in range(nItems):
if n <= self._list[i]: # smaller than this item, time to insert insPos = i
break # found the insertion point if n <= self._list[i]: # smaller than this item, time to insert
insPos += 1 # insert to the right break # found the insertion point
insPos += 1 # insert to the right
if insPos == 0: # except for the 1st item, # TODO: elimiate first item as gating item if insPos == 0: # except for the 1st item, # TODO: elimiate first item as gating item
return # do nothing return # do nothing
# print("Inserting at postion {}, value: {}".format(insPos, n)) # print("Inserting at postion {}, value: {}".format(insPos, n))
self._list.insert(insPos, n) # insert self._list.insert(insPos, n) # insert
newLen = len(self._list) newLen = len(self._list)
if newLen <= self._size: if newLen <= self._size:
return # do nothing return # do nothing
elif newLen == (self._size + 1): elif newLen == (self._size + 1):
del self._list[0] # remove the first item del self._list[0] # remove the first item
else: else:
raise RuntimeError("Corrupt Bounded List") raise RuntimeError("Corrupt Bounded List")
def __str__(self): def __str__(self):
return repr(self._list) return repr(self._list)
@ -1497,6 +1500,9 @@ class Task():
return True return True
elif msg.find("duplicated column names") != -1: # also alter table tag issues elif msg.find("duplicated column names") != -1: # also alter table tag issues
return True return True
elif (gSvcMgr!=None) and gSvcMgr.isRestarting():
logger.info("Ignoring error when service is restarting: errno = {}, msg = {}".format(errno, msg))
return True
return False # Not an acceptable error return False # Not an acceptable error
@ -2196,7 +2202,7 @@ class SvcManager:
self.svcMgrThread = ServiceManagerThread() # create the object self.svcMgrThread = ServiceManagerThread() # create the object
self.svcMgrThread.start() self.svcMgrThread.start()
print("TAOS service started, printing out output...") print("Attempting to start TAOS service started, printing out output...")
self.svcMgrThread.procIpcBatch( self.svcMgrThread.procIpcBatch(
trimToTarget=10, trimToTarget=10,
forceOutput=True) # for printing 10 lines forceOutput=True) # for printing 10 lines
@ -2397,6 +2403,9 @@ class ServiceManagerThread:
if self._status == MainExec.STATUS_STARTING: # we are starting, let's see if we have started if self._status == MainExec.STATUS_STARTING: # we are starting, let's see if we have started
if line.find(self.TD_READY_MSG) != -1: # found if line.find(self.TD_READY_MSG) != -1: # found
logger.info("Waiting for the service to become FULLY READY")
time.sleep(1.0) # wait for the server to truly start. TODO: remove this
logger.info("Service is now FULLY READY")
self._status = MainExec.STATUS_RUNNING self._status = MainExec.STATUS_RUNNING
# Trim the queue if necessary: TODO: try this 1 out of 10 times # Trim the queue if necessary: TODO: try this 1 out of 10 times