Merge pull request #20958 from taosdata/fix/TD-18844-MAIN
fix: duplicate calling shellWriteHistory
This commit is contained in:
commit
cc27a8f86b
|
@ -225,6 +225,9 @@ DLL_EXPORT int taos_get_tables_vgId(TAOS *taos, const char *db, const char *tabl
|
|||
|
||||
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
|
||||
|
||||
// set heart beat thread quit mode , if quicByKill 1 then kill thread else quit from inner
|
||||
DLL_EXPORT void taos_set_hb_quit(int8_t quitByKill);
|
||||
|
||||
/* --------------------------schemaless INTERFACE------------------------------- */
|
||||
|
||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
|
||||
|
|
|
@ -80,6 +80,7 @@ typedef struct {
|
|||
int64_t appId;
|
||||
// ctl
|
||||
int8_t threadStop;
|
||||
int8_t quitByKill;
|
||||
TdThread thread;
|
||||
TdThreadMutex lock; // used when app init and cleanup
|
||||
SHashObj* appSummary;
|
||||
|
|
|
@ -845,7 +845,12 @@ static void hbStopThread() {
|
|||
return;
|
||||
}
|
||||
|
||||
taosThreadJoin(clientHbMgr.thread, NULL);
|
||||
// thread quit mode kill or inner exit from self-thread
|
||||
if (clientHbMgr.quitByKill) {
|
||||
taosThreadKill(clientHbMgr.thread, 0);
|
||||
} else {
|
||||
taosThreadJoin(clientHbMgr.thread, NULL);
|
||||
}
|
||||
|
||||
tscDebug("hb thread stopped");
|
||||
}
|
||||
|
@ -1037,3 +1042,8 @@ void hbDeregisterConn(SAppHbMgr *pAppHbMgr, SClientHbKey connKey) {
|
|||
|
||||
atomic_sub_fetch_32(&pAppHbMgr->connKeyCnt, 1);
|
||||
}
|
||||
|
||||
// set heart beat thread quit mode , if quicByKill 1 then kill thread else quit from inner
|
||||
void taos_set_hb_quit(int8_t quitByKill) {
|
||||
clientHbMgr.quitByKill = quitByKill;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ int32_t shellRunSingleCommand(char *command) {
|
|||
}
|
||||
|
||||
if (shellRegexMatch(command, "^[ \t]*(quit|q|exit)[ \t;]*$", REG_EXTENDED | REG_ICASE)) {
|
||||
shellWriteHistory();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -887,7 +886,6 @@ void shellWriteHistory() {
|
|||
}
|
||||
i = (i + 1) % SHELL_MAX_HISTORY_SIZE;
|
||||
}
|
||||
taosFsyncFile(pFile);
|
||||
taosCloseFile(&pFile);
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,9 @@ int main(int argc, char *argv[]) {
|
|||
#endif
|
||||
taos_init();
|
||||
|
||||
// kill heart-beat thread when quit
|
||||
taos_set_hb_quit(1);
|
||||
|
||||
if (shell.args.is_dump_config) {
|
||||
shellDumpConfig();
|
||||
taos_cleanup();
|
||||
|
|
Loading…
Reference in New Issue