提交 4d122b7a 编写于 作者: S Steven Li

Adjusted crash_gen tool to re-connect after server restart disruption

上级 2b74699d
...@@ -163,6 +163,9 @@ class WorkerThread: ...@@ -163,6 +163,9 @@ class WorkerThread:
# Before we fetch the task and run it, let's ensure we properly "use" the database # Before we fetch the task and run it, let's ensure we properly "use" the database
try: try:
if (gConfig.per_thread_db_connection): # most likely TRUE
if not self._dbConn.isOpen: # might have been closed during server auto-restart
self._dbConn.open()
self.useDb() # might encounter exceptions. TODO: catch self.useDb() # might encounter exceptions. TODO: catch
except taos.error.ProgrammingError as err: except taos.error.ProgrammingError as err:
errno = Helper.convertErrno(err.errno) errno = Helper.convertErrno(err.errno)
...@@ -861,8 +864,7 @@ class DbConnNative(DbConn): ...@@ -861,8 +864,7 @@ class DbConnNative(DbConn):
def execute(self, sql): def execute(self, sql):
if (not self.isOpen): if (not self.isOpen):
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 self._lastSql = sql
nRows = self._tdSql.execute(sql) nRows = self._tdSql.execute(sql)
...@@ -2454,7 +2456,7 @@ class ServiceManagerThread: ...@@ -2454,7 +2456,7 @@ 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") logger.info("Waiting for the service to become FULLY READY")
time.sleep(5.0) # wait for the server to truly start. TODO: remove this time.sleep(1.0) # wait for the server to truly start. TODO: remove this
logger.info("Service is now FULLY READY") logger.info("Service is now FULLY READY")
self._status = MainExec.STATUS_RUNNING self._status = MainExec.STATUS_RUNNING
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册