Merge pull request #11876 from taosdata/feature/tq
enh(tmq): delayed task
This commit is contained in:
commit
7cc35bd84e
|
@ -48,7 +48,6 @@ int32_t init_env() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
taosSsleep(1);
|
|
||||||
|
|
||||||
pRes = taos_query(pConn, "use abc1");
|
pRes = taos_query(pConn, "use abc1");
|
||||||
if (taos_errno(pRes) != 0) {
|
if (taos_errno(pRes) != 0) {
|
||||||
|
|
|
@ -27,9 +27,6 @@ typedef void TAOS;
|
||||||
typedef void TAOS_STMT;
|
typedef void TAOS_STMT;
|
||||||
typedef void TAOS_RES;
|
typedef void TAOS_RES;
|
||||||
typedef void **TAOS_ROW;
|
typedef void **TAOS_ROW;
|
||||||
#if 0
|
|
||||||
typedef void TAOS_STREAM;
|
|
||||||
#endif
|
|
||||||
typedef void TAOS_SUB;
|
typedef void TAOS_SUB;
|
||||||
|
|
||||||
// Data type definition
|
// Data type definition
|
||||||
|
@ -196,12 +193,6 @@ DLL_EXPORT TAOS_RES *taos_consume(TAOS_SUB *tsub);
|
||||||
DLL_EXPORT void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress);
|
DLL_EXPORT void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
DLL_EXPORT TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sql, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row),
|
|
||||||
int64_t stime, void *param, void (*callback)(void *));
|
|
||||||
DLL_EXPORT void taos_close_stream(TAOS_STREAM *tstr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
|
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
|
||||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
|
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
|
||||||
|
|
||||||
|
@ -241,12 +232,8 @@ DLL_EXPORT const char *tmq_err2str(tmq_resp_err_t);
|
||||||
DLL_EXPORT tmq_resp_err_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list);
|
DLL_EXPORT tmq_resp_err_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list);
|
||||||
DLL_EXPORT tmq_resp_err_t tmq_unsubscribe(tmq_t *tmq);
|
DLL_EXPORT tmq_resp_err_t tmq_unsubscribe(tmq_t *tmq);
|
||||||
DLL_EXPORT tmq_resp_err_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics);
|
DLL_EXPORT tmq_resp_err_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics);
|
||||||
DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t blocking_time);
|
DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t wait_time);
|
||||||
DLL_EXPORT tmq_resp_err_t tmq_consumer_close(tmq_t *tmq);
|
DLL_EXPORT tmq_resp_err_t tmq_consumer_close(tmq_t *tmq);
|
||||||
#if 0
|
|
||||||
DLL_EXPORT tmq_resp_err_t tmq_assign(tmq_t* tmq, const tmq_topic_vgroup_list_t* vgroups);
|
|
||||||
DLL_EXPORT tmq_resp_err_t tmq_assignment(tmq_t* tmq, tmq_topic_vgroup_list_t** vgroups);
|
|
||||||
#endif
|
|
||||||
DLL_EXPORT tmq_resp_err_t tmq_commit(tmq_t *tmq, const tmq_topic_vgroup_list_t *offsets, int32_t async);
|
DLL_EXPORT tmq_resp_err_t tmq_commit(tmq_t *tmq, const tmq_topic_vgroup_list_t *offsets, int32_t async);
|
||||||
#if 0
|
#if 0
|
||||||
DLL_EXPORT tmq_resp_err_t tmq_commit_message(tmq_t* tmq, const tmq_message_t* tmqmessage, int32_t async);
|
DLL_EXPORT tmq_resp_err_t tmq_commit_message(tmq_t* tmq, const tmq_message_t* tmqmessage, int32_t async);
|
||||||
|
@ -273,7 +260,7 @@ DLL_EXPORT char *tmq_get_topic_name(TAOS_RES *res);
|
||||||
DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res);
|
DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res);
|
||||||
// TODO
|
// TODO
|
||||||
#if 0
|
#if 0
|
||||||
DLL_EXPORT char *tmq_get_block_table_name(TAOS_RES *res);
|
DLL_EXPORT char *tmq_get_table_name(TAOS_RES *res);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct tmq_conf_t {
|
||||||
int8_t autoCommit;
|
int8_t autoCommit;
|
||||||
int8_t resetOffset;
|
int8_t resetOffset;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
uint16_t autoCommitInterval;
|
int32_t autoCommitInterval;
|
||||||
char* ip;
|
char* ip;
|
||||||
char* user;
|
char* user;
|
||||||
char* pass;
|
char* pass;
|
||||||
|
@ -76,17 +76,25 @@ struct tmq_t {
|
||||||
char groupId[TSDB_CGROUP_LEN];
|
char groupId[TSDB_CGROUP_LEN];
|
||||||
char clientId[256];
|
char clientId[256];
|
||||||
int8_t autoCommit;
|
int8_t autoCommit;
|
||||||
int64_t consumerId;
|
int32_t autoCommitInterval;
|
||||||
int32_t resetOffsetCfg;
|
int32_t resetOffsetCfg;
|
||||||
|
int64_t consumerId;
|
||||||
tmq_commit_cb* commit_cb;
|
tmq_commit_cb* commit_cb;
|
||||||
|
|
||||||
// status
|
// status
|
||||||
int8_t status;
|
int8_t status;
|
||||||
int8_t epStatus;
|
|
||||||
int32_t epoch;
|
int32_t epoch;
|
||||||
|
#if 0
|
||||||
|
int8_t epStatus;
|
||||||
int32_t epSkipCnt;
|
int32_t epSkipCnt;
|
||||||
|
#endif
|
||||||
int64_t pollCnt;
|
int64_t pollCnt;
|
||||||
|
|
||||||
|
// timer
|
||||||
|
tmr_h hbTimer;
|
||||||
|
tmr_h reportTimer;
|
||||||
|
tmr_h commitTimer;
|
||||||
|
|
||||||
// connection
|
// connection
|
||||||
STscObj* pTscObj;
|
STscObj* pTscObj;
|
||||||
|
|
||||||
|
@ -111,6 +119,12 @@ enum {
|
||||||
TMQ_CONSUMER_STATUS__READY,
|
TMQ_CONSUMER_STATUS__READY,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
TMQ_DELAYED_TASK__HB = 1,
|
||||||
|
TMQ_DELAYED_TASK__REPORT,
|
||||||
|
TMQ_DELAYED_TASK__COMMIT,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// statistics
|
// statistics
|
||||||
int64_t pollCnt;
|
int64_t pollCnt;
|
||||||
|
@ -280,6 +294,50 @@ static int32_t tmqMakeTopicVgKey(char* dst, const char* topicName, int32_t vg) {
|
||||||
return sprintf(dst, "%s:%d", topicName, vg);
|
return sprintf(dst, "%s:%d", topicName, vg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tmqAssignDelayedHbTask(void* param, void* tmrId) {
|
||||||
|
tmq_t* tmq = (tmq_t*)param;
|
||||||
|
int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t));
|
||||||
|
*pTaskType = TMQ_DELAYED_TASK__HB;
|
||||||
|
taosWriteQitem(tmq->delayedTask, pTaskType);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tmqAssignDelayedCommitTask(void* param, void* tmrId) {
|
||||||
|
tmq_t* tmq = (tmq_t*)param;
|
||||||
|
int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t));
|
||||||
|
*pTaskType = TMQ_DELAYED_TASK__COMMIT;
|
||||||
|
taosWriteQitem(tmq->delayedTask, pTaskType);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tmqAssignDelayedReportTask(void* param, void* tmrId) {
|
||||||
|
tmq_t* tmq = (tmq_t*)param;
|
||||||
|
int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t));
|
||||||
|
*pTaskType = TMQ_DELAYED_TASK__REPORT;
|
||||||
|
taosWriteQitem(tmq->delayedTask, pTaskType);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tmqHandleAllDelayedTask(tmq_t* tmq) {
|
||||||
|
STaosQall* qall = taosAllocateQall();
|
||||||
|
taosReadAllQitems(tmq->delayedTask, qall);
|
||||||
|
while (1) {
|
||||||
|
int8_t* pTaskType = NULL;
|
||||||
|
taosGetQitem(qall, (void**)&pTaskType);
|
||||||
|
if (pTaskType == NULL) break;
|
||||||
|
|
||||||
|
if (*pTaskType == TMQ_DELAYED_TASK__HB) {
|
||||||
|
tmqAskEp(tmq, false);
|
||||||
|
taosTmrReset(tmqAssignDelayedHbTask, 1000, tmq, tmqMgmt.timer, &tmq->hbTimer);
|
||||||
|
} else if (*pTaskType == TMQ_DELAYED_TASK__COMMIT) {
|
||||||
|
tmq_commit(tmq, NULL, true);
|
||||||
|
taosTmrReset(tmqAssignDelayedCommitTask, tmq->autoCommitInterval, tmq, tmqMgmt.timer, &tmq->commitTimer);
|
||||||
|
} else if (*pTaskType == TMQ_DELAYED_TASK__REPORT) {
|
||||||
|
} else {
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taosFreeQall(qall);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void tmqClearUnhandleMsg(tmq_t* tmq) {
|
void tmqClearUnhandleMsg(tmq_t* tmq) {
|
||||||
SMqRspWrapper* msg = NULL;
|
SMqRspWrapper* msg = NULL;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -408,13 +466,15 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
|
||||||
pTmq->status = TMQ_CONSUMER_STATUS__INIT;
|
pTmq->status = TMQ_CONSUMER_STATUS__INIT;
|
||||||
pTmq->pollCnt = 0;
|
pTmq->pollCnt = 0;
|
||||||
pTmq->epoch = 0;
|
pTmq->epoch = 0;
|
||||||
pTmq->epStatus = 0;
|
/*pTmq->epStatus = 0;*/
|
||||||
pTmq->epSkipCnt = 0;
|
/*pTmq->epSkipCnt = 0;*/
|
||||||
|
|
||||||
// set conf
|
// set conf
|
||||||
strcpy(pTmq->clientId, conf->clientId);
|
strcpy(pTmq->clientId, conf->clientId);
|
||||||
strcpy(pTmq->groupId, conf->groupId);
|
strcpy(pTmq->groupId, conf->groupId);
|
||||||
pTmq->autoCommit = conf->autoCommit;
|
/*pTmq->autoCommit = conf->autoCommit;*/
|
||||||
|
pTmq->autoCommit = 0;
|
||||||
|
pTmq->autoCommitInterval = conf->autoCommitInterval;
|
||||||
pTmq->commit_cb = conf->commit_cb;
|
pTmq->commit_cb = conf->commit_cb;
|
||||||
pTmq->resetOffsetCfg = conf->resetOffset;
|
pTmq->resetOffsetCfg = conf->resetOffset;
|
||||||
|
|
||||||
|
@ -607,6 +667,14 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
|
||||||
taosMsleep(500);
|
taosMsleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// init hb timer
|
||||||
|
tmq->hbTimer = taosTmrStart(tmqAssignDelayedHbTask, 1000, tmq, tmqMgmt.timer);
|
||||||
|
|
||||||
|
// init auto commit timer
|
||||||
|
if (tmq->autoCommit) {
|
||||||
|
tmq->commitTimer = taosTmrStart(tmqAssignDelayedCommitTask, tmq->autoCommitInterval, tmq, tmqMgmt.timer);
|
||||||
|
}
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
FAIL:
|
FAIL:
|
||||||
if (req.topicNames != NULL) taosArrayDestroyP(req.topicNames, taosMemoryFree);
|
if (req.topicNames != NULL) taosArrayDestroyP(req.topicNames, taosMemoryFree);
|
||||||
|
@ -909,7 +977,7 @@ int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
END:
|
END:
|
||||||
atomic_store_8(&tmq->epStatus, 0);
|
/*atomic_store_8(&tmq->epStatus, 0);*/
|
||||||
if (pParam->sync) {
|
if (pParam->sync) {
|
||||||
tsem_post(&pParam->rspSem);
|
tsem_post(&pParam->rspSem);
|
||||||
}
|
}
|
||||||
|
@ -918,6 +986,7 @@ END:
|
||||||
|
|
||||||
int32_t tmqAskEp(tmq_t* tmq, bool sync) {
|
int32_t tmqAskEp(tmq_t* tmq, bool sync) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
#if 0
|
||||||
int8_t epStatus = atomic_val_compare_exchange_8(&tmq->epStatus, 0, 1);
|
int8_t epStatus = atomic_val_compare_exchange_8(&tmq->epStatus, 0, 1);
|
||||||
if (epStatus == 1) {
|
if (epStatus == 1) {
|
||||||
int32_t epSkipCnt = atomic_add_fetch_32(&tmq->epSkipCnt, 1);
|
int32_t epSkipCnt = atomic_add_fetch_32(&tmq->epSkipCnt, 1);
|
||||||
|
@ -925,11 +994,12 @@ int32_t tmqAskEp(tmq_t* tmq, bool sync) {
|
||||||
if (epSkipCnt < 5000) return 0;
|
if (epSkipCnt < 5000) return 0;
|
||||||
}
|
}
|
||||||
atomic_store_32(&tmq->epSkipCnt, 0);
|
atomic_store_32(&tmq->epSkipCnt, 0);
|
||||||
|
#endif
|
||||||
int32_t tlen = sizeof(SMqCMGetSubEpReq);
|
int32_t tlen = sizeof(SMqCMGetSubEpReq);
|
||||||
SMqCMGetSubEpReq* req = taosMemoryMalloc(tlen);
|
SMqCMGetSubEpReq* req = taosMemoryMalloc(tlen);
|
||||||
if (req == NULL) {
|
if (req == NULL) {
|
||||||
tscError("failed to malloc get subscribe ep buf");
|
tscError("failed to malloc get subscribe ep buf");
|
||||||
atomic_store_8(&tmq->epStatus, 0);
|
/*atomic_store_8(&tmq->epStatus, 0);*/
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
req->consumerId = htobe64(tmq->consumerId);
|
req->consumerId = htobe64(tmq->consumerId);
|
||||||
|
@ -940,7 +1010,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool sync) {
|
||||||
if (pParam == NULL) {
|
if (pParam == NULL) {
|
||||||
tscError("failed to malloc subscribe param");
|
tscError("failed to malloc subscribe param");
|
||||||
taosMemoryFree(req);
|
taosMemoryFree(req);
|
||||||
atomic_store_8(&tmq->epStatus, 0);
|
/*atomic_store_8(&tmq->epStatus, 0);*/
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pParam->tmq = tmq;
|
pParam->tmq = tmq;
|
||||||
|
@ -952,7 +1022,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool sync) {
|
||||||
tsem_destroy(&pParam->rspSem);
|
tsem_destroy(&pParam->rspSem);
|
||||||
taosMemoryFree(pParam);
|
taosMemoryFree(pParam);
|
||||||
taosMemoryFree(req);
|
taosMemoryFree(req);
|
||||||
atomic_store_8(&tmq->epStatus, 0);
|
/*atomic_store_8(&tmq->epStatus, 0);*/
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1216,7 +1286,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
tmqAskEp(tmq, false);
|
tmqHandleAllDelayedTask(tmq);
|
||||||
tmqPollImpl(tmq, blocking_time);
|
tmqPollImpl(tmq, blocking_time);
|
||||||
|
|
||||||
/*tsem_wait(&tmq->rspSem);*/
|
/*tsem_wait(&tmq->rspSem);*/
|
||||||
|
|
|
@ -61,7 +61,6 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
|
||||||
walBuildIdxName(pWal, walGetCurFileFirstVer(pWal), fnameStr);
|
walBuildIdxName(pWal, walGetCurFileFirstVer(pWal), fnameStr);
|
||||||
TdFilePtr pIdxTFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ);
|
TdFilePtr pIdxTFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ);
|
||||||
|
|
||||||
// TODO:change to deserialize function
|
|
||||||
if (pIdxTFile == NULL) {
|
if (pIdxTFile == NULL) {
|
||||||
taosThreadMutexUnlock(&pWal->mutex);
|
taosThreadMutexUnlock(&pWal->mutex);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -73,7 +72,6 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// read idx file and get log file pos
|
// read idx file and get log file pos
|
||||||
// TODO:change to deserialize function
|
|
||||||
SWalIdxEntry entry;
|
SWalIdxEntry entry;
|
||||||
if (taosReadFile(pIdxTFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) {
|
if (taosReadFile(pIdxTFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) {
|
||||||
taosThreadMutexUnlock(&pWal->mutex);
|
taosThreadMutexUnlock(&pWal->mutex);
|
||||||
|
@ -167,7 +165,7 @@ int32_t walEndSnapshot(SWal *pWal) {
|
||||||
char fnameStr[WAL_FILE_LEN];
|
char fnameStr[WAL_FILE_LEN];
|
||||||
// remove file
|
// remove file
|
||||||
for (int i = 0; i < deleteCnt; i++) {
|
for (int i = 0; i < deleteCnt; i++) {
|
||||||
SWalFileInfo *pInfo = taosArrayGet(pWal->fileInfoSet, i);
|
pInfo = taosArrayGet(pWal->fileInfoSet, i);
|
||||||
walBuildLogName(pWal, pInfo->firstVer, fnameStr);
|
walBuildLogName(pWal, pInfo->firstVer, fnameStr);
|
||||||
taosRemoveFile(fnameStr);
|
taosRemoveFile(fnameStr);
|
||||||
walBuildIdxName(pWal, pInfo->firstVer, fnameStr);
|
walBuildIdxName(pWal, pInfo->firstVer, fnameStr);
|
||||||
|
|
|
@ -39,11 +39,11 @@ void* taosLoadDll(const char* filename) {
|
||||||
#else
|
#else
|
||||||
void* handle = dlopen(filename, RTLD_LAZY);
|
void* handle = dlopen(filename, RTLD_LAZY);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
//printf("load dll:%s failed, error:%s", filename, dlerror());
|
// printf("load dll:%s failed, error:%s", filename, dlerror());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("dll %s loaded", filename);
|
// printf("dll %s loaded", filename);
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
#endif
|
#endif
|
||||||
|
@ -59,11 +59,11 @@ void* taosLoadSym(void* handle, char* name) {
|
||||||
char* error = NULL;
|
char* error = NULL;
|
||||||
|
|
||||||
if ((error = dlerror()) != NULL) {
|
if ((error = dlerror()) != NULL) {
|
||||||
//printf("load sym:%s failed, error:%s", name, dlerror());
|
// printf("load sym:%s failed, error:%s", name, dlerror());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("sym %s loaded", name);
|
// printf("sym %s loaded", name);
|
||||||
|
|
||||||
return sym;
|
return sym;
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,7 +100,7 @@ int taosSetConsoleEcho(bool on) {
|
||||||
struct termios term;
|
struct termios term;
|
||||||
|
|
||||||
if (tcgetattr(STDIN_FILENO, &term) == -1) {
|
if (tcgetattr(STDIN_FILENO, &term) == -1) {
|
||||||
perror("Cannot get the attribution of the terminal");
|
/*perror("Cannot get the attribution of the terminal");*/
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ int taosSetConsoleEcho(bool on) {
|
||||||
|
|
||||||
err = tcsetattr(STDIN_FILENO, TCSAFLUSH, &term);
|
err = tcsetattr(STDIN_FILENO, TCSAFLUSH, &term);
|
||||||
if (err == -1 || err == EINTR) {
|
if (err == -1 || err == EINTR) {
|
||||||
printf("Cannot set the attribution of the terminal");
|
/*printf("Cannot set the attribution of the terminal");*/
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ void taosResetTerminalMode() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TdCmdPtr taosOpenCmd(const char *cmd) {
|
TdCmdPtr taosOpenCmd(const char* cmd) {
|
||||||
if (cmd == NULL) return NULL;
|
if (cmd == NULL) return NULL;
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (TdCmdPtr)_popen(cmd, "r");
|
return (TdCmdPtr)_popen(cmd, "r");
|
||||||
|
@ -190,8 +190,8 @@ TdCmdPtr taosOpenCmd(const char *cmd) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t taosGetLineCmd(TdCmdPtr pCmd, char ** __restrict ptrBuf) {
|
int64_t taosGetLineCmd(TdCmdPtr pCmd, char** __restrict ptrBuf) {
|
||||||
if (pCmd == NULL || ptrBuf == NULL ) {
|
if (pCmd == NULL || ptrBuf == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (*ptrBuf != NULL) {
|
if (*ptrBuf != NULL) {
|
||||||
|
@ -219,7 +219,7 @@ int32_t taosEOFCmd(TdCmdPtr pCmd) {
|
||||||
return feof((FILE*)pCmd);
|
return feof((FILE*)pCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t taosCloseCmd(TdCmdPtr *ppCmd) {
|
int64_t taosCloseCmd(TdCmdPtr* ppCmd) {
|
||||||
if (ppCmd == NULL || *ppCmd == NULL) {
|
if (ppCmd == NULL || *ppCmd == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ $rowsPerCtb = 10
|
||||||
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
|
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
|
||||||
#---- global parameters end ----#
|
#---- global parameters end ----#
|
||||||
|
|
||||||
$pullDelay = 5
|
$pullDelay = 3
|
||||||
$ifcheckdata = 1
|
$ifcheckdata = 1
|
||||||
$showMsg = 1
|
$showMsg = 1
|
||||||
$showRow = 0
|
$showRow = 0
|
||||||
|
|
|
@ -25,7 +25,7 @@ $rowsPerCtb = 10
|
||||||
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
|
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
|
||||||
#---- global parameters end ----#
|
#---- global parameters end ----#
|
||||||
|
|
||||||
$pullDelay = 5
|
$pullDelay = 3
|
||||||
$ifcheckdata = 1
|
$ifcheckdata = 1
|
||||||
$showMsg = 1
|
$showMsg = 1
|
||||||
$showRow = 0
|
$showRow = 0
|
||||||
|
|
|
@ -25,7 +25,7 @@ $rowsPerCtb = 10
|
||||||
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
|
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
|
||||||
#---- global parameters end ----#
|
#---- global parameters end ----#
|
||||||
|
|
||||||
$pullDelay = 5
|
$pullDelay = 3
|
||||||
$ifcheckdata = 1
|
$ifcheckdata = 1
|
||||||
$showMsg = 1
|
$showMsg = 1
|
||||||
$showRow = 0
|
$showRow = 0
|
||||||
|
|
|
@ -25,7 +25,7 @@ $rowsPerCtb = 10
|
||||||
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
|
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
|
||||||
#---- global parameters end ----#
|
#---- global parameters end ----#
|
||||||
|
|
||||||
$pullDelay = 5
|
$pullDelay = 3
|
||||||
$ifcheckdata = 1
|
$ifcheckdata = 1
|
||||||
$showMsg = 1
|
$showMsg = 1
|
||||||
$showRow = 0
|
$showRow = 0
|
||||||
|
|
Loading…
Reference in New Issue