Merge branch 'main' into enh/TD-22404-M
This commit is contained in:
commit
7f6fdd4b6b
|
@ -2,7 +2,7 @@
|
|||
IF (DEFINED VERNUMBER)
|
||||
SET(TD_VER_NUMBER ${VERNUMBER})
|
||||
ELSE ()
|
||||
SET(TD_VER_NUMBER "3.0.3.1")
|
||||
SET(TD_VER_NUMBER "3.0.3.2")
|
||||
ENDIF ()
|
||||
|
||||
IF (DEFINED VERCOMPATIBLE)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taos-tools
|
||||
ExternalProject_Add(taos-tools
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||
GIT_TAG 273a3fe
|
||||
GIT_TAG 63635fc
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -208,15 +208,12 @@ typedef struct SSDataBlock {
|
|||
} SSDataBlock;
|
||||
|
||||
enum {
|
||||
FETCH_TYPE__DATA = 1,
|
||||
FETCH_TYPE__META,
|
||||
FETCH_TYPE__SEP,
|
||||
FETCH_TYPE__DATA = 0,
|
||||
FETCH_TYPE__NONE,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int8_t fetchType;
|
||||
STqOffsetVal offset;
|
||||
union {
|
||||
SSDataBlock data;
|
||||
void* meta;
|
||||
|
|
|
@ -127,24 +127,24 @@
|
|||
#define TK_NK_EQ 109
|
||||
#define TK_USING 110
|
||||
#define TK_TAGS 111
|
||||
#define TK_COMMENT 112
|
||||
#define TK_BOOL 113
|
||||
#define TK_TINYINT 114
|
||||
#define TK_SMALLINT 115
|
||||
#define TK_INT 116
|
||||
#define TK_INTEGER 117
|
||||
#define TK_BIGINT 118
|
||||
#define TK_FLOAT 119
|
||||
#define TK_DOUBLE 120
|
||||
#define TK_BINARY 121
|
||||
#define TK_NCHAR 122
|
||||
#define TK_UNSIGNED 123
|
||||
#define TK_JSON 124
|
||||
#define TK_VARCHAR 125
|
||||
#define TK_MEDIUMBLOB 126
|
||||
#define TK_BLOB 127
|
||||
#define TK_VARBINARY 128
|
||||
#define TK_DECIMAL 129
|
||||
#define TK_BOOL 112
|
||||
#define TK_TINYINT 113
|
||||
#define TK_SMALLINT 114
|
||||
#define TK_INT 115
|
||||
#define TK_INTEGER 116
|
||||
#define TK_BIGINT 117
|
||||
#define TK_FLOAT 118
|
||||
#define TK_DOUBLE 119
|
||||
#define TK_BINARY 120
|
||||
#define TK_NCHAR 121
|
||||
#define TK_UNSIGNED 122
|
||||
#define TK_JSON 123
|
||||
#define TK_VARCHAR 124
|
||||
#define TK_MEDIUMBLOB 125
|
||||
#define TK_BLOB 126
|
||||
#define TK_VARBINARY 127
|
||||
#define TK_DECIMAL 128
|
||||
#define TK_COMMENT 129
|
||||
#define TK_MAX_DELAY 130
|
||||
#define TK_WATERMARK 131
|
||||
#define TK_ROLLUP 132
|
||||
|
|
|
@ -198,12 +198,12 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
|
|||
//
|
||||
int32_t qStreamSetScanMemData(qTaskInfo_t tinfo, SPackedData submit);
|
||||
|
||||
int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset);
|
||||
void qStreamSetOpen(qTaskInfo_t tinfo);
|
||||
|
||||
void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset);
|
||||
|
||||
SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo);
|
||||
|
||||
int64_t qStreamExtractPrepareUid(qTaskInfo_t tinfo);
|
||||
|
||||
const SSchemaWrapper* qExtractSchemaFromTask(qTaskInfo_t tinfo);
|
||||
|
||||
const char* qExtractTbnameFromTask(qTaskInfo_t tinfo);
|
||||
|
|
|
@ -298,6 +298,7 @@ typedef struct SSelectStmt {
|
|||
bool hasUniqueFunc;
|
||||
bool hasTailFunc;
|
||||
bool hasInterpFunc;
|
||||
bool hasInterpPseudoColFunc;
|
||||
bool hasLastRowFunc;
|
||||
bool hasLastFunc;
|
||||
bool hasTimeLineFunc;
|
||||
|
|
|
@ -223,27 +223,12 @@ static FORCE_INLINE void* streamQueueCurItem(SStreamQueue* queue) {
|
|||
return queue->qItem;
|
||||
}
|
||||
|
||||
static FORCE_INLINE void* streamQueueNextItem(SStreamQueue* queue) {
|
||||
int8_t dequeueFlag = atomic_exchange_8(&queue->status, STREAM_QUEUE__PROCESSING);
|
||||
if (dequeueFlag == STREAM_QUEUE__FAILED) {
|
||||
ASSERT(queue->qItem != NULL);
|
||||
return streamQueueCurItem(queue);
|
||||
} else {
|
||||
queue->qItem = NULL;
|
||||
taosGetQitem(queue->qall, &queue->qItem);
|
||||
if (queue->qItem == NULL) {
|
||||
taosReadAllQitems(queue->queue, queue->qall);
|
||||
taosGetQitem(queue->qall, &queue->qItem);
|
||||
}
|
||||
return streamQueueCurItem(queue);
|
||||
}
|
||||
}
|
||||
void* streamQueueNextItem(SStreamQueue* queue);
|
||||
|
||||
SStreamDataSubmit2* streamDataSubmitNew(SPackedData submit);
|
||||
void streamDataSubmitDestroy(SStreamDataSubmit2* pDataSubmit);
|
||||
|
||||
void streamDataSubmitRefDec(SStreamDataSubmit2* pDataSubmit);
|
||||
|
||||
SStreamDataSubmit2* streamSubmitRefClone(SStreamDataSubmit2* pSubmit);
|
||||
SStreamDataSubmit2* streamSubmitBlockClone(SStreamDataSubmit2* pSubmit);
|
||||
|
||||
typedef struct {
|
||||
char* qmsg;
|
||||
|
@ -371,43 +356,7 @@ SStreamTask* tNewSStreamTask(int64_t streamId);
|
|||
int32_t tEncodeSStreamTask(SEncoder* pEncoder, const SStreamTask* pTask);
|
||||
int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask);
|
||||
void tFreeSStreamTask(SStreamTask* pTask);
|
||||
|
||||
static FORCE_INLINE int32_t streamTaskInput(SStreamTask* pTask, SStreamQueueItem* pItem) {
|
||||
int8_t type = pItem->type;
|
||||
if (type == STREAM_INPUT__DATA_SUBMIT) {
|
||||
SStreamDataSubmit2* pSubmitClone = streamSubmitRefClone((SStreamDataSubmit2*)pItem);
|
||||
if (pSubmitClone == NULL) {
|
||||
qDebug("task %d %p submit enqueue failed since out of memory", pTask->taskId, pTask);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__FAILED);
|
||||
return -1;
|
||||
}
|
||||
qDebug("task %d %p submit enqueue %p %p %p %d %" PRId64, pTask->taskId, pTask, pItem, pSubmitClone,
|
||||
pSubmitClone->submit.msgStr, pSubmitClone->submit.msgLen, pSubmitClone->submit.ver);
|
||||
taosWriteQitem(pTask->inputQueue->queue, pSubmitClone);
|
||||
// qStreamInput(pTask->exec.executor, pSubmitClone);
|
||||
} else if (type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__DATA_RETRIEVE ||
|
||||
type == STREAM_INPUT__REF_DATA_BLOCK) {
|
||||
taosWriteQitem(pTask->inputQueue->queue, pItem);
|
||||
// qStreamInput(pTask->exec.executor, pItem);
|
||||
} else if (type == STREAM_INPUT__CHECKPOINT) {
|
||||
taosWriteQitem(pTask->inputQueue->queue, pItem);
|
||||
// qStreamInput(pTask->exec.executor, pItem);
|
||||
} else if (type == STREAM_INPUT__GET_RES) {
|
||||
taosWriteQitem(pTask->inputQueue->queue, pItem);
|
||||
// qStreamInput(pTask->exec.executor, pItem);
|
||||
}
|
||||
|
||||
if (type != STREAM_INPUT__GET_RES && type != STREAM_INPUT__CHECKPOINT && pTask->triggerParam != 0) {
|
||||
atomic_val_compare_exchange_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__INACTIVE, TASK_TRIGGER_STATUS__ACTIVE);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TODO: back pressure
|
||||
atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__NORMAL);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
int32_t tAppendDataForStream(SStreamTask* pTask, SStreamQueueItem* pItem);
|
||||
|
||||
static FORCE_INLINE void streamTaskInputFail(SStreamTask* pTask) {
|
||||
atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__FAILED);
|
||||
|
|
|
@ -146,8 +146,8 @@ typedef struct {
|
|||
int64_t curFileFirstVer;
|
||||
int64_t curVersion;
|
||||
int64_t capacity;
|
||||
int8_t curInvalid;
|
||||
int8_t curStopped;
|
||||
// int8_t curInvalid;
|
||||
// int8_t curStopped;
|
||||
TdThreadMutex mutex;
|
||||
SWalFilterCond cond;
|
||||
// TODO remove it
|
||||
|
|
|
@ -31,21 +31,49 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
|
||||
#include "cus_name.h"
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
||||
#define TD_TMP_DIR_PATH "C:\\Windows\\Temp\\"
|
||||
#ifdef CUS_NAME
|
||||
#define TD_CFG_DIR_PATH "C:\\"CUS_NAME"\\cfg\\"
|
||||
#define TD_DATA_DIR_PATH "C:\\"CUS_NAME"\\data\\"
|
||||
#define TD_LOG_DIR_PATH "C:\\"CUS_NAME"\\log\\"
|
||||
#else
|
||||
#define TD_CFG_DIR_PATH "C:\\TDengine\\cfg\\"
|
||||
#define TD_DATA_DIR_PATH "C:\\TDengine\\data\\"
|
||||
#define TD_LOG_DIR_PATH "C:\\TDengine\\log\\"
|
||||
#endif // CUS_NAME
|
||||
|
||||
#elif defined(_TD_DARWIN_64)
|
||||
|
||||
#ifdef CUS_PROMPT
|
||||
#define TD_TMP_DIR_PATH "/tmp/"CUS_PROMPT"d/"
|
||||
#define TD_CFG_DIR_PATH "/etc/"CUS_PROMPT"/"
|
||||
#define TD_DATA_DIR_PATH "/var/lib/"CUS_PROMPT"/"
|
||||
#define TD_LOG_DIR_PATH "/var/log/"CUS_PROMPT"/"
|
||||
#else
|
||||
#define TD_TMP_DIR_PATH "/tmp/taosd/"
|
||||
#define TD_CFG_DIR_PATH "/etc/taos/"
|
||||
#define TD_DATA_DIR_PATH "/var/lib/taos/"
|
||||
#define TD_LOG_DIR_PATH "/var/log/taos/"
|
||||
#endif // CUS_PROMPT
|
||||
|
||||
#else
|
||||
|
||||
#define TD_TMP_DIR_PATH "/tmp/"
|
||||
#ifdef CUS_PROMPT
|
||||
#define TD_CFG_DIR_PATH "/etc/"CUS_PROMPT"/"
|
||||
#define TD_DATA_DIR_PATH "/var/lib/"CUS_PROMPT"/"
|
||||
#define TD_LOG_DIR_PATH "/var/log/"CUS_PROMPT"/"
|
||||
#else
|
||||
#define TD_CFG_DIR_PATH "/etc/taos/"
|
||||
#define TD_DATA_DIR_PATH "/var/lib/taos/"
|
||||
#define TD_LOG_DIR_PATH "/var/log/taos/"
|
||||
#endif // CUS_PROMPT
|
||||
#endif
|
||||
|
||||
typedef struct TdDir *TdDirPtr;
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _CUS_NAME_H_
|
||||
#define _CUS_NAME_H_
|
||||
|
||||
#ifndef CUS_NAME
|
||||
#define CUS_NAME "TDengine"
|
||||
#endif
|
||||
|
||||
#ifndef CUS_PROMPT
|
||||
#define CUS_PROMPT "taos"
|
||||
#endif
|
||||
|
||||
#ifndef CUS_EMAIL
|
||||
#define CUS_EMAIL "<support@taosdata.com>"
|
||||
#endif
|
||||
|
||||
#endif // _CUS_NAME_H_
|
|
@ -758,6 +758,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_TMQ_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x4000)
|
||||
#define TSDB_CODE_TMQ_CONSUMER_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x4001)
|
||||
#define TSDB_CODE_TMQ_CONSUMER_CLOSED TAOS_DEF_ERROR_CODE(0, 0x4002)
|
||||
#define TSDB_CODE_TMQ_CONSUMER_ERROR TAOS_DEF_ERROR_CODE(0, 0x4003)
|
||||
|
||||
// stream
|
||||
#define TSDB_CODE_STREAM_TASK_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x4100)
|
||||
|
|
|
@ -61,7 +61,7 @@ typedef void (*FItems)(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfItems);
|
|||
|
||||
typedef struct STaosQnode STaosQnode;
|
||||
|
||||
typedef struct STaosQnode {
|
||||
struct STaosQnode {
|
||||
STaosQnode *next;
|
||||
STaosQueue *queue;
|
||||
int64_t timestamp;
|
||||
|
@ -70,9 +70,9 @@ typedef struct STaosQnode {
|
|||
int8_t itype;
|
||||
int8_t reserved[3];
|
||||
char item[];
|
||||
} STaosQnode;
|
||||
};
|
||||
|
||||
typedef struct STaosQueue {
|
||||
struct STaosQueue {
|
||||
STaosQnode *head;
|
||||
STaosQnode *tail;
|
||||
STaosQueue *next; // for queue set
|
||||
|
@ -84,22 +84,22 @@ typedef struct STaosQueue {
|
|||
int64_t memOfItems;
|
||||
int32_t numOfItems;
|
||||
int64_t threadId;
|
||||
} STaosQueue;
|
||||
};
|
||||
|
||||
typedef struct STaosQset {
|
||||
struct STaosQset {
|
||||
STaosQueue *head;
|
||||
STaosQueue *current;
|
||||
TdThreadMutex mutex;
|
||||
tsem_t sem;
|
||||
int32_t numOfQueues;
|
||||
int32_t numOfItems;
|
||||
} STaosQset;
|
||||
};
|
||||
|
||||
typedef struct STaosQall {
|
||||
struct STaosQall {
|
||||
STaosQnode *current;
|
||||
STaosQnode *start;
|
||||
int32_t numOfItems;
|
||||
} STaosQall;
|
||||
};
|
||||
|
||||
STaosQueue *taosOpenQueue();
|
||||
void taosCloseQueue(STaosQueue *queue);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
########################################################
|
||||
# #
|
||||
# Configuration #
|
||||
# Any questions, please email support@taosdata.com #
|
||||
# #
|
||||
########################################################
|
||||
|
||||
|
@ -13,7 +12,7 @@
|
|||
|
||||
############### 1. Cluster End point ############################
|
||||
|
||||
# The end point of the first dnode in the cluster to be connected to when this dnode or a CLI `taos` is started
|
||||
# The end point of the first dnode in the cluster to be connected to when this dnode or the CLI utility is started
|
||||
# firstEp hostname:6030
|
||||
|
||||
# The end point of the second dnode to be connected to if the firstEp is not available
|
||||
|
@ -25,7 +24,7 @@
|
|||
# The FQDN of the host on which this dnode will be started. It can be IP address
|
||||
# fqdn hostname
|
||||
|
||||
# The port for external access after this dnode is started
|
||||
# The port for external access after this dnode is started
|
||||
# serverPort 6030
|
||||
|
||||
# The maximum number of connections a dnode can accept
|
||||
|
@ -96,7 +95,7 @@
|
|||
# if free disk space is less than this value, this dnode will fail to start
|
||||
# minimalDataDirGB 2.0
|
||||
|
||||
# enable/disable system monitor
|
||||
# enable/disable system monitor
|
||||
# monitor 1
|
||||
|
||||
# The following parameter is used to limit the maximum number of lines in log files.
|
||||
|
@ -114,8 +113,8 @@
|
|||
|
||||
# The following parameters are used for debug purpose only by this dnode.
|
||||
# debugFlag is a 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR
|
||||
# Available debug levels are:
|
||||
# 131: output warning and error
|
||||
# Available debug levels are:
|
||||
# 131: output warning and error
|
||||
# 135: output debug, warning and error
|
||||
# 143: output trace, debug, warning and error to log
|
||||
# 199: output debug, warning and error to both screen and file
|
||||
|
@ -130,7 +129,7 @@
|
|||
# debug flag for util
|
||||
# uDebugFlag 131
|
||||
|
||||
# debug flag for rpc
|
||||
# debug flag for rpc
|
||||
# rpcDebugFlag 131
|
||||
|
||||
# debug flag for jni
|
||||
|
@ -139,7 +138,7 @@
|
|||
# debug flag for query
|
||||
# qDebugFlag 131
|
||||
|
||||
# debug flag for taosc driver
|
||||
# debug flag for client driver
|
||||
# cDebugFlag 131
|
||||
|
||||
# debug flag for dnode messages
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[Unit]
|
||||
Description=TDengine server service
|
||||
Description=server service
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# is required to use systemd to manage services at boot
|
||||
|
||||
set -e
|
||||
#set -x
|
||||
# set -x
|
||||
|
||||
verMode=edge
|
||||
pagMode=full
|
||||
|
@ -34,21 +34,25 @@ benchmarkName="taosBenchmark"
|
|||
dumpName="taosdump"
|
||||
demoName="taosdemo"
|
||||
xname="taosx"
|
||||
explorerName="${clientName}-explorer"
|
||||
|
||||
clientName2="taos"
|
||||
serverName2="taosd"
|
||||
serverName2="${clientName2}d"
|
||||
configFile2="${clientName2}.cfg"
|
||||
productName2="TDengine"
|
||||
emailName2="taosdata.com"
|
||||
xname2="${clientName2}x"
|
||||
adapterName2="${clientName2}adapter"
|
||||
|
||||
explorerName="${clientName2}-explorer"
|
||||
benchmarkName2="${clientName2}Benchmark"
|
||||
demoName2="${clientName2}demo"
|
||||
dumpName2="${clientName2}dump"
|
||||
uninstallScript2="rm${clientName2}"
|
||||
|
||||
historyFile="${clientName2}_history"
|
||||
logDir="/var/log/${clientName2}"
|
||||
configDir="/etc/${clientName2}"
|
||||
installDir="/usr/local/${clientName}"
|
||||
installDir="/usr/local/${clientName2}"
|
||||
|
||||
data_dir=${dataDir}
|
||||
log_dir=${logDir}
|
||||
|
@ -206,15 +210,15 @@ function install_main_path() {
|
|||
|
||||
function install_bin() {
|
||||
# Remove links
|
||||
${csudo}rm -f ${bin_link_dir}/${clientName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${serverName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${clientName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${serverName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${udfdName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${adapterName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${uninstallScript} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${demoName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${benchmarkName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${dumpName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${xname} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${demoName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${dumpName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${xname2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${explorerName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/set_core || :
|
||||
${csudo}rm -f ${bin_link_dir}/TDinsight.sh || :
|
||||
|
@ -222,24 +226,23 @@ function install_bin() {
|
|||
${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
|
||||
|
||||
#Make link
|
||||
[ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || :
|
||||
[ -x ${install_main_dir}/bin/${serverName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${serverName} ${bin_link_dir}/${serverName} || :
|
||||
[ -x ${install_main_dir}/bin/${clientName2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${clientName2} ${bin_link_dir}/${clientName2} || :
|
||||
[ -x ${install_main_dir}/bin/${serverName2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${serverName2} ${bin_link_dir}/${serverName2} || :
|
||||
[ -x ${install_main_dir}/bin/${udfdName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${udfdName} ${bin_link_dir}/${udfdName} || :
|
||||
[ -x ${install_main_dir}/bin/${adapterName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${adapterName} ${bin_link_dir}/${adapterName} || :
|
||||
[ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${demoName} || :
|
||||
[ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName} || :
|
||||
[ -x ${install_main_dir}/bin/${dumpName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${dumpName} ${bin_link_dir}/${dumpName} || :
|
||||
[ -x ${install_main_dir}/bin/${xname} ] && ${csudo}ln -sf ${install_main_dir}/bin/${xname} ${bin_link_dir}/${xname} || :
|
||||
[ -x ${install_main_dir}/bin/${adapterName2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${adapterName2} ${bin_link_dir}/${adapterName2} || :
|
||||
[ -x ${install_main_dir}/bin/${benchmarkName2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName2} ${bin_link_dir}/${demoName2} || :
|
||||
[ -x ${install_main_dir}/bin/${benchmarkName2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName2} ${bin_link_dir}/${benchmarkName2} || :
|
||||
[ -x ${install_main_dir}/bin/${dumpName2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${dumpName2} ${bin_link_dir}/${dumpName2} || :
|
||||
[ -x ${install_main_dir}/bin/${xname2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${xname2} ${bin_link_dir}/${xname2} || :
|
||||
[ -x ${install_main_dir}/bin/${explorerName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${explorerName} ${bin_link_dir}/${explorerName} || :
|
||||
[ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -sf ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || :
|
||||
[ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -sf ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || :
|
||||
[ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -sf ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
|
||||
if [ "$clientName2" == "${clientName}" ]; then
|
||||
[ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || :
|
||||
fi
|
||||
[ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
|
||||
|
||||
if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then
|
||||
[ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName2} || :
|
||||
[ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName2} || :
|
||||
[ -x ${install_main_dir}/bin/${dumpName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${dumpName} ${bin_link_dir}/${dumpName2} || :
|
||||
[ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -sf ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript2} || :
|
||||
[ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript2} || :
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -399,7 +402,7 @@ function set_hostname() {
|
|||
${csudo}sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network || :
|
||||
fi
|
||||
|
||||
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/${configFile}
|
||||
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/${configFile2}
|
||||
serverFqdn=$newHostname
|
||||
|
||||
if [[ -e /etc/hosts ]]; then
|
||||
|
@ -433,7 +436,7 @@ function set_ipAsFqdn() {
|
|||
echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}"
|
||||
localFqdn="127.0.0.1"
|
||||
# Write the local FQDN to configuration file
|
||||
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/${configFile}
|
||||
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/${configFile2}
|
||||
serverFqdn=$localFqdn
|
||||
echo
|
||||
return
|
||||
|
@ -455,7 +458,7 @@ function set_ipAsFqdn() {
|
|||
read -p "Please choose an IP from local IP list:" localFqdn
|
||||
else
|
||||
# Write the local FQDN to configuration file
|
||||
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/${configFile}
|
||||
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/${configFile2}
|
||||
serverFqdn=$localFqdn
|
||||
break
|
||||
fi
|
||||
|
@ -519,15 +522,15 @@ function install_adapter_config() {
|
|||
|
||||
function install_config() {
|
||||
|
||||
if [ ! -f "${cfg_install_dir}/${configFile}" ]; then
|
||||
if [ ! -f "${cfg_install_dir}/${configFile2}" ]; then
|
||||
${csudo}mkdir -p ${cfg_install_dir}
|
||||
[ -f ${script_dir}/cfg/${configFile} ] && ${csudo}cp ${script_dir}/cfg/${configFile} ${cfg_install_dir}
|
||||
[ -f ${script_dir}/cfg/${configFile2} ] && ${csudo}cp ${script_dir}/cfg/${configFile2} ${cfg_install_dir}
|
||||
${csudo}chmod 644 ${cfg_install_dir}/*
|
||||
else
|
||||
${csudo}cp -f ${script_dir}/cfg/${configFile} ${cfg_install_dir}/${configFile}.new
|
||||
${csudo}cp -f ${script_dir}/cfg/${configFile2} ${cfg_install_dir}/${configFile2}.new
|
||||
fi
|
||||
|
||||
${csudo}ln -sf ${cfg_install_dir}/${configFile} ${install_main_dir}/cfg
|
||||
${csudo}ln -sf ${cfg_install_dir}/${configFile2} ${install_main_dir}/cfg
|
||||
|
||||
[ ! -z $1 ] && return 0 || : # only install client
|
||||
|
||||
|
@ -548,7 +551,7 @@ function install_config() {
|
|||
read firstEp
|
||||
while true; do
|
||||
if [ ! -z "$firstEp" ]; then
|
||||
${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/${configFile}
|
||||
${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/${configFile2}
|
||||
break
|
||||
else
|
||||
break
|
||||
|
@ -600,8 +603,8 @@ function install_web() {
|
|||
|
||||
|
||||
function clean_service_on_sysvinit() {
|
||||
if ps aux | grep -v grep | grep ${serverName} &>/dev/null; then
|
||||
${csudo}service ${serverName} stop || :
|
||||
if ps aux | grep -v grep | grep ${serverName2} &>/dev/null; then
|
||||
${csudo}service ${serverName2} stop || :
|
||||
fi
|
||||
|
||||
if ps aux | grep -v grep | grep tarbitrator &>/dev/null; then
|
||||
|
@ -609,30 +612,30 @@ function clean_service_on_sysvinit() {
|
|||
fi
|
||||
|
||||
if ((${initd_mod} == 1)); then
|
||||
if [ -e ${service_config_dir}/${serverName} ]; then
|
||||
${csudo}chkconfig --del ${serverName} || :
|
||||
if [ -e ${service_config_dir}/${serverName2} ]; then
|
||||
${csudo}chkconfig --del ${serverName2} || :
|
||||
fi
|
||||
|
||||
if [ -e ${service_config_dir}/tarbitratord ]; then
|
||||
${csudo}chkconfig --del tarbitratord || :
|
||||
fi
|
||||
elif ((${initd_mod} == 2)); then
|
||||
if [ -e ${service_config_dir}/${serverName} ]; then
|
||||
${csudo}insserv -r ${serverName} || :
|
||||
if [ -e ${service_config_dir}/${serverName2} ]; then
|
||||
${csudo}insserv -r ${serverName2} || :
|
||||
fi
|
||||
if [ -e ${service_config_dir}/tarbitratord ]; then
|
||||
${csudo}insserv -r tarbitratord || :
|
||||
fi
|
||||
elif ((${initd_mod} == 3)); then
|
||||
if [ -e ${service_config_dir}/${serverName} ]; then
|
||||
${csudo}update-rc.d -f ${serverName} remove || :
|
||||
if [ -e ${service_config_dir}/${serverName2} ]; then
|
||||
${csudo}update-rc.d -f ${serverName2} remove || :
|
||||
fi
|
||||
if [ -e ${service_config_dir}/tarbitratord ]; then
|
||||
${csudo}update-rc.d -f tarbitratord remove || :
|
||||
fi
|
||||
fi
|
||||
|
||||
${csudo}rm -f ${service_config_dir}/${serverName} || :
|
||||
${csudo}rm -f ${service_config_dir}/${serverName2} || :
|
||||
${csudo}rm -f ${service_config_dir}/tarbitratord || :
|
||||
|
||||
if $(which init &>/dev/null); then
|
||||
|
@ -653,24 +656,24 @@ function install_service_on_sysvinit() {
|
|||
fi
|
||||
|
||||
if ((${initd_mod} == 1)); then
|
||||
${csudo}chkconfig --add ${serverName} || :
|
||||
${csudo}chkconfig --level 2345 ${serverName} on || :
|
||||
${csudo}chkconfig --add ${serverName2} || :
|
||||
${csudo}chkconfig --level 2345 ${serverName2} on || :
|
||||
elif ((${initd_mod} == 2)); then
|
||||
${csudo}insserv ${serverName} || :
|
||||
${csudo}insserv -d ${serverName} || :
|
||||
${csudo}insserv ${serverName2} || :
|
||||
${csudo}insserv -d ${serverName2} || :
|
||||
elif ((${initd_mod} == 3)); then
|
||||
${csudo}update-rc.d ${serverName} defaults || :
|
||||
${csudo}update-rc.d ${serverName2} defaults || :
|
||||
fi
|
||||
}
|
||||
|
||||
function clean_service_on_systemd() {
|
||||
taosd_service_config="${service_config_dir}/${serverName}.service"
|
||||
if systemctl is-active --quiet ${serverName}; then
|
||||
service_config="${service_config_dir}/${serverName2}.service"
|
||||
if systemctl is-active --quiet ${serverName2}; then
|
||||
echo "${productName} is running, stopping it..."
|
||||
${csudo}systemctl stop ${serverName} &>/dev/null || echo &>/dev/null
|
||||
${csudo}systemctl stop ${serverName2} &>/dev/null || echo &>/dev/null
|
||||
fi
|
||||
${csudo}systemctl disable ${serverName} &>/dev/null || echo &>/dev/null
|
||||
${csudo}rm -f ${taosd_service_config}
|
||||
${csudo}systemctl disable ${serverName2} &>/dev/null || echo &>/dev/null
|
||||
${csudo}rm -f ${service_config}
|
||||
|
||||
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
|
||||
if systemctl is-active --quiet tarbitratord; then
|
||||
|
@ -687,19 +690,19 @@ function clean_service_on_systemd() {
|
|||
function install_service_on_systemd() {
|
||||
clean_service_on_systemd
|
||||
|
||||
[ -f ${script_dir}/cfg/${serverName}.service ] &&
|
||||
${csudo}cp ${script_dir}/cfg/${serverName}.service \
|
||||
[ -f ${script_dir}/cfg/${serverName2}.service ] &&
|
||||
${csudo}cp ${script_dir}/cfg/${serverName2}.service \
|
||||
${service_config_dir}/ || :
|
||||
|
||||
# if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then
|
||||
# [ -f ${script_dir}/cfg/${serverName}.service ] &&
|
||||
# ${csudo}cp ${script_dir}/cfg/${serverName}.service \
|
||||
# [ -f ${script_dir}/cfg/${serverName2}.service ] &&
|
||||
# ${csudo}cp ${script_dir}/cfg/${serverName2}.service \
|
||||
# ${service_config_dir}/${serverName2}.service || :
|
||||
# fi
|
||||
|
||||
${csudo}systemctl daemon-reload
|
||||
|
||||
${csudo}systemctl enable ${serverName}
|
||||
${csudo}systemctl enable ${serverName2}
|
||||
|
||||
${csudo}systemctl daemon-reload
|
||||
}
|
||||
|
@ -719,7 +722,7 @@ function install_service() {
|
|||
elif ((${service_mod} == 1)); then
|
||||
install_service_on_sysvinit
|
||||
else
|
||||
kill_process ${serverName}
|
||||
kill_process ${serverName2}
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -756,10 +759,10 @@ function is_version_compatible() {
|
|||
if [ -f ${script_dir}/driver/vercomp.txt ]; then
|
||||
min_compatible_version=$(cat ${script_dir}/driver/vercomp.txt)
|
||||
else
|
||||
min_compatible_version=$(${script_dir}/bin/${serverName} -V | head -1 | cut -d ' ' -f 5)
|
||||
min_compatible_version=$(${script_dir}/bin/${serverName2} -V | head -1 | cut -d ' ' -f 5)
|
||||
fi
|
||||
|
||||
exist_version=$(${installDir}/bin/${serverName} -V | head -1 | cut -d ' ' -f 3)
|
||||
exist_version=$(${installDir}/bin/${serverName2} -V | head -1 | cut -d ' ' -f 3)
|
||||
vercomp $exist_version "3.0.0.0"
|
||||
case $? in
|
||||
2)
|
||||
|
@ -829,13 +832,13 @@ function updateProduct() {
|
|||
|
||||
echo -e "${GREEN}Start to update ${productName2}...${NC}"
|
||||
# Stop the service if running
|
||||
if ps aux | grep -v grep | grep ${serverName} &>/dev/null; then
|
||||
if ps aux | grep -v grep | grep ${serverName2} &>/dev/null; then
|
||||
if ((${service_mod} == 0)); then
|
||||
${csudo}systemctl stop ${serverName} || :
|
||||
${csudo}systemctl stop ${serverName2} || :
|
||||
elif ((${service_mod} == 1)); then
|
||||
${csudo}service ${serverName} stop || :
|
||||
${csudo}service ${serverName2} stop || :
|
||||
else
|
||||
kill_process ${serverName}
|
||||
kill_process ${serverName2}
|
||||
fi
|
||||
sleep 1
|
||||
fi
|
||||
|
@ -862,21 +865,21 @@ function updateProduct() {
|
|||
openresty_work=false
|
||||
|
||||
echo
|
||||
echo -e "${GREEN_DARK}To configure ${productName2} ${NC}: edit ${cfg_install_dir}/${configFile}"
|
||||
[ -f ${configDir}/taosadapter.toml ] && [ -f ${installDir}/bin/taosadapter ] && \
|
||||
echo -e "${GREEN_DARK}To configure ${clientName2} Adapter ${NC}: edit ${configDir}/taosadapter.toml"
|
||||
echo -e "${GREEN_DARK}To configure ${productName2} ${NC}: edit ${cfg_install_dir}/${configFile2}"
|
||||
[ -f ${configDir}/${clientName2}adapter.toml ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \
|
||||
echo -e "${GREEN_DARK}To configure ${clientName2} Adapter ${NC}: edit ${configDir}/${clientName2}adapter.toml"
|
||||
if ((${service_mod} == 0)); then
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}systemctl start ${serverName}${NC}"
|
||||
[ -f ${service_config_dir}/taosadapter.service ] && [ -f ${installDir}/bin/taosadapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: ${csudo}systemctl start taosadapter ${NC}"
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}systemctl start ${serverName2}${NC}"
|
||||
[ -f ${service_config_dir}/${clientName2}adapter.service ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: ${csudo}systemctl start ${clientName2}adapter ${NC}"
|
||||
elif ((${service_mod} == 1)); then
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}service ${serverName} start${NC}"
|
||||
[ -f ${service_config_dir}/taosadapter.service ] && [ -f ${installDir}/bin/taosadapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: ${csudo}service taosadapter start${NC}"
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}service ${serverName2} start${NC}"
|
||||
[ -f ${service_config_dir}/${clientName2}adapter.service ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: ${csudo}service ${clientName2}adapter start${NC}"
|
||||
else
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ./${serverName}${NC}"
|
||||
[ -f ${installDir}/bin/taosadapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: taosadapter &${NC}"
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ./${serverName2}${NC}"
|
||||
[ -f ${installDir}/bin/${clientName2}adapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: ${clientName2}adapter &${NC}"
|
||||
fi
|
||||
|
||||
if [ ${openresty_work} = 'true' ]; then
|
||||
|
@ -887,7 +890,7 @@ function updateProduct() {
|
|||
|
||||
if ((${prompt_force} == 1)); then
|
||||
echo ""
|
||||
echo -e "${RED}Please run '${serverName} --force-keep-file' at first time for the exist ${productName2} $exist_version!${NC}"
|
||||
echo -e "${RED}Please run '${serverName2} --force-keep-file' at first time for the exist ${productName2} $exist_version!${NC}"
|
||||
fi
|
||||
echo
|
||||
echo -e "\033[44;32;1m${productName2} is updated successfully!${NC}"
|
||||
|
@ -899,7 +902,7 @@ function updateProduct() {
|
|||
echo -e "\033[44;32;1m${productName2} client is updated successfully!${NC}"
|
||||
fi
|
||||
|
||||
rm -rf $(tar -tf ${tarName} | grep -v "^\./$")
|
||||
rm -rf $(tar -tf ${tarName} | grep -Ev "^\./$|^\/")
|
||||
}
|
||||
|
||||
function installProduct() {
|
||||
|
@ -944,21 +947,21 @@ function installProduct() {
|
|||
|
||||
# Ask if to start the service
|
||||
echo
|
||||
echo -e "${GREEN_DARK}To configure ${productName2} ${NC}: edit ${cfg_install_dir}/${configFile}"
|
||||
[ -f ${configDir}/taosadapter.toml ] && [ -f ${installDir}/bin/taosadapter ] && \
|
||||
echo -e "${GREEN_DARK}To configure ${clientName2} Adapter ${NC}: edit ${configDir}/taosadapter.toml"
|
||||
echo -e "${GREEN_DARK}To configure ${productName2} ${NC}: edit ${cfg_install_dir}/${configFile2}"
|
||||
[ -f ${configDir}/${clientName2}adapter.toml ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \
|
||||
echo -e "${GREEN_DARK}To configure ${clientName2} Adapter ${NC}: edit ${configDir}/${clientName2}adapter.toml"
|
||||
if ((${service_mod} == 0)); then
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}systemctl start ${serverName}${NC}"
|
||||
[ -f ${service_config_dir}/taosadapter.service ] && [ -f ${installDir}/bin/taosadapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: ${csudo}systemctl start taosadapter ${NC}"
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}systemctl start ${serverName2}${NC}"
|
||||
[ -f ${service_config_dir}/${clientName2}adapter.service ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: ${csudo}systemctl start ${clientName2}adapter ${NC}"
|
||||
elif ((${service_mod} == 1)); then
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}service ${serverName} start${NC}"
|
||||
[ -f ${service_config_dir}/taosadapter.service ] && [ -f ${installDir}/bin/taosadapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: ${csudo}service taosadapter start${NC}"
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}service ${serverName2} start${NC}"
|
||||
[ -f ${service_config_dir}/${clientName2}adapter.service ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: ${csudo}service ${clientName2}adapter start${NC}"
|
||||
else
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${serverName}${NC}"
|
||||
[ -f ${installDir}/bin/taosadapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: taosadapter &${NC}"
|
||||
echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${serverName2}${NC}"
|
||||
[ -f ${installDir}/bin/${clientName2}adapter ] && \
|
||||
echo -e "${GREEN_DARK}To start ${clientName2} Adapter ${NC}: ${clientName2}adapter &${NC}"
|
||||
fi
|
||||
|
||||
if [ ! -z "$firstEp" ]; then
|
||||
|
@ -991,7 +994,7 @@ function installProduct() {
|
|||
fi
|
||||
|
||||
touch ~/.${historyFile}
|
||||
rm -rf $(tar -tf ${tarName} | grep -v "^\./$")
|
||||
rm -rf $(tar -tf ${tarName} | grep -Ev "^\./$|^\/")
|
||||
}
|
||||
|
||||
## ==============================Main program starts from here============================
|
||||
|
@ -1002,7 +1005,7 @@ if [ "$verType" == "server" ]; then
|
|||
echo -e "\033[44;31;5mThe default data directory ${data_dir} contains old data of ${productName2} 2.x, please clear it before installing!\033[0m"
|
||||
else
|
||||
# Install server and client
|
||||
if [ -x ${bin_dir}/${serverName} ]; then
|
||||
if [ -x ${bin_dir}/${serverName2} ]; then
|
||||
update_flag=1
|
||||
updateProduct
|
||||
else
|
||||
|
@ -1012,7 +1015,7 @@ if [ "$verType" == "server" ]; then
|
|||
elif [ "$verType" == "client" ]; then
|
||||
interactiveFqdn=no
|
||||
# Only install client
|
||||
if [ -x ${bin_dir}/${clientName} ]; then
|
||||
if [ -x ${bin_dir}/${clientName2} ]; then
|
||||
update_flag=1
|
||||
updateProduct client
|
||||
else
|
||||
|
|
|
@ -23,9 +23,12 @@ clientName2="${12}"
|
|||
|
||||
productName="TDengine"
|
||||
clientName="taos"
|
||||
benchmarkName="taosBenchmark"
|
||||
configFile="taos.cfg"
|
||||
tarName="package.tar.gz"
|
||||
|
||||
benchmarkName2="${clientName2}Benchmark"
|
||||
|
||||
if [ "$osType" != "Darwin" ]; then
|
||||
script_dir="$(dirname $(readlink -f $0))"
|
||||
top_dir="$(readlink -f ${script_dir}/../..)"
|
||||
|
@ -53,11 +56,12 @@ fi
|
|||
|
||||
# Directories and files.
|
||||
|
||||
if [ "$verMode" == "cluster" ]; then
|
||||
sed -i 's/verMode=edge/verMode=cluster/g' ${script_dir}/remove_client.sh
|
||||
sed -i "s/clientName2=\"taos\"/clientName2=\"${clientName2}\"/g" ${script_dir}/remove_client.sh
|
||||
sed -i "s/productName2=\"TDengine\"/productName2=\"${productName2}\"/g" ${script_dir}/remove_client.sh
|
||||
fi
|
||||
#if [ "$verMode" == "cluster" ]; then
|
||||
# sed -i 's/verMode=edge/verMode=cluster/g' ${script_dir}/remove_client.sh
|
||||
# sed -i "s/clientName2=\"taos\"/clientName2=\"${clientName2}\"/g" ${script_dir}/remove_client.sh
|
||||
# sed -i "s/configFile2=\"taos\"/configFile2=\"${clientName2}\"/g" ${script_dir}/remove_client.sh
|
||||
# sed -i "s/productName2=\"TDengine\"/productName2=\"${productName2}\"/g" ${script_dir}/remove_client.sh
|
||||
#fi
|
||||
|
||||
if [ "$osType" != "Darwin" ]; then
|
||||
if [ "$pagMode" == "lite" ]; then
|
||||
|
@ -66,6 +70,7 @@ if [ "$osType" != "Darwin" ]; then
|
|||
${script_dir}/remove_client.sh"
|
||||
else
|
||||
bin_files="${build_dir}/bin/${clientName} \
|
||||
${build_dir}/bin/${benchmarkName} \
|
||||
${script_dir}/remove_client.sh \
|
||||
${script_dir}/set_core.sh \
|
||||
${script_dir}/get_client.sh"
|
||||
|
@ -153,6 +158,7 @@ if [ "$verMode" == "cluster" ]; then
|
|||
sed -i 's/verMode=edge/verMode=cluster/g' install_client_temp.sh
|
||||
sed -i "s/serverName2=\"taosd\"/serverName2=\"${serverName2}\"/g" install_client_temp.sh
|
||||
sed -i "s/clientName2=\"taos\"/clientName2=\"${clientName2}\"/g" install_client_temp.sh
|
||||
sed -i "s/configFile2=\"taos.cfg\"/configFile2=\"${clientName2}.cfg\"/g" install_client_temp.sh
|
||||
sed -i "s/productName2=\"TDengine\"/productName2=\"${productName2}\"/g" install_client_temp.sh
|
||||
sed -i "s/emailName2=\"taosdata.com\"/emailName2=\"${cusEmail2}\"/g" install_client_temp.sh
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ fi
|
|||
|
||||
if [ -d ${top_dir}/tools/taos-tools/packaging/deb ]; then
|
||||
cd ${top_dir}/tools/taos-tools/packaging/deb
|
||||
|
||||
|
||||
taostools_ver=$(git for-each-ref --sort=taggerdate --format '%(tag)' refs/tags|grep -v taos | tail -1)
|
||||
[ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0"
|
||||
[ -z "$taostools_ver" ] && taostools_ver="0.1.0"
|
||||
taostools_install_dir="${release_dir}/${clientName2}Tools-${taostools_ver}"
|
||||
|
||||
cd ${curr_dir}
|
||||
|
@ -96,7 +96,7 @@ else
|
|||
${taostools_bin_files} \
|
||||
${taosx_bin} \
|
||||
${explorer_bin_files} \
|
||||
${build_dir}/bin/taosadapter \
|
||||
${build_dir}/bin/${clientName}adapter \
|
||||
${build_dir}/bin/udfd \
|
||||
${script_dir}/remove.sh \
|
||||
${script_dir}/set_core.sh \
|
||||
|
@ -135,12 +135,12 @@ mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc
|
|||
|
||||
mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/${configFile} ${install_dir}/cfg/${configFile}
|
||||
|
||||
if [ -f "${compile_dir}/test/cfg/taosadapter.toml" ]; then
|
||||
cp ${compile_dir}/test/cfg/taosadapter.toml ${install_dir}/cfg || :
|
||||
if [ -f "${compile_dir}/test/cfg/${clientName}adapter.toml" ]; then
|
||||
cp ${compile_dir}/test/cfg/${clientName}adapter.toml ${install_dir}/cfg || :
|
||||
fi
|
||||
|
||||
if [ -f "${compile_dir}/test/cfg/taosadapter.service" ]; then
|
||||
cp ${compile_dir}/test/cfg/taosadapter.service ${install_dir}/cfg || :
|
||||
if [ -f "${compile_dir}/test/cfg/${clientName}adapter.service" ]; then
|
||||
cp ${compile_dir}/test/cfg/${clientName}adapter.service ${install_dir}/cfg || :
|
||||
fi
|
||||
|
||||
if [ -f "${cfg_dir}/${serverName}.service" ]; then
|
||||
|
@ -152,16 +152,16 @@ mkdir -p ${install_dir}/init.d && cp ${init_file_deb} ${install_dir}/init.d/${se
|
|||
mkdir -p ${install_dir}/init.d && cp ${init_file_rpm} ${install_dir}/init.d/${serverName}.rpm
|
||||
|
||||
if [ $adapterName != "taosadapter" ]; then
|
||||
mv ${install_dir}/cfg/taosadapter.toml ${install_dir}/cfg/$adapterName.toml
|
||||
mv ${install_dir}/cfg/${clientName2}adapter.toml ${install_dir}/cfg/$adapterName.toml
|
||||
sed -i "s/path = \"\/var\/log\/taos\"/path = \"\/var\/log\/${productName}\"/g" ${install_dir}/cfg/$adapterName.toml
|
||||
sed -i "s/password = \"taosdata\"/password = \"${defaultPasswd}\"/g" ${install_dir}/cfg/$adapterName.toml
|
||||
|
||||
mv ${install_dir}/cfg/taosadapter.service ${install_dir}/cfg/$adapterName.service
|
||||
mv ${install_dir}/cfg/${clientName2}adapter.service ${install_dir}/cfg/$adapterName.service
|
||||
sed -i "s/TDengine/${productName}/g" ${install_dir}/cfg/$adapterName.service
|
||||
sed -i "s/taosAdapter/${adapterName}/g" ${install_dir}/cfg/$adapterName.service
|
||||
sed -i "s/taosadapter/${adapterName}/g" ${install_dir}/cfg/$adapterName.service
|
||||
|
||||
mv ${install_dir}/bin/taosadapter ${install_dir}/bin/${adapterName}
|
||||
mv ${install_dir}/bin/${clientName2}adapter ${install_dir}/bin/${adapterName}
|
||||
mv ${install_dir}/bin/taosd-dump-cfg.gdb ${install_dir}/bin/${serverName}-dump-cfg.gdb
|
||||
fi
|
||||
|
||||
|
@ -233,8 +233,10 @@ if [ "$verMode" == "cluster" ]; then
|
|||
sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove.sh >>remove_temp.sh
|
||||
sed -i "s/serverName2=\"taosd\"/serverName2=\"${serverName2}\"/g" remove_temp.sh
|
||||
sed -i "s/clientName2=\"taos\"/clientName2=\"${clientName2}\"/g" remove_temp.sh
|
||||
sed -i "s/configFile2=\"taos.cfg\"/configFile2=\"${clientName2}.cfg\"/g" remove_temp.sh
|
||||
sed -i "s/productName2=\"TDengine\"/productName2=\"${productName2}\"/g" remove_temp.sh
|
||||
sed -i "s/emailName2=\"taosdata.com\"/emailName2=\"${cusEmail2}\"/g" remove_temp.sh
|
||||
cusDomain=`echo "${cusEmail2}" | sed 's/^[^@]*@//'`
|
||||
sed -i "s/emailName2=\"taosdata.com\"/emailName2=\"${cusDomain}\"/g" remove_temp.sh
|
||||
mv remove_temp.sh ${install_dir}/bin/remove.sh
|
||||
fi
|
||||
if [ "$verMode" == "cloud" ]; then
|
||||
|
@ -262,8 +264,10 @@ if [ "$verMode" == "cluster" ]; then
|
|||
sed -i 's/verMode=edge/verMode=cluster/g' install_temp.sh
|
||||
sed -i "s/serverName2=\"taosd\"/serverName2=\"${serverName2}\"/g" install_temp.sh
|
||||
sed -i "s/clientName2=\"taos\"/clientName2=\"${clientName2}\"/g" install_temp.sh
|
||||
sed -i "s/configFile2=\"taos.cfg\"/configFile2=\"${clientName2}.cfg\"/g" install_temp.sh
|
||||
sed -i "s/productName2=\"TDengine\"/productName2=\"${productName2}\"/g" install_temp.sh
|
||||
sed -i "s/emailName2=\"taosdata.com\"/emailName2=\"${cusEmail2}\"/g" install_temp.sh
|
||||
cusDomain=`echo "${cusEmail2}" | sed 's/^[^@]*@//'`
|
||||
sed -i "s/emailName2=\"taosdata.com\"/emailName2=\"${cusDomain}\"/g" install_temp.sh
|
||||
mv install_temp.sh ${install_dir}/install.sh
|
||||
fi
|
||||
if [ "$verMode" == "cloud" ]; then
|
||||
|
|
|
@ -40,11 +40,16 @@ serverName2="taosd"
|
|||
clientName2="taos"
|
||||
productName2="TDengine"
|
||||
|
||||
adapterName2="${clientName2}adapter"
|
||||
demoName2="${clientName2}demo"
|
||||
benchmarkName2="${clientName2}Benchmark"
|
||||
dumpName2="${clientName2}dump"
|
||||
keeperName2="${clientName2}keeper"
|
||||
xName2="${clientName2}x"
|
||||
explorerName2="${clientName2}-explorer"
|
||||
uninstallScript2="rm${clientName2}"
|
||||
|
||||
installDir="/usr/local/${clientName}"
|
||||
installDir="/usr/local/${clientName2}"
|
||||
|
||||
#install main path
|
||||
install_main_dir=${installDir}
|
||||
|
@ -55,8 +60,8 @@ local_bin_link_dir="/usr/local/bin"
|
|||
|
||||
|
||||
service_config_dir="/etc/systemd/system"
|
||||
taos_service_name=${serverName}
|
||||
taosadapter_service_name="taosadapter"
|
||||
taos_service_name=${serverName2}
|
||||
taosadapter_service_name="${clientName2}adapter"
|
||||
tarbitrator_service_name="tarbitratord"
|
||||
csudo=""
|
||||
if command -v sudo >/dev/null; then
|
||||
|
@ -84,14 +89,14 @@ else
|
|||
fi
|
||||
|
||||
function kill_taosadapter() {
|
||||
pid=$(ps -ef | grep "taosadapter" | grep -v "grep" | awk '{print $2}')
|
||||
pid=$(ps -ef | grep "${adapterName2}" | grep -v "grep" | awk '{print $2}')
|
||||
if [ -n "$pid" ]; then
|
||||
${csudo}kill -9 $pid || :
|
||||
fi
|
||||
}
|
||||
|
||||
function kill_taosd() {
|
||||
pid=$(ps -ef | grep ${serverName} | grep -v "grep" | awk '{print $2}')
|
||||
pid=$(ps -ef | grep ${serverName2} | grep -v "grep" | awk '{print $2}')
|
||||
if [ -n "$pid" ]; then
|
||||
${csudo}kill -9 $pid || :
|
||||
fi
|
||||
|
@ -109,17 +114,17 @@ function clean_bin() {
|
|||
${csudo}rm -f ${bin_link_dir}/${clientName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${serverName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/udfd || :
|
||||
${csudo}rm -f ${bin_link_dir}/taosadapter || :
|
||||
${csudo}rm -f ${bin_link_dir}/taosBenchmark || :
|
||||
${csudo}rm -f ${bin_link_dir}/taosdemo || :
|
||||
${csudo}rm -f ${bin_link_dir}/taosdump || :
|
||||
${csudo}rm -f ${bin_link_dir}/${uninstallScript} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${adapterName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${demoName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${dumpName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${uninstallScript} || :
|
||||
${csudo}rm -f ${bin_link_dir}/tarbitrator || :
|
||||
${csudo}rm -f ${bin_link_dir}/set_core || :
|
||||
${csudo}rm -f ${bin_link_dir}/TDinsight.sh || :
|
||||
${csudo}rm -f ${bin_link_dir}/taoskeeper || :
|
||||
${csudo}rm -f ${bin_link_dir}/taosx || :
|
||||
${csudo}rm -f ${bin_link_dir}/taos-explorer || :
|
||||
${csudo}rm -f ${bin_link_dir}/${keeperName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${xName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${explorerName2} || :
|
||||
|
||||
if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then
|
||||
${csudo}rm -f ${bin_link_dir}/${clientName2} || :
|
||||
|
@ -130,8 +135,8 @@ function clean_bin() {
|
|||
}
|
||||
|
||||
function clean_local_bin() {
|
||||
${csudo}rm -f ${local_bin_link_dir}/taosBenchmark || :
|
||||
${csudo}rm -f ${local_bin_link_dir}/taosdemo || :
|
||||
${csudo}rm -f ${local_bin_link_dir}/${benchmarkName2} || :
|
||||
${csudo}rm -f ${local_bin_link_dir}/${demoName2} || :
|
||||
}
|
||||
|
||||
function clean_lib() {
|
||||
|
@ -173,7 +178,7 @@ function clean_service_on_systemd() {
|
|||
${csudo}systemctl disable ${taos_service_name} &>/dev/null || echo &>/dev/null
|
||||
${csudo}rm -f ${taosd_service_config}
|
||||
|
||||
taosadapter_service_config="${service_config_dir}/taosadapter.service"
|
||||
taosadapter_service_config="${service_config_dir}/${clientName2}adapter.service"
|
||||
if systemctl is-active --quiet ${taosadapter_service_name}; then
|
||||
echo "${productName2} ${clientName2}Adapter is running, stopping it..."
|
||||
${csudo}systemctl stop ${taosadapter_service_name} &>/dev/null || echo &>/dev/null
|
||||
|
@ -235,8 +240,8 @@ function clean_service_on_sysvinit() {
|
|||
function clean_service_on_launchctl() {
|
||||
${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
|
||||
${csudo}rm /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
|
||||
${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist > /dev/null 2>&1 || :
|
||||
${csudo}rm /Library/LaunchDaemons/com.taosdata.taosadapter.plist > /dev/null 2>&1 || :
|
||||
${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.${clientName2}adapter.plist > /dev/null 2>&1 || :
|
||||
${csudo}rm /Library/LaunchDaemons/com.taosdata.${clientName2}adapter.plist > /dev/null 2>&1 || :
|
||||
}
|
||||
|
||||
function clean_service() {
|
||||
|
|
|
@ -15,11 +15,12 @@ uninstallScript="rmtaos"
|
|||
clientName2="taos"
|
||||
productName2="TDengine"
|
||||
|
||||
benchmarkName2="${clientName}Benchmark"
|
||||
dumpName2="${clientName}dump"
|
||||
uninstallScript2="rm${clientName}"
|
||||
benchmarkName2="${clientName2}Benchmark"
|
||||
demoName2="${clientName2}demo"
|
||||
dumpName2="${clientName2}dump"
|
||||
uninstallScript2="rm${clientName2}"
|
||||
|
||||
installDir="/usr/local/${clientName}"
|
||||
installDir="/usr/local/${clientName2}"
|
||||
|
||||
#install main path
|
||||
install_main_dir=${installDir}
|
||||
|
@ -44,14 +45,17 @@ function kill_client() {
|
|||
|
||||
function clean_bin() {
|
||||
# Remove link
|
||||
${csudo}rm -f ${bin_link_dir}/${clientName} || :
|
||||
${csudo}rm -f ${bin_link_dir}/taosdemo || :
|
||||
${csudo}rm -f ${bin_link_dir}/taosdump || :
|
||||
${csudo}rm -f ${bin_link_dir}/${clientName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${demoName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${dumpName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${uninstallScript} || :
|
||||
${csudo}rm -f ${bin_link_dir}/set_core || :
|
||||
|
||||
if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then
|
||||
${csudo}rm -f ${bin_link_dir}/${clientName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${demoName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${dumpName2} || :
|
||||
${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || :
|
||||
fi
|
||||
|
|
|
@ -26,6 +26,7 @@ extern "C" {
|
|||
#define tscFatal(...) do { if (cDebugFlag & DEBUG_FATAL) { taosPrintLog("TSC FATAL ", DEBUG_FATAL, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||
#define tscError(...) do { if (cDebugFlag & DEBUG_ERROR) { taosPrintLog("TSC ERROR ", DEBUG_ERROR, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||
#define tscWarn(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("TSC WARN ", DEBUG_WARN, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||
#define tscWarnL(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLongString("TSC WARN ", DEBUG_WARN, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||
#define tscInfo(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC ", DEBUG_INFO, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||
#define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||
#define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", DEBUG_TRACE, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||
|
|
|
@ -102,6 +102,7 @@ typedef struct STscStmt {
|
|||
SStmtBindInfo bInfo;
|
||||
|
||||
int64_t reqid;
|
||||
int32_t errCode;
|
||||
} STscStmt;
|
||||
|
||||
extern char *gStmtStatusStr[];
|
||||
|
@ -121,6 +122,7 @@ extern char *gStmtStatusStr[];
|
|||
int32_t _code = c; \
|
||||
if (_code != TSDB_CODE_SUCCESS) { \
|
||||
terrno = _code; \
|
||||
pStmt->errCode = _code; \
|
||||
return _code; \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -129,6 +131,7 @@ extern char *gStmtStatusStr[];
|
|||
int32_t _code = c; \
|
||||
if (_code != TSDB_CODE_SUCCESS) { \
|
||||
terrno = _code; \
|
||||
pStmt->errCode = _code; \
|
||||
} \
|
||||
return _code; \
|
||||
} while (0)
|
||||
|
@ -137,6 +140,7 @@ extern char *gStmtStatusStr[];
|
|||
code = c; \
|
||||
if (code != TSDB_CODE_SUCCESS) { \
|
||||
terrno = code; \
|
||||
pStmt->errCode = code; \
|
||||
goto _return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
#include "tsched.h"
|
||||
#include "ttime.h"
|
||||
|
||||
#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
|
||||
#include "cus_name.h"
|
||||
#endif
|
||||
|
||||
#define TSC_VAR_NOT_RELEASE 1
|
||||
#define TSC_VAR_RELEASED 0
|
||||
|
||||
|
@ -103,6 +107,7 @@ static void deregisterRequest(SRequestObj *pRequest) {
|
|||
|
||||
if (duration >= SLOW_QUERY_INTERVAL) {
|
||||
atomic_add_fetch_64((int64_t *)&pActivity->numOfSlowQueries, 1);
|
||||
tscWarnL("slow query: %s, duration:%" PRId64, pRequest->sqlstr, duration);
|
||||
}
|
||||
|
||||
releaseTscObj(pTscObj->id);
|
||||
|
@ -541,9 +546,15 @@ void taos_init_imp(void) {
|
|||
|
||||
deltaToUtcInitOnce();
|
||||
|
||||
if (taosCreateLog("taoslog", 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) {
|
||||
char logDirName[64] = {0};
|
||||
#ifdef CUS_PROMPT
|
||||
snprintf(logDirName, 64, "%slog", CUS_PROMPT);
|
||||
#else
|
||||
snprintf(logDirName, 64, "taoslog");
|
||||
#endif
|
||||
if (taosCreateLog(logDirName, 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) {
|
||||
// ignore create log failed, only print
|
||||
printf(" WARING: Create taoslog failed:%s. configDir=%s\n", strerror(errno), configDir);
|
||||
printf(" WARING: Create %s failed:%s. configDir=%s\n", logDirName, strerror(errno), configDir);
|
||||
}
|
||||
|
||||
if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1) != 0) {
|
||||
|
|
|
@ -174,6 +174,7 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName) {
|
|||
if (childTableNameLen == tag->keyLen && strncmp(tag->key, tsSmlChildTableName, tag->keyLen) == 0) {
|
||||
memset(childTableName, 0, TSDB_TABLE_NAME_LEN);
|
||||
strncpy(childTableName, tag->value, (tag->length < TSDB_TABLE_NAME_LEN ? tag->length : TSDB_TABLE_NAME_LEN));
|
||||
taosArrayRemove(tags, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -533,8 +534,7 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm
|
|||
uint16_t *index = colHash ? (uint16_t *)taosHashGet(colHash, kv->key, kv->keyLen) : NULL;
|
||||
if (index) {
|
||||
if (colField[*index].type != kv->type) {
|
||||
uError("SML:0x%" PRIx64 " point type and db type mismatch. key: %s. point type: %d, db type: %d", info->id,
|
||||
kv->key, colField[*index].type, kv->type);
|
||||
uError("SML:0x%" PRIx64 " point type and db type mismatch. point type: %d, db type: %d, key: %s", info->id, colField[*index].type, kv->type, kv->key);
|
||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,14 @@ int32_t stmtSwitchStatus(STscStmt* pStmt, STMT_STATUS newStatus) {
|
|||
STMT_LOG_SEQ(newStatus);
|
||||
}
|
||||
|
||||
if (pStmt->errCode && newStatus != STMT_PREPARE) {
|
||||
STMT_DLOG("stmt already failed with err: %s", tstrerror(pStmt->errCode));
|
||||
return pStmt->errCode;
|
||||
}
|
||||
|
||||
switch (newStatus) {
|
||||
case STMT_PREPARE:
|
||||
pStmt->errCode = 0;
|
||||
break;
|
||||
case STMT_SETTBNAME:
|
||||
if (STMT_STATUS_EQ(INIT) || STMT_STATUS_EQ(BIND) || STMT_STATUS_EQ(BIND_COL)) {
|
||||
|
@ -197,7 +203,10 @@ int32_t stmtGetExecInfo(TAOS_STMT* stmt, SHashObj** pVgHash, SHashObj** pBlockHa
|
|||
STscStmt* pStmt = (STscStmt*)stmt;
|
||||
|
||||
*pVgHash = pStmt->sql.pVgHash;
|
||||
pStmt->sql.pVgHash = NULL;
|
||||
|
||||
*pBlockHash = pStmt->exec.pBlockHash;
|
||||
pStmt->exec.pBlockHash = NULL;
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -325,6 +334,8 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool deepClean) {
|
|||
}
|
||||
|
||||
int32_t stmtCleanSQLInfo(STscStmt* pStmt) {
|
||||
STMT_DLOG_E("start to free SQL info");
|
||||
|
||||
taosMemoryFree(pStmt->sql.queryRes.fields);
|
||||
taosMemoryFree(pStmt->sql.queryRes.userFields);
|
||||
taosMemoryFree(pStmt->sql.sqlStr);
|
||||
|
@ -351,6 +362,8 @@ int32_t stmtCleanSQLInfo(STscStmt* pStmt) {
|
|||
|
||||
memset(&pStmt->sql, 0, sizeof(pStmt->sql));
|
||||
|
||||
STMT_DLOG_E("end to free SQL info");
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -441,11 +454,10 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
|
|||
.mgmtEps = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp)};
|
||||
int32_t code = catalogGetTableMeta(pStmt->pCatalog, &conn, &pStmt->bInfo.sname, &pTableMeta);
|
||||
if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) {
|
||||
STMT_ERR_RET(stmtCleanBindInfo(pStmt));
|
||||
|
||||
tscDebug("tb %s not exist", pStmt->bInfo.tbFName);
|
||||
stmtCleanBindInfo(pStmt);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
STMT_ERR_RET(code);
|
||||
}
|
||||
|
||||
STMT_ERR_RET(code);
|
||||
|
@ -922,9 +934,13 @@ _return:
|
|||
int stmtClose(TAOS_STMT* stmt) {
|
||||
STscStmt* pStmt = (STscStmt*)stmt;
|
||||
|
||||
STMT_DLOG_E("start to free stmt");
|
||||
|
||||
stmtCleanSQLInfo(pStmt);
|
||||
taosMemoryFree(stmt);
|
||||
|
||||
STMT_DLOG_E("stmt freed");
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ struct tmq_t {
|
|||
STaosQueue* mqueue; // queue of rsp
|
||||
STaosQall* qall;
|
||||
STaosQueue* delayedTask; // delayed task queue for heartbeat and auto commit
|
||||
TdThreadMutex lock; // used to protect the operation on each topic, when updating the epsets.
|
||||
tsem_t rspSem;
|
||||
};
|
||||
|
||||
|
@ -188,7 +187,6 @@ typedef struct {
|
|||
SMqClientVg* pVg;
|
||||
SMqClientTopic* pTopic;
|
||||
int32_t vgId;
|
||||
tsem_t rspSem;
|
||||
uint64_t requestId; // request id for debug purpose
|
||||
} SMqPollCbParam;
|
||||
|
||||
|
@ -979,7 +977,6 @@ void tmqFreeImpl(void* handle) {
|
|||
|
||||
taosFreeQall(tmq->qall);
|
||||
tsem_destroy(&tmq->rspSem);
|
||||
taosThreadMutexDestroy(&tmq->lock);
|
||||
|
||||
taosArrayDestroyEx(tmq->clientTopics, freeClientVgImpl);
|
||||
taos_close_internal(tmq->pTscObj);
|
||||
|
@ -1024,7 +1021,6 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
|
|||
pTmq->delayedTask = taosOpenQueue();
|
||||
pTmq->qall = taosAllocateQall();
|
||||
|
||||
taosThreadMutexInit(&pTmq->lock, NULL);
|
||||
if (pTmq->clientTopics == NULL || pTmq->mqueue == NULL || pTmq->qall == NULL || pTmq->delayedTask == NULL ||
|
||||
conf->groupId[0] == 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -1233,7 +1229,6 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
|
||||
tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId);
|
||||
if (tmq == NULL) {
|
||||
tsem_destroy(&pParam->rspSem);
|
||||
taosMemoryFree(pParam);
|
||||
taosMemoryFree(pMsg->pData);
|
||||
taosMemoryFree(pMsg->pEpSet);
|
||||
|
@ -1269,6 +1264,8 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
|
||||
pRspWrapper->tmqRspType = TMQ_MSG_TYPE__END_RSP;
|
||||
taosWriteQitem(tmq->mqueue, pRspWrapper);
|
||||
}else if(code == TSDB_CODE_WAL_LOG_NOT_EXIST){ //poll data while insert
|
||||
taosMsleep(500);
|
||||
}
|
||||
|
||||
goto CREATE_MSG_FAIL;
|
||||
|
@ -1343,8 +1340,9 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
taosMemoryFree(pMsg->pData);
|
||||
taosWriteQitem(tmq->mqueue, pRspWrapper);
|
||||
|
||||
int32_t total = taosQueueItemSize(tmq->mqueue);
|
||||
tscDebug("consumer:0x%" PRIx64 " put poll res into mqueue, type:%d, vgId:%d, total in queue:%d, reqId:0x%" PRIx64,
|
||||
tmq->consumerId, rspType, vgId, tmq->mqueue->numOfItems, requestId);
|
||||
tmq->consumerId, rspType, vgId, total, requestId);
|
||||
|
||||
tsem_post(&tmq->rspSem);
|
||||
taosReleaseRef(tmqMgmt.rsetId, refId);
|
||||
|
@ -1419,7 +1417,7 @@ static void freeClientVgInfo(void* param) {
|
|||
taosArrayDestroy(pTopic->vgs);
|
||||
}
|
||||
|
||||
static bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
|
||||
static bool doUpdateLocalEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
|
||||
bool set = false;
|
||||
|
||||
int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics);
|
||||
|
@ -1428,6 +1426,9 @@ static bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
|
|||
char vgKey[TSDB_TOPIC_FNAME_LEN + 22];
|
||||
tscDebug("consumer:0x%" PRIx64 " update ep epoch from %d to epoch %d, incoming topics:%d, existed topics:%d",
|
||||
tmq->consumerId, tmq->epoch, epoch, topicNumGet, topicNumCur);
|
||||
if (epoch <= tmq->epoch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SArray* newTopics = taosArrayInit(topicNumGet, sizeof(SMqClientTopic));
|
||||
if (newTopics == NULL) {
|
||||
|
@ -1471,14 +1472,11 @@ static bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
|
|||
|
||||
taosHashCleanup(pVgOffsetHashMap);
|
||||
|
||||
taosThreadMutexLock(&tmq->lock);
|
||||
// destroy current buffered existed topics info
|
||||
if (tmq->clientTopics) {
|
||||
taosArrayDestroyEx(tmq->clientTopics, freeClientVgInfo);
|
||||
}
|
||||
|
||||
tmq->clientTopics = newTopics;
|
||||
taosThreadMutexUnlock(&tmq->lock);
|
||||
|
||||
int8_t flag = (topicNumGet == 0)? TMQ_CONSUMER_STATUS__NO_TOPIC:TMQ_CONSUMER_STATUS__READY;
|
||||
atomic_store_8(&tmq->status, flag);
|
||||
|
@ -1534,8 +1532,8 @@ int32_t askEpCallbackFn(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
} else {
|
||||
tscDebug("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d, update local ep", tmq->consumerId,
|
||||
head->epoch, epoch);
|
||||
pParam->pUserFn(tmq, code, pMsg, pParam->pParam);
|
||||
}
|
||||
pParam->pUserFn(tmq, code, pMsg, pParam->pParam);
|
||||
|
||||
taosReleaseRef(tmqMgmt.rsetId, pParam->refId);
|
||||
|
||||
|
@ -1742,7 +1740,7 @@ static int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspWrapper* rspWrapper, bool* p
|
|||
if (rspWrapper->epoch > atomic_load_32(&tmq->epoch)) {
|
||||
SMqAskEpRspWrapper* pEpRspWrapper = (SMqAskEpRspWrapper*)rspWrapper;
|
||||
SMqAskEpRsp* rspMsg = &pEpRspWrapper->msg;
|
||||
tmqUpdateEp(tmq, rspWrapper->epoch, rspMsg);
|
||||
doUpdateLocalEp(tmq, rspWrapper->epoch, rspMsg);
|
||||
/*tmqClearUnhandleMsg(tmq);*/
|
||||
tDeleteSMqAskEpRsp(rspMsg);
|
||||
*pReset = true;
|
||||
|
@ -2163,7 +2161,7 @@ void updateEpCallbackFn(tmq_t* pTmq, int32_t code, SDataBuf* pDataBuf, void* par
|
|||
|
||||
SMqAskEpRsp rsp;
|
||||
tDecodeSMqAskEpRsp(POINTER_SHIFT(pDataBuf->pData, sizeof(SMqRspHead)), &rsp);
|
||||
tmqUpdateEp(pTmq, head->epoch, &rsp);
|
||||
doUpdateLocalEp(pTmq, head->epoch, &rsp);
|
||||
tDeleteSMqAskEpRsp(&rsp);
|
||||
}
|
||||
|
||||
|
|
|
@ -161,10 +161,10 @@ void *queryThread(void *arg) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int32_t numOfThreads = 1;
|
||||
int32_t numOfThreads = 1;
|
||||
|
||||
void tmq_commit_cb_print(tmq_t *pTmq, int32_t code, void *param) {
|
||||
printf("success, code:%d\n", code);
|
||||
printf("auto commit success, code:%d\n\n\n\n", code);
|
||||
}
|
||||
|
||||
void* doConsumeData(void* param) {
|
||||
|
@ -173,7 +173,7 @@ void* doConsumeData(void* param) {
|
|||
tmq_conf_t* conf = tmq_conf_new();
|
||||
tmq_conf_set(conf, "enable.auto.commit", "true");
|
||||
tmq_conf_set(conf, "auto.commit.interval.ms", "1000");
|
||||
tmq_conf_set(conf, "group.id", "cgrpName12");
|
||||
tmq_conf_set(conf, "group.id", "cgrpName41");
|
||||
tmq_conf_set(conf, "td.connect.user", "root");
|
||||
tmq_conf_set(conf, "td.connect.pass", "taosdata");
|
||||
tmq_conf_set(conf, "auto.offset.reset", "earliest");
|
||||
|
@ -1060,7 +1060,7 @@ TEST(clientCase, sub_tb_test) {
|
|||
tmq_conf_t* conf = tmq_conf_new();
|
||||
tmq_conf_set(conf, "enable.auto.commit", "true");
|
||||
tmq_conf_set(conf, "auto.commit.interval.ms", "1000");
|
||||
tmq_conf_set(conf, "group.id", "cgrpName27");
|
||||
tmq_conf_set(conf, "group.id", "cgrpName45");
|
||||
tmq_conf_set(conf, "td.connect.user", "root");
|
||||
tmq_conf_set(conf, "td.connect.pass", "taosdata");
|
||||
tmq_conf_set(conf, "auto.offset.reset", "earliest");
|
||||
|
|
|
@ -228,7 +228,11 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input
|
|||
|
||||
taosExpandDir(inputCfgDir, cfgDir, PATH_MAX);
|
||||
if (taosIsDir(cfgDir)) {
|
||||
#ifdef CUS_PROMPT
|
||||
snprintf(cfgFile, sizeof(cfgFile), "%s" TD_DIRSEP "%s.cfg", CUS_PROMPT, cfgDir);
|
||||
#else
|
||||
snprintf(cfgFile, sizeof(cfgFile), "%s" TD_DIRSEP "taos.cfg", cfgDir);
|
||||
#endif
|
||||
} else {
|
||||
tstrncpy(cfgFile, cfgDir, sizeof(cfgDir));
|
||||
}
|
||||
|
|
|
@ -7212,6 +7212,7 @@ void tDestroySSubmitReq2(SSubmitReq2 *pReq, int32_t flag) {
|
|||
tDestroySSubmitTbData(&aSubmitTbData[i], flag);
|
||||
}
|
||||
taosArrayDestroy(pReq->aSubmitTbData);
|
||||
pReq->aSubmitTbData = NULL;
|
||||
}
|
||||
|
||||
int32_t tEncodeSSubmitRsp2(SEncoder *pCoder, const SSubmitRsp2 *pRsp) {
|
||||
|
|
|
@ -20,6 +20,21 @@
|
|||
#include "tglobal.h"
|
||||
#include "version.h"
|
||||
|
||||
#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
|
||||
#include "cus_name.h"
|
||||
#else
|
||||
#ifndef CUS_NAME
|
||||
#define CUS_NAME "TDengine"
|
||||
#endif
|
||||
|
||||
#ifndef CUS_PROMPT
|
||||
#define CUS_PROMPT "taos"
|
||||
#endif
|
||||
|
||||
#ifndef CUS_EMAIL
|
||||
#define CUS_EMAIL "<support@taosdata.com>"
|
||||
#endif
|
||||
#endif
|
||||
// clang-format off
|
||||
#define DM_APOLLO_URL "The apollo string to use when configuring the server, such as: -a 'jsonFile:./tests/cfg.json', cfg.json text can be '{\"fqdn\":\"td1\"}'."
|
||||
#define DM_CFG_DIR "Configuration directory."
|
||||
|
@ -232,7 +247,7 @@ static void dmDumpCfg() {
|
|||
}
|
||||
|
||||
static int32_t dmInitLog() {
|
||||
return taosCreateLog("taosdlog", 1, configDir, global.envCmd, global.envFile, global.apolloUrl, global.pArgs, 0);
|
||||
return taosCreateLog(CUS_PROMPT"dlog", 1, configDir, global.envCmd, global.envFile, global.apolloUrl, global.pArgs, 0);
|
||||
}
|
||||
|
||||
static void taosCleanupArgs() {
|
||||
|
|
|
@ -24,10 +24,10 @@ extern "C" {
|
|||
|
||||
enum {
|
||||
MQ_CONSUMER_STATUS__MODIFY = 1,
|
||||
MQ_CONSUMER_STATUS__MODIFY_IN_REB, // this value is not used anymore
|
||||
// MQ_CONSUMER_STATUS__MODIFY_IN_REB, // this value is not used anymore
|
||||
MQ_CONSUMER_STATUS__READY,
|
||||
MQ_CONSUMER_STATUS__LOST,
|
||||
MQ_CONSUMER_STATUS__LOST_IN_REB, // this value is not used anymore
|
||||
// MQ_CONSUMER_STATUS__LOST_IN_REB, // this value is not used anymore
|
||||
MQ_CONSUMER_STATUS__LOST_REBD,
|
||||
MQ_CONSUMER_STATUS__REMOVED,
|
||||
};
|
||||
|
|
|
@ -337,7 +337,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) {
|
|||
taosArrayPush(pRebSub->removedConsumers, &pConsumer->consumerId);
|
||||
}
|
||||
taosRUnLockLatch(&pConsumer->lock);
|
||||
} else if (status == MQ_CONSUMER_STATUS__MODIFY || status == MQ_CONSUMER_STATUS__MODIFY_IN_REB) {
|
||||
} else if (status == MQ_CONSUMER_STATUS__MODIFY) {
|
||||
taosRLockLatch(&pConsumer->lock);
|
||||
|
||||
int32_t newTopicNum = taosArrayGetSize(pConsumer->rebNewTopics);
|
||||
|
@ -876,17 +876,11 @@ static void updateConsumerStatus(SMqConsumerObj* pConsumer) {
|
|||
int32_t status = pConsumer->status;
|
||||
|
||||
if (taosArrayGetSize(pConsumer->rebNewTopics) == 0 && taosArrayGetSize(pConsumer->rebRemovedTopics) == 0) {
|
||||
if (status == MQ_CONSUMER_STATUS__MODIFY || status == MQ_CONSUMER_STATUS__MODIFY_IN_REB) {
|
||||
if (status == MQ_CONSUMER_STATUS__MODIFY) {
|
||||
pConsumer->status = MQ_CONSUMER_STATUS__READY;
|
||||
} else if (status == MQ_CONSUMER_STATUS__LOST_IN_REB || status == MQ_CONSUMER_STATUS__LOST) {
|
||||
} else if (status == MQ_CONSUMER_STATUS__LOST) {
|
||||
pConsumer->status = MQ_CONSUMER_STATUS__LOST_REBD;
|
||||
}
|
||||
} else {
|
||||
if (status == MQ_CONSUMER_STATUS__MODIFY || status == MQ_CONSUMER_STATUS__MODIFY_IN_REB) {
|
||||
pConsumer->status = MQ_CONSUMER_STATUS__MODIFY;
|
||||
} else if (status == MQ_CONSUMER_STATUS__LOST || status == MQ_CONSUMER_STATUS__LOST_IN_REB) {
|
||||
pConsumer->status = MQ_CONSUMER_STATUS__LOST;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1195,10 +1189,8 @@ static const char *mndConsumerStatusName(int status) {
|
|||
return "ready";
|
||||
case MQ_CONSUMER_STATUS__LOST:
|
||||
case MQ_CONSUMER_STATUS__LOST_REBD:
|
||||
case MQ_CONSUMER_STATUS__LOST_IN_REB:
|
||||
return "lost";
|
||||
case MQ_CONSUMER_STATUS__MODIFY:
|
||||
case MQ_CONSUMER_STATUS__MODIFY_IN_REB:
|
||||
return "rebalancing";
|
||||
default:
|
||||
return "unknown";
|
||||
|
|
|
@ -228,19 +228,12 @@ typedef struct SSnapContext {
|
|||
SArray *idList;
|
||||
int32_t index;
|
||||
bool withMeta;
|
||||
bool queryMetaOrData; // true-get meta, false-get data
|
||||
bool queryMeta; // true-get meta, false-get data
|
||||
} SSnapContext;
|
||||
|
||||
typedef struct STqReader {
|
||||
// const SSubmitReq *pMsg;
|
||||
// SSubmitBlk *pBlock;
|
||||
// SSubmitMsgIter msgIter;
|
||||
// SSubmitBlkIter blkIter;
|
||||
|
||||
int64_t ver;
|
||||
SPackedData msg2;
|
||||
|
||||
int8_t setMsg;
|
||||
SSubmitReq2 submit;
|
||||
int32_t nextBlk;
|
||||
|
||||
|
@ -267,7 +260,7 @@ int32_t tqReaderAddTbUidList(STqReader *pReader, const SArray *tbUidList);
|
|||
int32_t tqReaderRemoveTbUidList(STqReader *pReader, const SArray *tbUidList);
|
||||
|
||||
int32_t tqSeekVer(STqReader *pReader, int64_t ver, const char *id);
|
||||
int32_t tqNextBlock(STqReader *pReader, SFetchRet *ret);
|
||||
void tqNextBlock(STqReader *pReader, SFetchRet *ret);
|
||||
|
||||
int32_t tqReaderSetSubmitReq2(STqReader *pReader, void *msgStr, int32_t msgLen, int64_t ver);
|
||||
// int32_t tqReaderSetDataMsg(STqReader *pReader, const SSubmitReq *pMsg, int64_t ver);
|
||||
|
|
|
@ -123,12 +123,12 @@ int32_t tsdbRowIterOpen(STSDBRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema)
|
|||
void tsdbRowClose(STSDBRowIter *pIter);
|
||||
SColVal *tsdbRowIterNext(STSDBRowIter *pIter);
|
||||
// SRowMerger
|
||||
int32_t tsdbRowMergerInit2(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRow, STSchema *pTSchema);
|
||||
int32_t tsdbRowMergerInit(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRow, STSchema *pTSchema);
|
||||
int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema);
|
||||
|
||||
int32_t tsdbRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema);
|
||||
void tsdbRowMergerClear(SRowMerger *pMerger);
|
||||
int32_t tsdbRowMerge(SRowMerger *pMerger, TSDBROW *pRow);
|
||||
// int32_t tsdbRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema);
|
||||
void tsdbRowMergerClear(SRowMerger *pMerger);
|
||||
// int32_t tsdbRowMerge(SRowMerger *pMerger, TSDBROW *pRow);
|
||||
int32_t tsdbRowMergerGetRow(SRowMerger *pMerger, SRow **ppRow);
|
||||
// TABLEID
|
||||
int32_t tTABLEIDCmprFn(const void *p1, const void *p2);
|
||||
|
@ -224,7 +224,7 @@ int32_t tsdbTbDataIterCreate(STbData *pTbData, TSDBKEY *pFrom, int8_t backward,
|
|||
void *tsdbTbDataIterDestroy(STbDataIter *pIter);
|
||||
void tsdbTbDataIterOpen(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter *pIter);
|
||||
bool tsdbTbDataIterNext(STbDataIter *pIter);
|
||||
void tsdbMemTableCountRows(SMemTable *pMemTable, SHashObj* pTableMap, int64_t *rowsNum);
|
||||
void tsdbMemTableCountRows(SMemTable *pMemTable, SHashObj *pTableMap, int64_t *rowsNum);
|
||||
|
||||
// STbData
|
||||
int32_t tsdbGetNRowsInTbData(STbData *pTbData);
|
||||
|
|
|
@ -268,7 +268,7 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
|
|||
ctx->snapVersion = snapVersion;
|
||||
ctx->suid = suid;
|
||||
ctx->subType = subType;
|
||||
ctx->queryMetaOrData = withMeta;
|
||||
ctx->queryMeta = withMeta;
|
||||
ctx->withMeta = withMeta;
|
||||
ctx->idVersion = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
|
||||
if (ctx->idVersion == NULL) {
|
||||
|
@ -475,7 +475,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in
|
|||
if (ctx->index >= taosArrayGetSize(ctx->idList)) {
|
||||
metaDebug("tmqsnap get meta end");
|
||||
ctx->index = 0;
|
||||
ctx->queryMetaOrData = false; // change to get data
|
||||
ctx->queryMeta = false; // change to get data
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -236,21 +236,6 @@ int32_t tqPushDataRsp(STQ* pTq, STqPushEntry* pPushEntry) {
|
|||
}
|
||||
|
||||
int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqDataRsp* pRsp, int32_t type) {
|
||||
#if 0
|
||||
A(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum);
|
||||
A(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum);
|
||||
|
||||
A(!pRsp->withSchema);
|
||||
A(taosArrayGetSize(pRsp->blockSchema) == 0);
|
||||
|
||||
if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) {
|
||||
if (pRsp->blockNum > 0) {
|
||||
A(pRsp->rspOffset.version > pRsp->reqOffset.version);
|
||||
} else {
|
||||
A(pRsp->rspOffset.version >= pRsp->reqOffset.version);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
doSendDataRsp(&pMsg->info, pRsp, pReq->epoch, pReq->consumerId, type);
|
||||
|
||||
char buf1[80] = {0};
|
||||
|
@ -352,17 +337,6 @@ static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t su
|
|||
}
|
||||
|
||||
pRsp->withTbName = 0;
|
||||
#if 0
|
||||
pRsp->withTbName = pReq->withTbName;
|
||||
if (pRsp->withTbName) {
|
||||
pRsp->blockTbName = taosArrayInit(0, sizeof(void*));
|
||||
if (pRsp->blockTbName == NULL) {
|
||||
// TODO free
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pRsp->withSchema = false;
|
||||
return 0;
|
||||
}
|
||||
|
@ -421,6 +395,7 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand
|
|||
return -1;
|
||||
}
|
||||
|
||||
// offset set to previous version when init
|
||||
tqOffsetResetToLog(pOffsetVal, pHandle->pRef->refVer - 1);
|
||||
}
|
||||
} else if (reqOffset.type == TMQ_OFFSET__RESET_LATEST) {
|
||||
|
@ -461,7 +436,6 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand
|
|||
|
||||
static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest,
|
||||
SRpcMsg* pMsg, STqOffsetVal* pOffset) {
|
||||
int32_t code = 0;
|
||||
uint64_t consumerId = pRequest->consumerId;
|
||||
int32_t vgId = TD_VID(pTq->pVnode);
|
||||
|
||||
|
@ -472,10 +446,9 @@ static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle,
|
|||
taosWLockLatch(&pTq->lock);
|
||||
|
||||
qSetTaskId(pHandle->execHandle.task, consumerId, pRequest->reqId);
|
||||
code = tqScanData(pTq, pHandle, &dataRsp, pOffset);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosWUnLockLatch(&pTq->lock);
|
||||
return code;
|
||||
int code = tqScanData(pTq, pHandle, &dataRsp, pOffset);
|
||||
if(code != 0) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
// till now, all data has been transferred to consumer, new data needs to push client once arrived.
|
||||
|
@ -486,89 +459,60 @@ static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle,
|
|||
return code;
|
||||
}
|
||||
|
||||
taosWUnLockLatch(&pTq->lock);
|
||||
|
||||
code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&dataRsp, TMQ_MSG_TYPE__POLL_RSP);
|
||||
|
||||
// NOTE: this pHandle->consumerId may have been changed already.
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, offset type:%d, uid/version:%" PRId64
|
||||
", ts:%" PRId64 ", reqId:0x%" PRIx64,
|
||||
consumerId, pHandle->subKey, vgId, dataRsp.blockNum, dataRsp.rspOffset.type, dataRsp.rspOffset.uid,
|
||||
dataRsp.rspOffset.ts, pRequest->reqId);
|
||||
|
||||
tDeleteSMqDataRsp(&dataRsp);
|
||||
end:
|
||||
{
|
||||
char buf[80] = {0};
|
||||
tFormatOffset(buf, 80, &dataRsp.rspOffset);
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s, reqId:0x%" PRIx64 " code:%d",
|
||||
consumerId, pHandle->subKey, vgId, dataRsp.blockNum, buf, pRequest->reqId, code);
|
||||
taosWUnLockLatch(&pTq->lock);
|
||||
tDeleteSMqDataRsp(&dataRsp);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t doPollDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg) {
|
||||
int32_t code = -1;
|
||||
STqOffsetVal offset = {0};
|
||||
SWalCkHead* pCkHead = NULL;
|
||||
|
||||
static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg, STqOffsetVal *offset) {
|
||||
int code = 0;
|
||||
int32_t vgId = TD_VID(pTq->pVnode);
|
||||
|
||||
STqOffsetVal reqOffset = pRequest->reqOffset;
|
||||
uint64_t consumerId = pRequest->consumerId;
|
||||
|
||||
// 1. reset the offset if needed
|
||||
if (IS_OFFSET_RESET_TYPE(reqOffset.type)) {
|
||||
// handle the reset offset cases, according to the consumer's choice.
|
||||
bool blockReturned = false;
|
||||
code = extractResetOffsetVal(&offset, pTq, pHandle, pRequest, pMsg, &blockReturned);
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
// empty block returned, quit
|
||||
if (blockReturned) {
|
||||
return 0;
|
||||
}
|
||||
} else { // use the consumer specified offset
|
||||
// the offset value can not be monotonious increase??
|
||||
offset = reqOffset;
|
||||
}
|
||||
|
||||
// this is a normal subscribe requirement
|
||||
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||
return extractDataAndRspForNormalSubscribe(pTq, pHandle, pRequest, pMsg, &offset);
|
||||
}
|
||||
|
||||
// todo handle the case where re-balance occurs.
|
||||
// for taosx
|
||||
SWalCkHead* pCkHead = NULL;
|
||||
SMqMetaRsp metaRsp = {0};
|
||||
STaosxRsp taosxRsp = {0};
|
||||
tqInitTaosxRsp(&taosxRsp, pRequest);
|
||||
|
||||
if (offset.type != TMQ_OFFSET__LOG) {
|
||||
if (tqScanTaosx(pTq, pHandle, &taosxRsp, &metaRsp, &offset) < 0) {
|
||||
if (offset->type != TMQ_OFFSET__LOG) {
|
||||
if (tqScanTaosx(pTq, pHandle, &taosxRsp, &metaRsp, offset) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (metaRsp.metaRspLen > 0) {
|
||||
code = tqSendMetaPollRsp(pTq, pMsg, pRequest, &metaRsp);
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 " subkey:%s vgId:%d, send meta offset type:%d,uid:%" PRId64
|
||||
",ts:%" PRId64,
|
||||
consumerId, pHandle->subKey, vgId, metaRsp.rspOffset.type, metaRsp.rspOffset.uid,
|
||||
metaRsp.rspOffset.ts);
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 " subkey:%s vgId:%d, send meta offset type:%d,uid:%" PRId64 ",ts:%" PRId64,
|
||||
pRequest->consumerId, pHandle->subKey, vgId, metaRsp.rspOffset.type, metaRsp.rspOffset.uid, metaRsp.rspOffset.ts);
|
||||
taosMemoryFree(metaRsp.metaRsp);
|
||||
tDeleteSTaosxRsp(&taosxRsp);
|
||||
return code;
|
||||
}
|
||||
|
||||
tqDebug("taosx poll: consumer:0x%" PRIx64 " subkey:%s vgId:%d, send data blockNum:%d, offset type:%d,uid:%" PRId64
|
||||
",ts:%" PRId64,pRequest->consumerId, pHandle->subKey, vgId, taosxRsp.blockNum, taosxRsp.rspOffset.type, taosxRsp.rspOffset.uid,taosxRsp.rspOffset.ts);
|
||||
if (taosxRsp.blockNum > 0) {
|
||||
code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
|
||||
tDeleteSTaosxRsp(&taosxRsp);
|
||||
return code;
|
||||
} else {
|
||||
offset = taosxRsp.rspOffset;
|
||||
}else {
|
||||
*offset = taosxRsp.rspOffset;
|
||||
}
|
||||
|
||||
tqDebug("taosx poll: consumer:0x%" PRIx64 " subkey:%s vgId:%d, send data blockNum:%d, offset type:%d,uid:%" PRId64
|
||||
",version:%" PRId64,
|
||||
consumerId, pHandle->subKey, vgId, taosxRsp.blockNum, taosxRsp.rspOffset.type, taosxRsp.rspOffset.uid,
|
||||
taosxRsp.rspOffset.version);
|
||||
}
|
||||
|
||||
if (offset.type == TMQ_OFFSET__LOG) {
|
||||
int64_t fetchVer = offset.version + 1;
|
||||
|
||||
if (offset->type == TMQ_OFFSET__LOG) {
|
||||
int64_t fetchVer = offset->version + 1;
|
||||
pCkHead = taosMemoryMalloc(sizeof(SWalCkHead) + 2048);
|
||||
if (pCkHead == NULL) {
|
||||
tDeleteSTaosxRsp(&taosxRsp);
|
||||
|
@ -578,12 +522,10 @@ static int32_t doPollDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* p
|
|||
walSetReaderCapacity(pHandle->pWalReader, 2048);
|
||||
int totalRows = 0;
|
||||
while (1) {
|
||||
// todo refactor: this is not correct.
|
||||
int32_t savedEpoch = atomic_load_32(&pHandle->epoch);
|
||||
if (savedEpoch > pRequest->epoch) {
|
||||
tqWarn("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey:%s vgId:%d offset %" PRId64
|
||||
", found new consumer epoch %d, discard req epoch %d",
|
||||
consumerId, pRequest->epoch, pHandle->subKey, vgId, fetchVer, savedEpoch, pRequest->epoch);
|
||||
", found new consumer epoch %d, discard req epoch %d", pRequest->consumerId, pRequest->epoch, pHandle->subKey, vgId, fetchVer, savedEpoch, pRequest->epoch);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -596,7 +538,7 @@ static int32_t doPollDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* p
|
|||
}
|
||||
|
||||
SWalCont* pHead = &pCkHead->head;
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d) iter log, vgId:%d offset %" PRId64 " msgType %d", consumerId,
|
||||
tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d) iter log, vgId:%d offset %" PRId64 " msgType %d", pRequest->consumerId,
|
||||
pRequest->epoch, vgId, fetchVer, pHead->msgType);
|
||||
|
||||
// process meta
|
||||
|
@ -634,7 +576,7 @@ static int32_t doPollDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* p
|
|||
};
|
||||
|
||||
if (tqTaosxScanLog(pTq, pHandle, submit, &taosxRsp, &totalRows) < 0) {
|
||||
tqError("tmq poll: tqTaosxScanLog error %" PRId64 ", in vgId:%d, subkey %s", consumerId, vgId,
|
||||
tqError("tmq poll: tqTaosxScanLog error %" PRId64 ", in vgId:%d, subkey %s", pRequest->consumerId, vgId,
|
||||
pRequest->subKey);
|
||||
taosMemoryFreeClear(pCkHead);
|
||||
tDeleteSTaosxRsp(&taosxRsp);
|
||||
|
@ -658,6 +600,39 @@ static int32_t doPollDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* p
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t doPollDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg) {
|
||||
int32_t code = -1;
|
||||
STqOffsetVal offset = {0};
|
||||
STqOffsetVal reqOffset = pRequest->reqOffset;
|
||||
|
||||
// 1. reset the offset if needed
|
||||
if (IS_OFFSET_RESET_TYPE(reqOffset.type)) {
|
||||
// handle the reset offset cases, according to the consumer's choice.
|
||||
bool blockReturned = false;
|
||||
code = extractResetOffsetVal(&offset, pTq, pHandle, pRequest, pMsg, &blockReturned);
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
// empty block returned, quit
|
||||
if (blockReturned) {
|
||||
return 0;
|
||||
}
|
||||
} else { // use the consumer specified offset
|
||||
// the offset value can not be monotonious increase??
|
||||
offset = reqOffset;
|
||||
}
|
||||
|
||||
// this is a normal subscribe requirement
|
||||
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||
return extractDataAndRspForNormalSubscribe(pTq, pHandle, pRequest, pMsg, &offset);
|
||||
}
|
||||
|
||||
// todo handle the case where re-balance occurs.
|
||||
// for taosx
|
||||
return extractDataAndRspForDbStbSubscribe(pTq, pHandle, pRequest, pMsg, &offset);
|
||||
}
|
||||
|
||||
int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
|
||||
SMqPollReq req = {0};
|
||||
if (tDeserializeSMqPollReq(pMsg->pCont, pMsg->contLen, &req) < 0) {
|
||||
|
@ -819,13 +794,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
|
|||
pHandle->pRef = pRef;
|
||||
|
||||
SReadHandle handle = {
|
||||
.meta = pVnode->pMeta,
|
||||
.vnode = pVnode,
|
||||
.initTableReader = true,
|
||||
.initTqReader = true,
|
||||
.version = ver,
|
||||
};
|
||||
|
||||
.meta = pVnode->pMeta, .vnode = pVnode, .initTableReader = true, .initTqReader = true, .version = ver};
|
||||
pHandle->snapshotVer = ver;
|
||||
|
||||
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||
|
@ -1338,7 +1307,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
|
|||
pRefBlock->dataRef = pRef;
|
||||
atomic_add_fetch_32(pRefBlock->dataRef, 1);
|
||||
|
||||
if (streamTaskInput(pTask, (SStreamQueueItem*)pRefBlock) < 0) {
|
||||
if (tAppendDataForStream(pTask, (SStreamQueueItem*)pRefBlock) < 0) {
|
||||
qError("stream task input del failed, task id %d", pTask->taskId);
|
||||
|
||||
atomic_sub_fetch_32(pRef, 1);
|
||||
|
@ -1373,7 +1342,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
|
|||
taosArrayPush(pStreamBlock->blocks, &block);
|
||||
|
||||
if (!failed) {
|
||||
if (streamTaskInput(pTask, (SStreamQueueItem*)pStreamBlock) < 0) {
|
||||
if (tAppendDataForStream(pTask, (SStreamQueueItem*)pStreamBlock) < 0) {
|
||||
qError("stream task input del failed, task id %d", pTask->taskId);
|
||||
continue;
|
||||
}
|
||||
|
@ -1393,15 +1362,14 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
|
|||
}
|
||||
|
||||
int32_t tqProcessSubmitReq(STQ* pTq, SPackedData submit) {
|
||||
void* pIter = NULL;
|
||||
bool failed = false;
|
||||
SStreamDataSubmit2* pSubmit = NULL;
|
||||
void* pIter = NULL;
|
||||
bool succ = true;
|
||||
|
||||
pSubmit = streamDataSubmitNew(submit);
|
||||
SStreamDataSubmit2* pSubmit = streamDataSubmitNew(submit);
|
||||
if (pSubmit == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tqError("failed to create data submit for stream since out of memory");
|
||||
failed = true;
|
||||
succ = false;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
@ -1411,22 +1379,27 @@ int32_t tqProcessSubmitReq(STQ* pTq, SPackedData submit) {
|
|||
}
|
||||
|
||||
SStreamTask* pTask = *(SStreamTask**)pIter;
|
||||
if (pTask->taskLevel != TASK_LEVEL__SOURCE) continue;
|
||||
if (pTask->taskStatus == TASK_STATUS__RECOVER_PREPARE || pTask->taskStatus == TASK_STATUS__WAIT_DOWNSTREAM) {
|
||||
tqDebug("skip push task %d, task status %d", pTask->taskId, pTask->taskStatus);
|
||||
if (pTask->taskLevel != TASK_LEVEL__SOURCE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
tqDebug("data submit enqueue stream task: %d, ver: %" PRId64, pTask->taskId, submit.ver);
|
||||
if (pTask->taskStatus == TASK_STATUS__RECOVER_PREPARE || pTask->taskStatus == TASK_STATUS__WAIT_DOWNSTREAM) {
|
||||
tqDebug("stream task:%d skip push data, not ready for processing, status %d", pTask->taskId, pTask->taskStatus);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!failed) {
|
||||
if (streamTaskInput(pTask, (SStreamQueueItem*)pSubmit) < 0) {
|
||||
tqError("stream task input failed, task id %d", pTask->taskId);
|
||||
tqDebug("data submit enqueue stream task:%d, ver: %" PRId64, pTask->taskId, submit.ver);
|
||||
if (succ) {
|
||||
int32_t code = tAppendDataForStream(pTask, (SStreamQueueItem*)pSubmit);
|
||||
if (code < 0) {
|
||||
// let's handle the back pressure
|
||||
|
||||
tqError("stream task:%d failed to put into queue for, too many", pTask->taskId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (streamSchedExec(pTask) < 0) {
|
||||
tqError("stream task launch failed, task id %d", pTask->taskId);
|
||||
tqError("stream task:%d launch failed, code:%s", pTask->taskId, tstrerror(terrno));
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
|
@ -1434,12 +1407,12 @@ int32_t tqProcessSubmitReq(STQ* pTq, SPackedData submit) {
|
|||
}
|
||||
}
|
||||
|
||||
if (pSubmit) {
|
||||
streamDataSubmitRefDec(pSubmit);
|
||||
if (pSubmit != NULL) {
|
||||
streamDataSubmitDestroy(pSubmit);
|
||||
taosFreeQitem(pSubmit);
|
||||
}
|
||||
|
||||
return failed ? -1 : 0;
|
||||
return succ ? 0 : -1;
|
||||
}
|
||||
|
||||
int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
|
||||
|
@ -1559,6 +1532,8 @@ int32_t vnodeEnqueueStreamMsg(SVnode* pVnode, SRpcMsg* pMsg) {
|
|||
rpcFreeCont(pMsg->pCont);
|
||||
taosFreeQitem(pMsg);
|
||||
return 0;
|
||||
} else {
|
||||
tDeleteStreamDispatchReq(&req);
|
||||
}
|
||||
|
||||
code = TSDB_CODE_STREAM_TASK_NOT_EXIST;
|
||||
|
|
|
@ -30,7 +30,7 @@ static int32_t tqLoopExecFromQueue(STQ* pTq, STqHandle* pHandle, SStreamDataSubm
|
|||
// update processed
|
||||
atomic_store_64(&pHandle->pushHandle.processedVer, pSubmit->ver);
|
||||
streamQueueProcessSuccess(&pHandle->pushHandle.inputQ);
|
||||
streamDataSubmitRefDec(pSubmit);
|
||||
streamDataSubmitDestroy(pSubmit);
|
||||
if (pRsp->blockNum > 0) {
|
||||
*ppSubmit = pSubmit;
|
||||
return 0;
|
||||
|
@ -58,7 +58,7 @@ int32_t tqExecFromInputQ(STQ* pTq, STqHandle* pHandle) {
|
|||
}
|
||||
while (pHandle->pushHandle.processedVer > pSubmit->ver + 1) {
|
||||
streamQueueProcessSuccess(&pHandle->pushHandle.inputQ);
|
||||
streamDataSubmitRefDec(pSubmit);
|
||||
streamDataSubmitDestroy(pSubmit);
|
||||
pSubmit = streamQueueNextItem(&pHandle->pushHandle.inputQ);
|
||||
if (pSubmit == NULL) break;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ int32_t tqPreparePush(STQ* pTq, STqHandle* pHandle, int64_t reqId, const SRpcHan
|
|||
int32_t tqEnqueue(STqHandle* pHandle, SStreamDataSubmit* pSubmit) {
|
||||
int8_t inputStatus = atomic_load_8(&pHandle->pushHandle.inputStatus);
|
||||
if (inputStatus == TASK_INPUT_STATUS__NORMAL) {
|
||||
SStreamDataSubmit* pSubmitClone = streamSubmitRefClone(pSubmit);
|
||||
SStreamDataSubmit* pSubmitClone = streamSubmitBlockClone(pSubmit);
|
||||
if (pSubmitClone == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -207,33 +207,18 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_
|
|||
#endif
|
||||
|
||||
typedef struct {
|
||||
void* pKey;
|
||||
void* pKey;
|
||||
int64_t keyLen;
|
||||
} SItem;
|
||||
|
||||
static void recordPushedEntry(SArray* cachedKey, void* pIter);
|
||||
static void doRemovePushedEntry(SArray* pCachedKeys, STQ* pTq);
|
||||
|
||||
static void freeItem(void* param) {
|
||||
SItem* p = (SItem*) param;
|
||||
taosMemoryFree(p->pKey);
|
||||
}
|
||||
|
||||
static void doRemovePushedEntry(SArray* pCachedKeys, STQ* pTq) {
|
||||
int32_t vgId = TD_VID(pTq->pVnode);
|
||||
int32_t numOfKeys = (int32_t) taosArrayGetSize(pCachedKeys);
|
||||
|
||||
for (int32_t i = 0; i < numOfKeys; i++) {
|
||||
SItem* pItem = taosArrayGet(pCachedKeys, i);
|
||||
if (taosHashRemove(pTq->pPushMgr, pItem->pKey, pItem->keyLen) != 0) {
|
||||
tqError("vgId:%d, tq push hash remove key error, key: %s", vgId, (char*) pItem->pKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (numOfKeys > 0) {
|
||||
tqDebug("vgId:%d, pushed %d items and remain:%d", vgId, numOfKeys, (int32_t)taosHashGetSize(pTq->pPushMgr));
|
||||
}
|
||||
}
|
||||
|
||||
static void doPushDataForEntry(void* pIter, STqExecHandle* pExec, STQ* pTq, int64_t ver, int32_t vgId, char* pData,
|
||||
int32_t dataLen, SArray* pCachedKey) {
|
||||
STqPushEntry* pPushEntry = *(STqPushEntry**)pIter;
|
||||
|
@ -253,7 +238,7 @@ static void doPushDataForEntry(void* pIter, STqExecHandle* pExec, STQ* pTq, int6
|
|||
if (qStreamSetScanMemData(pTaskInfo, submit) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
qStreamSetOpen(pTaskInfo);
|
||||
// here start to scan submit block to extract the subscribed data
|
||||
int32_t totalRows = 0;
|
||||
|
||||
|
@ -347,7 +332,7 @@ int32_t tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t v
|
|||
void* data = taosMemoryMalloc(len);
|
||||
if (data == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
tqError("failed to copy data for stream since out of memory");
|
||||
tqError("vgId:%d, failed to copy submit data for stream processing, since out of memory", vgId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -366,13 +351,6 @@ int32_t tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t v
|
|||
return 0;
|
||||
}
|
||||
|
||||
void recordPushedEntry(SArray* cachedKey, void* pIter) {
|
||||
size_t kLen = 0;
|
||||
void* key = taosHashGetKey(pIter, &kLen);
|
||||
SItem item = {.pKey = strndup(key, kLen), .keyLen = kLen};
|
||||
taosArrayPush(cachedKey, &item);
|
||||
}
|
||||
|
||||
int32_t tqRegisterPushEntry(STQ* pTq, void* pHandle, const SMqPollReq* pRequest, SRpcMsg* pRpcMsg,
|
||||
SMqDataRsp* pDataRsp, int32_t type) {
|
||||
uint64_t consumerId = pRequest->consumerId;
|
||||
|
@ -430,3 +408,26 @@ int32_t tqUnregisterPushEntry(STQ* pTq, const char* pKey, int32_t keyLen, uint64
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void recordPushedEntry(SArray* cachedKey, void* pIter) {
|
||||
size_t kLen = 0;
|
||||
void* key = taosHashGetKey(pIter, &kLen);
|
||||
SItem item = {.pKey = strndup(key, kLen), .keyLen = kLen};
|
||||
taosArrayPush(cachedKey, &item);
|
||||
}
|
||||
|
||||
void doRemovePushedEntry(SArray* pCachedKeys, STQ* pTq) {
|
||||
int32_t vgId = TD_VID(pTq->pVnode);
|
||||
int32_t numOfKeys = (int32_t) taosArrayGetSize(pCachedKeys);
|
||||
|
||||
for (int32_t i = 0; i < numOfKeys; i++) {
|
||||
SItem* pItem = taosArrayGet(pCachedKeys, i);
|
||||
if (taosHashRemove(pTq->pPushMgr, pItem->pKey, pItem->keyLen) != 0) {
|
||||
tqError("vgId:%d, tq push hash remove key error, key: %s", vgId, (char*) pItem->pKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (numOfKeys > 0) {
|
||||
tqDebug("vgId:%d, pushed %d items and remain:%d", vgId, numOfKeys, (int32_t)taosHashGetSize(pTq->pPushMgr));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ STqReader* tqOpenReader(SVnode* pVnode) {
|
|||
|
||||
pReader->pVnodeMeta = pVnode->pMeta;
|
||||
/*pReader->pMsg = NULL;*/
|
||||
pReader->ver = -1;
|
||||
// pReader->ver = -1;
|
||||
pReader->pColIdList = NULL;
|
||||
pReader->cachedSchemaVer = 0;
|
||||
pReader->cachedSchemaSuid = 0;
|
||||
|
@ -290,41 +290,26 @@ void tqCloseReader(STqReader* pReader) {
|
|||
}
|
||||
// free hash
|
||||
taosHashCleanup(pReader->tbIdHash);
|
||||
tDestroySSubmitReq2(&pReader->submit, TSDB_MSG_FLG_DECODE);
|
||||
taosMemoryFree(pReader);
|
||||
}
|
||||
|
||||
int32_t tqSeekVer(STqReader* pReader, int64_t ver, const char* id) {
|
||||
// todo set the correct vgId
|
||||
tqDebug("tmq poll: wal seek to version:%"PRId64" %s", ver, id);
|
||||
if (walReadSeekVer(pReader->pWalReader, ver) < 0) {
|
||||
tqDebug("tmq poll: wal reader failed to seek to ver:%"PRId64" code:%s, %s", ver, tstrerror(terrno), id);
|
||||
return -1;
|
||||
} else {
|
||||
tqDebug("tmq poll: wal reader seek to ver:%"PRId64" %s", ver, id);
|
||||
return 0;
|
||||
}
|
||||
tqDebug("tmq poll: wal reader seek to ver:%"PRId64" %s", ver, id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
|
||||
bool fromProcessedMsg = pReader->msg2.msgStr != NULL;
|
||||
|
||||
void tqNextBlock(STqReader* pReader, SFetchRet* ret) {
|
||||
while (1) {
|
||||
if (!fromProcessedMsg) {
|
||||
if (pReader->msg2.msgStr == NULL) {
|
||||
if (walNextValidMsg(pReader->pWalReader) < 0) {
|
||||
// pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curStopped;
|
||||
if(pReader->pWalReader->curInvalid == 0){
|
||||
pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curStopped;
|
||||
}else{
|
||||
pReader->ver = walGetLastVer(pReader->pWalReader->pWal);
|
||||
}
|
||||
ret->offset.type = TMQ_OFFSET__LOG;
|
||||
|
||||
ret->offset.version = pReader->ver;
|
||||
ret->fetchType = FETCH_TYPE__NONE;
|
||||
tqDebug("return offset %" PRId64 ", no more valid msg in wal", ret->offset.version);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
void* body = POINTER_SHIFT(pReader->pWalReader->pHead->head.body, sizeof(SSubmitReq2Msg));
|
||||
int32_t bodyLen = pReader->pWalReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg);
|
||||
int64_t ver = pReader->pWalReader->pHead->head.version;
|
||||
|
@ -333,109 +318,44 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
|
|||
}
|
||||
|
||||
while (tqNextDataBlock2(pReader)) {
|
||||
// TODO mem free
|
||||
memset(&ret->data, 0, sizeof(SSDataBlock));
|
||||
int32_t code = tqRetrieveDataBlock2(&ret->data, pReader, NULL);
|
||||
if (code != 0 || ret->data.info.rows == 0) {
|
||||
continue;
|
||||
}
|
||||
ret->fetchType = FETCH_TYPE__DATA;
|
||||
tqDebug("return data rows %" PRId64, ret->data.info.rows);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fromProcessedMsg) {
|
||||
ret->offset.type = TMQ_OFFSET__LOG;
|
||||
ret->offset.version = pReader->ver;
|
||||
ret->fetchType = FETCH_TYPE__SEP;
|
||||
tqDebug("return offset %" PRId64 ", processed finish", ret->offset.version);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
int32_t tqReaderSetDataMsg(STqReader* pReader, const SSubmitReq* pMsg, int64_t ver) {
|
||||
pReader->pMsg = pMsg;
|
||||
|
||||
// if (tInitSubmitMsgIter(pMsg, &pReader->msgIter) < 0) return -1;
|
||||
// while (true) {
|
||||
// if (tGetSubmitMsgNext(&pReader->msgIter, &pReader->pBlock) < 0) return -1;
|
||||
// tqDebug("submitnext vgId:%d, block:%p, dataLen:%d, len:%d, uid:%"PRId64, pWalReader->pWal->cfg.vgId, pReader->pBlock, pReader->msgIter.dataLen,
|
||||
// pReader->msgIter.len, pReader->msgIter.uid);
|
||||
// if (pReader->pBlock == NULL) break;
|
||||
// }
|
||||
|
||||
if (tInitSubmitMsgIter(pMsg, &pReader->msgIter) < 0) return -1;
|
||||
pReader->ver = ver;
|
||||
memset(&pReader->blkIter, 0, sizeof(SSubmitBlkIter));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t tqReaderSetSubmitReq2(STqReader* pReader, void* msgStr, int32_t msgLen, int64_t ver) {
|
||||
ASSERT(pReader->msg2.msgStr == NULL && msgStr && msgLen && (ver >= 0));
|
||||
|
||||
pReader->msg2.msgStr = msgStr;
|
||||
pReader->msg2.msgLen = msgLen;
|
||||
pReader->msg2.ver = ver;
|
||||
pReader->ver = ver;
|
||||
|
||||
tqDebug("tq reader set msg %p %d", msgStr, msgLen);
|
||||
|
||||
if (pReader->setMsg == 0) {
|
||||
SDecoder decoder;
|
||||
tDecoderInit(&decoder, pReader->msg2.msgStr, pReader->msg2.msgLen);
|
||||
if (tDecodeSSubmitReq2(&decoder, &pReader->submit) < 0) {
|
||||
ASSERT(0);
|
||||
}
|
||||
SDecoder decoder;
|
||||
tDecoderInit(&decoder, pReader->msg2.msgStr, pReader->msg2.msgLen);
|
||||
if (tDecodeSSubmitReq2(&decoder, &pReader->submit) < 0) {
|
||||
tDecoderClear(&decoder);
|
||||
pReader->setMsg = 1;
|
||||
tqError("DecodeSSubmitReq2 error, msgLen:%d, ver:%"PRId64, msgLen, ver);
|
||||
return -1;
|
||||
}
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool tqNextDataBlock(STqReader* pReader) {
|
||||
if (pReader->pMsg == NULL) return false;
|
||||
while (1) {
|
||||
if (tGetSubmitMsgNext(&pReader->msgIter, &pReader->pBlock) < 0) {
|
||||
return false;
|
||||
}
|
||||
if (pReader->pBlock == NULL) {
|
||||
pReader->pMsg = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pReader->tbIdHash == NULL) {
|
||||
return true;
|
||||
}
|
||||
void* ret = taosHashGet(pReader->tbIdHash, &pReader->msgIter.uid, sizeof(int64_t));
|
||||
/*tqDebug("search uid %" PRId64, pHandle->msgIter.uid);*/
|
||||
if (ret != NULL) {
|
||||
/*tqDebug("find uid %" PRId64, pHandle->msgIter.uid);*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool tqNextDataBlock2(STqReader* pReader) {
|
||||
if (pReader->msg2.msgStr == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSERT(pReader->setMsg == 1);
|
||||
|
||||
tqDebug("tq reader next data block %p, %d %" PRId64 " %d", pReader->msg2.msgStr, pReader->msg2.msgLen,
|
||||
pReader->msg2.ver, pReader->nextBlk);
|
||||
|
||||
int32_t blockSz = taosArrayGetSize(pReader->submit.aSubmitTbData);
|
||||
while (pReader->nextBlk < blockSz) {
|
||||
tqDebug("tq reader next data block %p, %d %" PRId64 " %d", pReader->msg2.msgStr, pReader->msg2.msgLen,
|
||||
pReader->msg2.ver, pReader->nextBlk);
|
||||
SSubmitTbData* pSubmitTbData = taosArrayGet(pReader->submit.aSubmitTbData, pReader->nextBlk);
|
||||
ASSERT(pSubmitTbData->uid);
|
||||
|
||||
if (pReader->tbIdHash == NULL) return true;
|
||||
|
||||
void* ret = taosHashGet(pReader->tbIdHash, &pSubmitTbData->uid, sizeof(int64_t));
|
||||
|
@ -446,7 +366,6 @@ bool tqNextDataBlock2(STqReader* pReader) {
|
|||
}
|
||||
|
||||
tDestroySSubmitReq2(&pReader->submit, TSDB_MSG_FLG_DECODE);
|
||||
pReader->setMsg = 0;
|
||||
pReader->nextBlk = 0;
|
||||
pReader->msg2.msgStr = NULL;
|
||||
|
||||
|
@ -455,7 +374,6 @@ bool tqNextDataBlock2(STqReader* pReader) {
|
|||
|
||||
bool tqNextDataBlockFilterOut2(STqReader* pReader, SHashObj* filterOutUids) {
|
||||
if (pReader->msg2.msgStr == NULL) return false;
|
||||
ASSERT(pReader->setMsg == 1);
|
||||
|
||||
int32_t blockSz = taosArrayGetSize(pReader->submit.aSubmitTbData);
|
||||
while (pReader->nextBlk < blockSz) {
|
||||
|
@ -470,7 +388,6 @@ bool tqNextDataBlockFilterOut2(STqReader* pReader, SHashObj* filterOutUids) {
|
|||
}
|
||||
|
||||
tDestroySSubmitReq2(&pReader->submit, TSDB_MSG_FLG_DECODE);
|
||||
pReader->setMsg = 0;
|
||||
pReader->nextBlk = 0;
|
||||
pReader->msg2.msgStr = NULL;
|
||||
|
||||
|
@ -506,63 +423,8 @@ int32_t tqMaskBlock(SSchemaWrapper* pDst, SSDataBlock* pBlock, const SSchemaWrap
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool tqNextDataBlockFilterOut(STqReader* pHandle, SHashObj* filterOutUids) {
|
||||
while (1) {
|
||||
if (tGetSubmitMsgNext(&pHandle->msgIter, &pHandle->pBlock) < 0) {
|
||||
return false;
|
||||
}
|
||||
if (pHandle->pBlock == NULL) return false;
|
||||
|
||||
void* ret = taosHashGet(filterOutUids, &pHandle->msgIter.uid, sizeof(int64_t));
|
||||
if (ret == NULL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t tqScanSubmitSplit(SArray* pBlocks, SArray* schemas, STqReader* pReader) {
|
||||
//
|
||||
int32_t sversion = htonl(pReader->pBlock->sversion);
|
||||
if (pReader->cachedSchemaSuid == 0 || pReader->cachedSchemaVer != sversion ||
|
||||
pReader->cachedSchemaSuid != pReader->msgIter.suid) {
|
||||
taosMemoryFree(pReader->pSchema);
|
||||
pReader->pSchema = metaGetTbTSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
|
||||
if (pReader->pSchema == NULL) {
|
||||
tqWarn("vgId:%d, cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64
|
||||
"), version %d, possibly dropped table",
|
||||
pWalReader->pWal->cfg.vgId, pReader->msgIter.uid, pReader->msgIter.suid, sversion);
|
||||
pReader->cachedSchemaSuid = 0;
|
||||
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
|
||||
return -1;
|
||||
}
|
||||
|
||||
tDeleteSSchemaWrapper(pReader->pSchemaWrapper);
|
||||
pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
|
||||
if (pReader->pSchemaWrapper == NULL) {
|
||||
tqWarn("vgId:%d, cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table",
|
||||
pWalReader->pWal->cfg.vgId, pReader->msgIter.uid, pReader->cachedSchemaVer);
|
||||
pReader->cachedSchemaSuid = 0;
|
||||
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
|
||||
return -1;
|
||||
}
|
||||
|
||||
STSchema* pTschema = pReader->pSchema;
|
||||
SSchemaWrapper* pSchemaWrapper = pReader->pSchemaWrapper;
|
||||
|
||||
int32_t colNumNeed = taosArrayGetSize(pReader->pColIdList);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader, SSubmitTbData** pSubmitTbDataRet) {
|
||||
int32_t blockSz = taosArrayGetSize(pReader->submit.aSubmitTbData);
|
||||
ASSERT(pReader->nextBlk < blockSz);
|
||||
|
||||
tqDebug("tq reader retrieve data block %p, %d", pReader->msg2.msgStr, pReader->nextBlk);
|
||||
|
||||
tqDebug("tq reader retrieve data block %p, index:%d", pReader->msg2.msgStr, pReader->nextBlk);
|
||||
SSubmitTbData* pSubmitTbData = taosArrayGet(pReader->submit.aSubmitTbData, pReader->nextBlk);
|
||||
pReader->nextBlk++;
|
||||
|
||||
|
@ -666,33 +528,27 @@ int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader, SSubmitTbD
|
|||
int32_t targetIdx = 0;
|
||||
int32_t sourceIdx = 0;
|
||||
while (targetIdx < colActual) {
|
||||
ASSERT(sourceIdx < numOfCols);
|
||||
|
||||
if(sourceIdx >= numOfCols){
|
||||
tqError("tqRetrieveDataBlock2 sourceIdx:%d >= numOfCols:%d", sourceIdx, numOfCols);
|
||||
goto FAIL;
|
||||
}
|
||||
SColData* pCol = taosArrayGet(pCols, sourceIdx);
|
||||
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, targetIdx);
|
||||
SColVal colVal;
|
||||
|
||||
ASSERT(pCol->nVal == numOfRows);
|
||||
if(pCol->nVal != numOfRows){
|
||||
tqError("tqRetrieveDataBlock2 pCol->nVal:%d != numOfRows:%d", pCol->nVal, numOfRows);
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
if (pCol->cid < pColData->info.colId) {
|
||||
sourceIdx++;
|
||||
} else if (pCol->cid == pColData->info.colId) {
|
||||
for (int32_t i = 0; i < pCol->nVal; i++) {
|
||||
tColDataGetValue(pCol, i, &colVal);
|
||||
#if 0
|
||||
void* val = NULL;
|
||||
if (IS_STR_DATA_TYPE(colVal.type)) {
|
||||
val = colVal.value.pData;
|
||||
} else {
|
||||
val = &colVal.value.val;
|
||||
}
|
||||
if (colDataAppend(pColData, i, val, !COL_VAL_IS_VALUE(&colVal)) < 0) {
|
||||
goto FAIL;
|
||||
}
|
||||
#endif
|
||||
if (IS_STR_DATA_TYPE(colVal.type)) {
|
||||
if (colVal.value.pData != NULL) {
|
||||
char val[65535 + 2];
|
||||
char val[65535 + 2] = {0};
|
||||
memcpy(varDataVal(val), colVal.value.pData, colVal.value.nData);
|
||||
varDataSetLen(val, colVal.value.nData);
|
||||
if (colDataAppend(pColData, i, val, !COL_VAL_IS_VALUE(&colVal)) < 0) {
|
||||
|
@ -726,8 +582,6 @@ int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader, SSubmitTbD
|
|||
for (int32_t j = 0; j < colActual; j++) {
|
||||
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, j);
|
||||
while (1) {
|
||||
ASSERT(sourceIdx < pTschema->numOfCols);
|
||||
|
||||
SColVal colVal;
|
||||
tRowGet(pRow, pTschema, sourceIdx, &colVal);
|
||||
if (colVal.cid < pColData->info.colId) {
|
||||
|
@ -736,7 +590,7 @@ int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader, SSubmitTbD
|
|||
} else if (colVal.cid == pColData->info.colId) {
|
||||
if (IS_STR_DATA_TYPE(colVal.type)) {
|
||||
if (colVal.value.pData != NULL) {
|
||||
char val[65535 + 2];
|
||||
char val[65535 + 2] = {0};
|
||||
memcpy(varDataVal(val), colVal.value.pData, colVal.value.nData);
|
||||
varDataSetLen(val, colVal.value.nData);
|
||||
if (colDataAppend(pColData, i, val, !COL_VAL_IS_VALUE(&colVal)) < 0) {
|
||||
|
@ -745,7 +599,6 @@ int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader, SSubmitTbD
|
|||
} else {
|
||||
colDataSetNULL(pColData, i);
|
||||
}
|
||||
/*val = colVal.value.pData;*/
|
||||
} else {
|
||||
if (colDataAppend(pColData, i, (void*)&colVal.value.val, !COL_VAL_IS_VALUE(&colVal)) < 0) {
|
||||
goto FAIL;
|
||||
|
@ -771,253 +624,6 @@ FAIL:
|
|||
return -1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) {
|
||||
// TODO: cache multiple schema
|
||||
int32_t sversion = htonl(pReader->pBlock->sversion);
|
||||
if (pReader->cachedSchemaSuid == 0 || pReader->cachedSchemaVer != sversion ||
|
||||
pReader->cachedSchemaSuid != pReader->msgIter.suid) {
|
||||
if (pReader->pSchema) taosMemoryFree(pReader->pSchema);
|
||||
pReader->pSchema = metaGetTbTSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
|
||||
if (pReader->pSchema == NULL) {
|
||||
tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table",
|
||||
pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer);
|
||||
pReader->cachedSchemaSuid = 0;
|
||||
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pReader->pSchemaWrapper) tDeleteSSchemaWrapper(pReader->pSchemaWrapper);
|
||||
pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
|
||||
if (pReader->pSchemaWrapper == NULL) {
|
||||
tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table",
|
||||
pReader->msgIter.uid, pReader->cachedSchemaVer);
|
||||
pReader->cachedSchemaSuid = 0;
|
||||
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
|
||||
return -1;
|
||||
}
|
||||
pReader->cachedSchemaVer = sversion;
|
||||
pReader->cachedSchemaSuid = pReader->msgIter.suid;
|
||||
}
|
||||
|
||||
STSchema* pTschema = pReader->pSchema;
|
||||
SSchemaWrapper* pSchemaWrapper = pReader->pSchemaWrapper;
|
||||
|
||||
int32_t colNumNeed = taosArrayGetSize(pReader->pColIdList);
|
||||
|
||||
if (colNumNeed == 0) {
|
||||
int32_t colMeta = 0;
|
||||
while (colMeta < pSchemaWrapper->nCols) {
|
||||
SSchema* pColSchema = &pSchemaWrapper->pSchema[colMeta];
|
||||
SColumnInfoData colInfo = createColumnInfoData(pColSchema->type, pColSchema->bytes, pColSchema->colId);
|
||||
int32_t code = blockDataAppendColInfo(pBlock, &colInfo);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto FAIL;
|
||||
}
|
||||
colMeta++;
|
||||
}
|
||||
} else {
|
||||
if (colNumNeed > pSchemaWrapper->nCols) {
|
||||
colNumNeed = pSchemaWrapper->nCols;
|
||||
}
|
||||
|
||||
int32_t colMeta = 0;
|
||||
int32_t colNeed = 0;
|
||||
while (colMeta < pSchemaWrapper->nCols && colNeed < colNumNeed) {
|
||||
SSchema* pColSchema = &pSchemaWrapper->pSchema[colMeta];
|
||||
col_id_t colIdSchema = pColSchema->colId;
|
||||
col_id_t colIdNeed = *(col_id_t*)taosArrayGet(pReader->pColIdList, colNeed);
|
||||
if (colIdSchema < colIdNeed) {
|
||||
colMeta++;
|
||||
} else if (colIdSchema > colIdNeed) {
|
||||
colNeed++;
|
||||
} else {
|
||||
SColumnInfoData colInfo = createColumnInfoData(pColSchema->type, pColSchema->bytes, pColSchema->colId);
|
||||
int32_t code = blockDataAppendColInfo(pBlock, &colInfo);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto FAIL;
|
||||
}
|
||||
colMeta++;
|
||||
colNeed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (blockDataEnsureCapacity(pBlock, pReader->msgIter.numOfRows) < 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
int32_t colActual = blockDataGetNumOfCols(pBlock);
|
||||
|
||||
STSRowIter iter = {0};
|
||||
tdSTSRowIterInit(&iter, pTschema);
|
||||
STSRow* row;
|
||||
int32_t curRow = 0;
|
||||
|
||||
tInitSubmitBlkIter(&pReader->msgIter, pReader->pBlock, &pReader->blkIter);
|
||||
|
||||
pBlock->info.id.uid = pReader->msgIter.uid;
|
||||
pBlock->info.rows = pReader->msgIter.numOfRows;
|
||||
pBlock->info.version = pReader->pMsg->version;
|
||||
pBlock->info.dataLoad = 1;
|
||||
|
||||
while ((row = tGetSubmitBlkNext(&pReader->blkIter)) != NULL) {
|
||||
tdSTSRowIterReset(&iter, row);
|
||||
// get all wanted col of that block
|
||||
for (int32_t i = 0; i < colActual; i++) {
|
||||
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i);
|
||||
SCellVal sVal = {0};
|
||||
if (!tdSTSRowIterFetch(&iter, pColData->info.colId, pColData->info.type, &sVal)) {
|
||||
break;
|
||||
}
|
||||
if (colDataSetVal(pColData, curRow, sVal.val, sVal.valType != TD_VTYPE_NORM) < 0) {
|
||||
goto FAIL;
|
||||
}
|
||||
}
|
||||
curRow++;
|
||||
}
|
||||
return 0;
|
||||
|
||||
FAIL:
|
||||
blockDataFreeRes(pBlock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas) {
|
||||
int32_t sversion = htonl(pReader->pBlock->sversion);
|
||||
|
||||
if (pReader->cachedSchemaSuid == 0 || pReader->cachedSchemaVer != sversion ||
|
||||
pReader->cachedSchemaSuid != pReader->msgIter.suid) {
|
||||
if (pReader->pSchema) taosMemoryFree(pReader->pSchema);
|
||||
pReader->pSchema = metaGetTbTSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
|
||||
if (pReader->pSchema == NULL) {
|
||||
tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table",
|
||||
pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer);
|
||||
pReader->cachedSchemaSuid = 0;
|
||||
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pReader->pSchemaWrapper) tDeleteSSchemaWrapper(pReader->pSchemaWrapper);
|
||||
pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
|
||||
if (pReader->pSchemaWrapper == NULL) {
|
||||
tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table",
|
||||
pReader->msgIter.uid, pReader->cachedSchemaVer);
|
||||
pReader->cachedSchemaSuid = 0;
|
||||
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
|
||||
return -1;
|
||||
}
|
||||
pReader->cachedSchemaVer = sversion;
|
||||
pReader->cachedSchemaSuid = pReader->msgIter.suid;
|
||||
}
|
||||
|
||||
STSchema* pTschema = pReader->pSchema;
|
||||
SSchemaWrapper* pSchemaWrapper = pReader->pSchemaWrapper;
|
||||
|
||||
int32_t colAtMost = pSchemaWrapper->nCols;
|
||||
|
||||
int32_t curRow = 0;
|
||||
int32_t lastRow = 0;
|
||||
|
||||
char* assigned = taosMemoryCalloc(1, pSchemaWrapper->nCols);
|
||||
if (assigned == NULL) return -1;
|
||||
|
||||
tInitSubmitBlkIter(&pReader->msgIter, pReader->pBlock, &pReader->blkIter);
|
||||
STSRowIter iter = {0};
|
||||
tdSTSRowIterInit(&iter, pTschema);
|
||||
STSRow* row;
|
||||
|
||||
while ((row = tGetSubmitBlkNext(&pReader->blkIter)) != NULL) {
|
||||
bool buildNew = false;
|
||||
tdSTSRowIterReset(&iter, row);
|
||||
|
||||
tqDebug("vgId:%d, row of block %d", pReader->pWalReader->pWal->cfg.vgId, curRow);
|
||||
for (int32_t i = 0; i < colAtMost; i++) {
|
||||
SCellVal sVal = {0};
|
||||
if (!tdSTSRowIterFetch(&iter, pSchemaWrapper->pSchema[i].colId, pSchemaWrapper->pSchema[i].type, &sVal)) {
|
||||
break;
|
||||
}
|
||||
tqDebug("vgId:%d, %d col, type %d", pReader->pWalReader->pWal->cfg.vgId, i, sVal.valType);
|
||||
if (curRow == 0) {
|
||||
assigned[i] = sVal.valType != TD_VTYPE_NONE;
|
||||
buildNew = true;
|
||||
} else {
|
||||
bool currentRowAssigned = sVal.valType != TD_VTYPE_NONE;
|
||||
if (currentRowAssigned != assigned[i]) {
|
||||
assigned[i] = currentRowAssigned;
|
||||
buildNew = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (buildNew) {
|
||||
if (taosArrayGetSize(blocks) > 0) {
|
||||
SSDataBlock* pLastBlock = taosArrayGetLast(blocks);
|
||||
pLastBlock->info.rows = curRow - lastRow;
|
||||
lastRow = curRow;
|
||||
}
|
||||
SSDataBlock* pBlock = createDataBlock();
|
||||
SSchemaWrapper* pSW = taosMemoryCalloc(1, sizeof(SSchemaWrapper));
|
||||
if (tqMaskBlock(pSW, pBlock, pSchemaWrapper, assigned) < 0) {
|
||||
blockDataDestroy(pBlock);
|
||||
goto FAIL;
|
||||
}
|
||||
SSDataBlock block = {0};
|
||||
assignOneDataBlock(&block, pBlock);
|
||||
blockDataDestroy(pBlock);
|
||||
|
||||
tqDebug("vgId:%d, build new block, col %d", pReader->pWalReader->pWal->cfg.vgId,
|
||||
(int32_t)taosArrayGetSize(block.pDataBlock));
|
||||
|
||||
taosArrayPush(blocks, &block);
|
||||
taosArrayPush(schemas, &pSW);
|
||||
}
|
||||
|
||||
SSDataBlock* pBlock = taosArrayGetLast(blocks);
|
||||
pBlock->info.id.uid = pReader->msgIter.uid;
|
||||
pBlock->info.rows = 0;
|
||||
pBlock->info.version = pReader->pMsg->version;
|
||||
|
||||
tqDebug("vgId:%d, taosx scan, block num: %d", pReader->pWalReader->pWal->cfg.vgId,
|
||||
(int32_t)taosArrayGetSize(blocks));
|
||||
|
||||
if (blockDataEnsureCapacity(pBlock, pReader->msgIter.numOfRows - curRow) < 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
tdSTSRowIterReset(&iter, row);
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pBlock->pDataBlock); i++) {
|
||||
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i);
|
||||
SCellVal sVal = {0};
|
||||
|
||||
if (!tdSTSRowIterFetch(&iter, pColData->info.colId, pColData->info.type, &sVal)) {
|
||||
break;
|
||||
}
|
||||
|
||||
ASSERT(sVal.valType != TD_VTYPE_NONE);
|
||||
|
||||
if (colDataSetVal(pColData, curRow, sVal.val, sVal.valType == TD_VTYPE_NULL) < 0) {
|
||||
goto FAIL;
|
||||
}
|
||||
tqDebug("vgId:%d, row %d col %d append %d", pReader->pWalReader->pWal->cfg.vgId, curRow, i,
|
||||
sVal.valType == TD_VTYPE_NULL);
|
||||
}
|
||||
curRow++;
|
||||
}
|
||||
SSDataBlock* pLastBlock = taosArrayGetLast(blocks);
|
||||
pLastBlock->info.rows = curRow - lastRow;
|
||||
|
||||
taosMemoryFree(assigned);
|
||||
return 0;
|
||||
|
||||
FAIL:
|
||||
taosMemoryFree(assigned);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t tqRetrieveTaosxBlock2(STqReader* pReader, SArray* blocks, SArray* schemas, SSubmitTbData** pSubmitTbDataRet) {
|
||||
tqDebug("tq reader retrieve data block %p, %d", pReader->msg2.msgStr, pReader->nextBlk);
|
||||
|
||||
|
|
|
@ -71,37 +71,25 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
|
|||
int32_t totalRows = 0;
|
||||
|
||||
const STqExecHandle* pExec = &pHandle->execHandle;
|
||||
qTaskInfo_t task = pExec->task;
|
||||
qTaskInfo_t task = pExec->task;
|
||||
|
||||
if (qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType) < 0) {
|
||||
tqDebug("prepare scan failed, vgId:%d, consumer:0x%"PRIx64, vgId, pHandle->consumerId);
|
||||
if (pOffset->type == TMQ_OFFSET__LOG) {
|
||||
pRsp->rspOffset = *pOffset;
|
||||
return code;
|
||||
} else {
|
||||
tqOffsetResetToLog(pOffset, pHandle->snapshotVer);
|
||||
if (qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType) < 0) {
|
||||
tqDebug("prepare scan failed, vgId:%d, consumer:0x%"PRIx64, vgId, pHandle->consumerId);
|
||||
pRsp->rspOffset = *pOffset;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
tqError("prepare scan failed, return");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
SSDataBlock* pDataBlock = NULL;
|
||||
uint64_t ts = 0;
|
||||
|
||||
tqDebug("vgId:%d, tmq task start to execute, consumer:0x%"PRIx64, vgId, pHandle->consumerId);
|
||||
|
||||
code = qExecTask(task, &pDataBlock, &ts);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tqError("vgId:%d, task exec error since %s, consumer:0x%" PRIx64, vgId, terrstr(),
|
||||
pHandle->consumerId);
|
||||
return code;
|
||||
qStreamSetOpen(task);
|
||||
tqDebug("consumer:0x%"PRIx64" vgId:%d, tmq one task start execute", pHandle->consumerId, vgId);
|
||||
if (qExecTask(task, &pDataBlock, &ts) != TSDB_CODE_SUCCESS) {
|
||||
tqError("consumer:0x%"PRIx64" vgId:%d, task exec error since %s", pHandle->consumerId, vgId, terrstr());
|
||||
return -1;
|
||||
}
|
||||
|
||||
// current scan should be stopped ASAP, since the re-balance occurs.
|
||||
tqDebug("consumer:0x%"PRIx64" vgId:%d tmq one task end executed, pDataBlock:%p", pHandle->consumerId, vgId, pDataBlock);
|
||||
// current scan should be stopped asap, since the rebalance occurs.
|
||||
if (pDataBlock == NULL) {
|
||||
break;
|
||||
}
|
||||
|
@ -113,37 +101,15 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
|
|||
}
|
||||
|
||||
pRsp->blockNum++;
|
||||
|
||||
tqDebug("vgId:%d, consumer:0x%" PRIx64 " tmq task executed, rows:%" PRId64 ", total blocks:%d", vgId, pHandle->consumerId,
|
||||
pDataBlock->info.rows, pRsp->blockNum);
|
||||
|
||||
if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
totalRows += pDataBlock->info.rows;
|
||||
if (totalRows >= MAX_ROWS_TO_RETURN) {
|
||||
break;
|
||||
}
|
||||
totalRows += pDataBlock->info.rows;
|
||||
if (totalRows >= MAX_ROWS_TO_RETURN) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tqDebug("consumer:0x%"PRIx64" vgId:%d tmq task executed finished, total blocks:%d, totalRows:%d", pHandle->consumerId, vgId, pRsp->blockNum, totalRows);
|
||||
qStreamExtractOffset(task, &pRsp->rspOffset);
|
||||
|
||||
if (pRsp->rspOffset.type == 0) {
|
||||
code = TSDB_CODE_INVALID_PARA;
|
||||
tqError("vgId:%d, expected rsp offset: type %d %" PRId64 " %" PRId64 " %" PRId64, vgId, pRsp->rspOffset.type,
|
||||
pRsp->rspOffset.ts, pRsp->rspOffset.uid, pRsp->rspOffset.version);
|
||||
return code;
|
||||
}
|
||||
|
||||
if (pRsp->withTbName || pRsp->withSchema) {
|
||||
code = TSDB_CODE_INVALID_PARA;
|
||||
tqError("vgId:%d, get column should not with meta:%d,%d", vgId, pRsp->withTbName, pRsp->withSchema);
|
||||
return code;
|
||||
}
|
||||
|
||||
tqDebug("vgId:%d, consumer:0x%" PRIx64 " tmq task executed, total blocks:%d, rows:%d", vgId, pHandle->consumerId,
|
||||
pRsp->blockNum, totalRows);
|
||||
|
||||
return code;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMetaRsp* pMetaRsp, STqOffsetVal* pOffset) {
|
||||
|
@ -151,18 +117,8 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
|
|||
qTaskInfo_t task = pExec->task;
|
||||
|
||||
if (qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType) < 0) {
|
||||
tqDebug("prepare scan failed, return");
|
||||
if (pOffset->type == TMQ_OFFSET__LOG) {
|
||||
pRsp->rspOffset = *pOffset;
|
||||
return 0;
|
||||
} else {
|
||||
tqOffsetResetToLog(pOffset, pHandle->snapshotVer);
|
||||
if (qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType) < 0) {
|
||||
tqDebug("prepare scan failed, return");
|
||||
pRsp->rspOffset = *pOffset;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
tqDebug("tqScanTaosx prepare scan failed, return");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t rowCnt = 0;
|
||||
|
@ -208,42 +164,31 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
|
|||
}
|
||||
}
|
||||
|
||||
if (pDataBlock == NULL && pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
if (qStreamExtractPrepareUid(task) != 0) {
|
||||
// get meta
|
||||
SMqMetaRsp* tmp = qStreamExtractMetaMsg(task);
|
||||
if (tmp->metaRspLen > 0) {
|
||||
qStreamExtractOffset(task, &tmp->rspOffset);
|
||||
*pMetaRsp = *tmp;
|
||||
|
||||
tqDebug("tmqsnap task get meta");
|
||||
break;
|
||||
}
|
||||
|
||||
if (pDataBlock == NULL) {
|
||||
qStreamExtractOffset(task, pOffset);
|
||||
if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
continue;
|
||||
}
|
||||
tqDebug("tmqsnap vgId: %d, tsdb consume over, switch to wal, ver %" PRId64, TD_VID(pTq->pVnode),
|
||||
pHandle->snapshotVer + 1);
|
||||
tqDebug("tmqsnap vgId: %d, tsdb consume over, switch to wal, ver %" PRId64, TD_VID(pTq->pVnode), pHandle->snapshotVer + 1);
|
||||
qStreamExtractOffset(task, &pRsp->rspOffset);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pRsp->blockNum > 0) {
|
||||
tqDebug("tmqsnap task exec exited, get data");
|
||||
qStreamExtractOffset(task, &pRsp->rspOffset);
|
||||
break;
|
||||
}
|
||||
|
||||
SMqMetaRsp* tmp = qStreamExtractMetaMsg(task);
|
||||
if (tmp->rspOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
tqOffsetResetToData(pOffset, tmp->rspOffset.uid, tmp->rspOffset.ts);
|
||||
qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType);
|
||||
tmp->rspOffset.type = TMQ_OFFSET__SNAPSHOT_META;
|
||||
tqDebug("tmqsnap task exec change to get data");
|
||||
continue;
|
||||
}
|
||||
|
||||
*pMetaRsp = *tmp;
|
||||
tqDebug("tmqsnap task exec exited, get meta");
|
||||
|
||||
tqDebug("task exec exited");
|
||||
break;
|
||||
}
|
||||
|
||||
qStreamExtractOffset(task, &pRsp->rspOffset);
|
||||
|
||||
if (pRsp->rspOffset.type == 0) {
|
||||
tqError("expected rsp offset: type %d %" PRId64 " %" PRId64 " %" PRId64, pRsp->rspOffset.type, pRsp->rspOffset.ts,
|
||||
pRsp->rspOffset.uid, pRsp->rspOffset.version);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -959,14 +959,15 @@ static void setBlockAllDumped(SFileBlockDumpInfo* pDumpInfo, int64_t maxKey, int
|
|||
}
|
||||
|
||||
static int32_t doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_t colIndex, SColVal* pColVal,
|
||||
SBlockLoadSuppInfo* pSup) {
|
||||
SBlockLoadSuppInfo* pSup) {
|
||||
if (IS_VAR_DATA_TYPE(pColVal->type)) {
|
||||
if (!COL_VAL_IS_VALUE(pColVal)) {
|
||||
colDataSetNULL(pColInfoData, rowIndex);
|
||||
} else {
|
||||
varDataSetLen(pSup->buildBuf[colIndex], pColVal->value.nData);
|
||||
if (pColVal->value.nData > pColInfoData->info.bytes) {
|
||||
tsdbWarn("column cid:%d actual data len %d is bigger than schema len %d", pColVal->cid, pColVal->value.nData, pColInfoData->info.bytes);
|
||||
tsdbWarn("column cid:%d actual data len %d is bigger than schema len %d", pColVal->cid, pColVal->value.nData,
|
||||
pColInfoData->info.bytes);
|
||||
return TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER;
|
||||
}
|
||||
if (pColVal->value.nData > 0) { // pData may be null, if nData is 0
|
||||
|
@ -1794,7 +1795,7 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo*
|
|||
}
|
||||
|
||||
static bool tryCopyDistinctRowFromFileBlock(STsdbReader* pReader, SBlockData* pBlockData, int64_t key,
|
||||
SFileBlockDumpInfo* pDumpInfo, bool *copied) {
|
||||
SFileBlockDumpInfo* pDumpInfo, bool* copied) {
|
||||
// opt version
|
||||
// 1. it is not a border point
|
||||
// 2. the direct next point is not an duplicated timestamp
|
||||
|
@ -1843,7 +1844,8 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc
|
|||
}
|
||||
|
||||
static bool tryCopyDistinctRowFromSttBlock(TSDBROW* fRow, SLastBlockReader* pLastBlockReader,
|
||||
STableBlockScanInfo* pScanInfo, int64_t ts, STsdbReader* pReader, bool *copied) {
|
||||
STableBlockScanInfo* pScanInfo, int64_t ts, STsdbReader* pReader,
|
||||
bool* copied) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
*copied = false;
|
||||
|
@ -1856,7 +1858,7 @@ static bool tryCopyDistinctRowFromSttBlock(TSDBROW* fRow, SLastBlockReader* pLas
|
|||
if (code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
*copied = true;
|
||||
return code;
|
||||
}
|
||||
|
@ -1865,7 +1867,7 @@ static bool tryCopyDistinctRowFromSttBlock(TSDBROW* fRow, SLastBlockReader* pLas
|
|||
if (code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
*copied = true;
|
||||
return code;
|
||||
}
|
||||
|
@ -1967,7 +1969,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (pReader->order == TSDB_ORDER_ASC) {
|
||||
if (minKey == key) {
|
||||
init = true;
|
||||
int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -1977,10 +1979,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (minKey == tsLast) {
|
||||
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
|
||||
if (init) {
|
||||
tsdbRowMerge(&merge, &fRow1);
|
||||
tsdbRowMergerAdd(&merge, &fRow1, NULL);
|
||||
} else {
|
||||
init = true;
|
||||
int32_t code = tsdbRowMergerInit(&merge, &fRow1, pReader->pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow1, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -1997,7 +1999,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
tsdbRowMergerAdd(&merge, pRow, pSchema);
|
||||
} else {
|
||||
init = true;
|
||||
int32_t code = tsdbRowMergerInit(&merge, pRow, pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2011,7 +2013,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (minKey == k.ts) {
|
||||
init = true;
|
||||
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
|
||||
int32_t code = tsdbRowMergerInit(&merge, pRow, pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2025,10 +2027,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (minKey == tsLast) {
|
||||
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
|
||||
if (init) {
|
||||
tsdbRowMerge(&merge, &fRow1);
|
||||
tsdbRowMergerAdd(&merge, &fRow1, NULL);
|
||||
} else {
|
||||
init = true;
|
||||
int32_t code = tsdbRowMergerInit(&merge, &fRow1, pReader->pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow1, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2038,10 +2040,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
|
||||
if (minKey == key) {
|
||||
if (init) {
|
||||
tsdbRowMerge(&merge, &fRow);
|
||||
tsdbRowMergerAdd(&merge, &fRow, NULL);
|
||||
} else {
|
||||
init = true;
|
||||
int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2068,11 +2070,11 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
|
|||
bool mergeBlockData) {
|
||||
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
||||
int64_t tsLastBlock = getCurrentKeyInLastBlock(pLastBlockReader);
|
||||
bool copied = false;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SRow* pTSRow = NULL;
|
||||
SRowMerger merge = {0};
|
||||
TSDBROW fRow = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
|
||||
bool copied = false;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SRow* pTSRow = NULL;
|
||||
SRowMerger merge = {0};
|
||||
TSDBROW fRow = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
|
||||
tsdbTrace("fRow ptr:%p, %d, uid:%" PRIu64 ", %s", fRow.pBlockData, fRow.iRow, pLastBlockReader->uid, pReader->idStr);
|
||||
|
||||
// only last block exists
|
||||
|
@ -2081,18 +2083,18 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
|
|||
if (code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
if (copied) {
|
||||
pBlockScanInfo->lastKey = tsLastBlock;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else {
|
||||
int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
||||
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
|
||||
tsdbRowMerge(&merge, &fRow1);
|
||||
tsdbRowMergerAdd(&merge, &fRow1, NULL);
|
||||
doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange, pReader->idStr);
|
||||
|
||||
code = tsdbRowMergerGetRow(&merge, &pTSRow);
|
||||
|
@ -2108,10 +2110,9 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
|
|||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
||||
} else { // not merge block data
|
||||
int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2163,7 +2164,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader
|
|||
SRow* pTSRow = NULL;
|
||||
SRowMerger merge = {0};
|
||||
|
||||
int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2171,7 +2172,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader
|
|||
doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
|
||||
|
||||
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
|
||||
tsdbRowMerge(&merge, &fRow1);
|
||||
tsdbRowMergerAdd(&merge, &fRow1, NULL);
|
||||
|
||||
doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge, &pReader->verRange, pReader->idStr);
|
||||
|
||||
|
@ -2262,7 +2263,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (minKey == key) {
|
||||
init = true;
|
||||
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
|
||||
code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
|
||||
code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2273,10 +2274,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (minKey == tsLast) {
|
||||
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
|
||||
if (init) {
|
||||
tsdbRowMerge(&merge, &fRow1);
|
||||
tsdbRowMergerAdd(&merge, &fRow1, NULL);
|
||||
} else {
|
||||
init = true;
|
||||
code = tsdbRowMergerInit(&merge, &fRow1, pReader->pSchema);
|
||||
code = tsdbRowMergerInit(&merge, NULL, &fRow1, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2287,7 +2288,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
|
||||
if (minKey == ik.ts) {
|
||||
if (init) {
|
||||
tsdbRowMerge(&merge, piRow);
|
||||
tsdbRowMergerAdd(&merge, piRow, NULL);
|
||||
} else {
|
||||
init = true;
|
||||
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
|
||||
|
@ -2295,7 +2296,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
return code;
|
||||
}
|
||||
|
||||
code = tsdbRowMergerInit(&merge, piRow, pSchema);
|
||||
code = tsdbRowMergerInit(&merge, NULL, piRow, pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2314,10 +2315,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
return code;
|
||||
}
|
||||
|
||||
tsdbRowMerge(&merge, pRow);
|
||||
tsdbRowMergerAdd(&merge, pRow, NULL);
|
||||
} else {
|
||||
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
|
||||
code = tsdbRowMergerInit(&merge, pRow, pSchema);
|
||||
code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2332,7 +2333,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (minKey == k.ts) {
|
||||
init = true;
|
||||
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
|
||||
code = tsdbRowMergerInit(&merge, pRow, pSchema);
|
||||
code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2346,11 +2347,11 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
|
||||
if (minKey == ik.ts) {
|
||||
if (init) {
|
||||
tsdbRowMerge(&merge, piRow);
|
||||
tsdbRowMergerAdd(&merge, piRow, NULL);
|
||||
} else {
|
||||
init = true;
|
||||
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
|
||||
code = tsdbRowMergerInit(&merge, piRow, pSchema);
|
||||
code = tsdbRowMergerInit(&merge, NULL, piRow, pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2365,10 +2366,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (minKey == tsLast) {
|
||||
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
|
||||
if (init) {
|
||||
tsdbRowMerge(&merge, &fRow1);
|
||||
tsdbRowMergerAdd(&merge, &fRow1, NULL);
|
||||
} else {
|
||||
init = true;
|
||||
code = tsdbRowMergerInit(&merge, &fRow1, pReader->pSchema);
|
||||
code = tsdbRowMergerInit(&merge, NULL, &fRow1, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2379,7 +2380,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (minKey == key) {
|
||||
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
|
||||
if (!init) {
|
||||
code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
|
||||
code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2387,7 +2388,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
if (merge.pTSchema == NULL) {
|
||||
return code;
|
||||
}
|
||||
tsdbRowMerge(&merge, &fRow);
|
||||
tsdbRowMergerAdd(&merge, &fRow, NULL);
|
||||
}
|
||||
doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
|
||||
}
|
||||
|
@ -2557,12 +2558,12 @@ bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo*
|
|||
int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBlockScanInfo, int64_t key,
|
||||
STsdbReader* pReader) {
|
||||
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
||||
bool copied = false;
|
||||
int32_t code = tryCopyDistinctRowFromFileBlock(pReader, pBlockData, key, pDumpInfo, &copied);
|
||||
bool copied = false;
|
||||
int32_t code = tryCopyDistinctRowFromFileBlock(pReader, pBlockData, key, pDumpInfo, &copied);
|
||||
if (code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
if (copied) {
|
||||
pBlockScanInfo->lastKey = key;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -2572,7 +2573,7 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc
|
|||
SRow* pTSRow = NULL;
|
||||
SRowMerger merge = {0};
|
||||
|
||||
int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2758,7 +2759,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
|
|||
if (code) {
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
||||
// currently loaded file data block is consumed
|
||||
if ((pBlockData->nRow > 0) && (pDumpInfo->rowIndex >= pBlockData->nRow || pDumpInfo->rowIndex < 0)) {
|
||||
SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter);
|
||||
|
@ -2776,8 +2777,8 @@ _end:
|
|||
updateComposedBlockInfo(pReader, el, pBlockScanInfo);
|
||||
|
||||
if (pResBlock->info.rows > 0) {
|
||||
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64
|
||||
" rows:%" PRId64 ", elapsed time:%.2f ms %s",
|
||||
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64 " rows:%" PRId64
|
||||
", elapsed time:%.2f ms %s",
|
||||
pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey,
|
||||
pResBlock->info.rows, el, pReader->idStr);
|
||||
}
|
||||
|
@ -3018,7 +3019,7 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
|
|||
if (code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
if (pResBlock->info.rows >= pReader->capacity) {
|
||||
break;
|
||||
}
|
||||
|
@ -3028,8 +3029,8 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
|
|||
updateComposedBlockInfo(pReader, el, pScanInfo);
|
||||
|
||||
if (pResBlock->info.rows > 0) {
|
||||
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64
|
||||
" rows:%" PRId64 ", elapsed time:%.2f ms %s",
|
||||
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64 " rows:%" PRId64
|
||||
", elapsed time:%.2f ms %s",
|
||||
pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey,
|
||||
pResBlock->info.rows, el, pReader->idStr);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -3102,7 +3103,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
|
|||
if (code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
if (pResBlock->info.rows >= pReader->capacity) {
|
||||
break;
|
||||
}
|
||||
|
@ -3112,8 +3113,8 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
|
|||
updateComposedBlockInfo(pReader, el, pScanInfo);
|
||||
|
||||
if (pResBlock->info.rows > 0) {
|
||||
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64
|
||||
" rows:%" PRId64 ", elapsed time:%.2f ms %s",
|
||||
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64 " rows:%" PRId64
|
||||
", elapsed time:%.2f ms %s",
|
||||
pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey,
|
||||
pResBlock->info.rows, el, pReader->idStr);
|
||||
}
|
||||
|
@ -3139,7 +3140,6 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
static int32_t doSumFileBlockRows(STsdbReader* pReader, SDataFReader* pFileReader) {
|
||||
int64_t st = taosGetTimestampUs();
|
||||
LRUHandle* handle = NULL;
|
||||
|
@ -3157,8 +3157,8 @@ static int32_t doSumFileBlockRows(STsdbReader* pReader, SDataFReader* pFileReade
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
SBlockIdx* pBlockIdx = NULL;
|
||||
int32_t i = 0;
|
||||
SBlockIdx* pBlockIdx = NULL;
|
||||
int32_t i = 0;
|
||||
for (int32_t i = 0; i < num; ++i) {
|
||||
pBlockIdx = (SBlockIdx*)taosArrayGet(aBlockIdx, i);
|
||||
if (pBlockIdx->suid != pReader->suid) {
|
||||
|
@ -3170,7 +3170,7 @@ static int32_t doSumFileBlockRows(STsdbReader* pReader, SDataFReader* pFileReade
|
|||
continue;
|
||||
}
|
||||
|
||||
STableBlockScanInfo *pScanInfo = *p;
|
||||
STableBlockScanInfo* pScanInfo = *p;
|
||||
tMapDataReset(&pScanInfo->mapData);
|
||||
tsdbReadDataBlk(pReader->pFileReader, pBlockIdx, &pScanInfo->mapData);
|
||||
|
||||
|
@ -3186,15 +3186,14 @@ _end:
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
static int32_t doSumSttBlockRows(STsdbReader* pReader) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SLastBlockReader* pLastBlockReader = pReader->status.fileIter.pLastBlockReader;
|
||||
SSttBlockLoadInfo* pBlockLoadInfo = NULL;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SLastBlockReader* pLastBlockReader = pReader->status.fileIter.pLastBlockReader;
|
||||
SSttBlockLoadInfo* pBlockLoadInfo = NULL;
|
||||
|
||||
for (int32_t i = 0; i < pReader->pFileReader->pSet->nSttF; ++i) { // open all last file
|
||||
pBlockLoadInfo = &pLastBlockReader->pInfo[i];
|
||||
|
||||
|
||||
code = tsdbReadSttBlk(pReader->pFileReader, i, pBlockLoadInfo->aSttBlk);
|
||||
if (code) {
|
||||
return code;
|
||||
|
@ -3202,9 +3201,9 @@ static int32_t doSumSttBlockRows(STsdbReader* pReader) {
|
|||
|
||||
size_t size = taosArrayGetSize(pBlockLoadInfo->aSttBlk);
|
||||
if (size >= 1) {
|
||||
SSttBlk *pStart = taosArrayGet(pBlockLoadInfo->aSttBlk, 0);
|
||||
SSttBlk *pEnd = taosArrayGet(pBlockLoadInfo->aSttBlk, size - 1);
|
||||
|
||||
SSttBlk* pStart = taosArrayGet(pBlockLoadInfo->aSttBlk, 0);
|
||||
SSttBlk* pEnd = taosArrayGet(pBlockLoadInfo->aSttBlk, size - 1);
|
||||
|
||||
// all identical
|
||||
if (pStart->suid == pEnd->suid) {
|
||||
if (pStart->suid != pReader->suid) {
|
||||
|
@ -3213,17 +3212,17 @@ static int32_t doSumSttBlockRows(STsdbReader* pReader) {
|
|||
continue;
|
||||
}
|
||||
for (int32_t i = 0; i < size; ++i) {
|
||||
SSttBlk *p = taosArrayGet(pBlockLoadInfo->aSttBlk, i);
|
||||
SSttBlk* p = taosArrayGet(pBlockLoadInfo->aSttBlk, i);
|
||||
pReader->rowsNum += p->nRow;
|
||||
}
|
||||
} else {
|
||||
for (int32_t i = 0; i < size; ++i) {
|
||||
SSttBlk *p = taosArrayGet(pBlockLoadInfo->aSttBlk, i);
|
||||
SSttBlk* p = taosArrayGet(pBlockLoadInfo->aSttBlk, i);
|
||||
uint64_t s = p->suid;
|
||||
if (s < pReader->suid) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (s == pReader->suid) {
|
||||
pReader->rowsNum += p->nRow;
|
||||
} else if (s > pReader->suid) {
|
||||
|
@ -3238,7 +3237,7 @@ static int32_t doSumSttBlockRows(STsdbReader* pReader) {
|
|||
}
|
||||
|
||||
static int32_t readRowsCountFromFiles(STsdbReader* pReader) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
while (1) {
|
||||
bool hasNext = false;
|
||||
|
@ -3259,7 +3258,7 @@ static int32_t readRowsCountFromFiles(STsdbReader* pReader) {
|
|||
code = doSumSttBlockRows(pReader);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pReader->status.loadFromFile = false;
|
||||
|
@ -3268,8 +3267,8 @@ static int32_t readRowsCountFromFiles(STsdbReader* pReader) {
|
|||
}
|
||||
|
||||
static int32_t readRowsCountFromMem(STsdbReader* pReader) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int64_t memNum = 0, imemNum = 0;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int64_t memNum = 0, imemNum = 0;
|
||||
if (pReader->pReadSnap->pMem != NULL) {
|
||||
tsdbMemTableCountRows(pReader->pReadSnap->pMem, pReader->status.pTableMap, &memNum);
|
||||
}
|
||||
|
@ -3283,7 +3282,6 @@ static int32_t readRowsCountFromMem(STsdbReader* pReader) {
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader) {
|
||||
SReaderStatus* pStatus = &pReader->status;
|
||||
STableUidList* pUidList = &pStatus->uidList;
|
||||
|
@ -3696,7 +3694,7 @@ int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDe
|
|||
|
||||
tsdbRowMergerAdd(pMerger, pRow, pTSchema);
|
||||
} else { // column format
|
||||
tsdbRowMerge(pMerger, pRow);
|
||||
tsdbRowMergerAdd(pMerger, pRow, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3712,7 +3710,7 @@ static int32_t doMergeRowsInFileBlockImpl(SBlockData* pBlockData, int32_t rowInd
|
|||
}
|
||||
|
||||
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, rowIndex);
|
||||
tsdbRowMerge(pMerger, &fRow);
|
||||
tsdbRowMergerAdd(pMerger, &fRow, NULL);
|
||||
rowIndex += step;
|
||||
}
|
||||
|
||||
|
@ -3790,7 +3788,7 @@ int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockSc
|
|||
int64_t next1 = getCurrentKeyInLastBlock(pLastBlockReader);
|
||||
if (next1 == ts) {
|
||||
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
|
||||
tsdbRowMerge(pMerger, &fRow1);
|
||||
tsdbRowMergerAdd(pMerger, &fRow1, NULL);
|
||||
} else {
|
||||
tsdbTrace("uid:%" PRIu64 " last del index:%d, del range:%d, lastKeyInStt:%" PRId64 ", %s", pScanInfo->uid,
|
||||
pScanInfo->lastBlockDelIndex, (int32_t)taosArrayGetSize(pScanInfo->delSkyline), pScanInfo->lastKeyInStt,
|
||||
|
@ -3846,7 +3844,7 @@ int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter,
|
|||
pReader->pSchema = pTSchema;
|
||||
}
|
||||
|
||||
code = tsdbRowMergerInit2(&merge, pReader->pSchema, ¤t, pTSchema);
|
||||
code = tsdbRowMergerInit(&merge, pReader->pSchema, ¤t, pTSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -3858,12 +3856,12 @@ int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter,
|
|||
|
||||
tsdbRowMergerAdd(&merge, pNextRow, pTSchema1);
|
||||
} else { // let's merge rows in file block
|
||||
code = tsdbRowMergerInit(&merge, ¤t, pReader->pSchema);
|
||||
code = tsdbRowMergerInit(&merge, NULL, ¤t, pReader->pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
||||
tsdbRowMerge(&merge, pNextRow);
|
||||
tsdbRowMergerAdd(&merge, pNextRow, NULL);
|
||||
}
|
||||
|
||||
code = doMergeRowsInBuf(pIter, uid, TSDBROW_TS(¤t), pDelList, &merge, pReader);
|
||||
|
@ -3887,14 +3885,13 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
|
|||
SRow** pTSRow) {
|
||||
SRowMerger merge = {0};
|
||||
|
||||
TSDBKEY k = TSDBROW_KEY(pRow);
|
||||
TSDBKEY ik = TSDBROW_KEY(piRow);
|
||||
TSDBKEY k = TSDBROW_KEY(pRow);
|
||||
TSDBKEY ik = TSDBROW_KEY(piRow);
|
||||
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
|
||||
STSchema* piSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
|
||||
|
||||
if (ASCENDING_TRAVERSE(pReader->order)) { // ascending order imem --> mem
|
||||
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
|
||||
STSchema* piSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
|
||||
|
||||
int32_t code = tsdbRowMergerInit2(&merge, pSchema, piRow, piSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, pSchema, piRow, piSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -3913,9 +3910,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
|
|||
}
|
||||
|
||||
} else {
|
||||
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
|
||||
|
||||
int32_t code = tsdbRowMergerInit(&merge, pRow, pSchema);
|
||||
int32_t code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS || merge.pTSchema == NULL) {
|
||||
return code;
|
||||
}
|
||||
|
@ -3926,7 +3921,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
|
|||
return code;
|
||||
}
|
||||
|
||||
tsdbRowMerge(&merge, piRow);
|
||||
tsdbRowMergerAdd(&merge, piRow, piSchema);
|
||||
code = doMergeRowsInBuf(&pBlockScanInfo->iiter, pBlockScanInfo->uid, ik.ts, pBlockScanInfo->delSkyline, &merge,
|
||||
pReader);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
|
@ -4000,7 +3995,7 @@ int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pR
|
|||
int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pTSRow, STableBlockScanInfo* pScanInfo) {
|
||||
int32_t outputRowIndex = pBlock->info.rows;
|
||||
int64_t uid = pScanInfo->uid;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
int32_t numOfCols = (int32_t)taosArrayGetSize(pBlock->pDataBlock);
|
||||
|
||||
|
@ -4106,7 +4101,7 @@ int32_t doAppendRowFromFileBlock(SSDataBlock* pResBlock, STsdbReader* pReader, S
|
|||
int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity,
|
||||
STsdbReader* pReader) {
|
||||
SSDataBlock* pBlock = pReader->pResBlock;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
do {
|
||||
// SRow* pTSRow = NULL;
|
||||
|
@ -4342,7 +4337,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
|
|||
if (countOnly) {
|
||||
pReader->readMode = READ_MODE_COUNT_ONLY;
|
||||
}
|
||||
|
||||
|
||||
tsdbDebug("%p total numOfTable:%d in this query %s", pReader, numOfTables, pReader->idStr);
|
||||
return code;
|
||||
|
||||
|
@ -4644,7 +4639,7 @@ _err:
|
|||
}
|
||||
|
||||
static bool tsdbReadRowsCountOnly(STsdbReader* pReader) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SSDataBlock* pBlock = pReader->pResBlock;
|
||||
|
||||
if (pReader->status.loadFromFile == false) {
|
||||
|
@ -4664,15 +4659,15 @@ static bool tsdbReadRowsCountOnly(STsdbReader* pReader) {
|
|||
pBlock->info.rows = pReader->rowsNum;
|
||||
pBlock->info.id.uid = 0;
|
||||
pBlock->info.dataLoad = 0;
|
||||
|
||||
|
||||
pReader->rowsNum = 0;
|
||||
|
||||
|
||||
return pBlock->info.rows > 0;
|
||||
}
|
||||
|
||||
static int32_t doTsdbNextDataBlock(STsdbReader* pReader, bool *hasNext) {
|
||||
static int32_t doTsdbNextDataBlock(STsdbReader* pReader, bool* hasNext) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
|
||||
// cleanup the data that belongs to the previous data block
|
||||
SSDataBlock* pBlock = pReader->pResBlock;
|
||||
blockDataCleanup(pBlock);
|
||||
|
@ -4707,11 +4702,11 @@ static int32_t doTsdbNextDataBlock(STsdbReader* pReader, bool *hasNext) {
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbNextDataBlock(STsdbReader* pReader, bool *hasNext) {
|
||||
int32_t tsdbNextDataBlock(STsdbReader* pReader, bool* hasNext) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
*hasNext = false;
|
||||
|
||||
|
||||
if (isEmptyQueryTimeWindow(&pReader->window) || pReader->step == EXTERNAL_ROWS_NEXT) {
|
||||
return code;
|
||||
}
|
||||
|
@ -4731,7 +4726,7 @@ int32_t tsdbNextDataBlock(STsdbReader* pReader, bool *hasNext) {
|
|||
tsdbReleaseReader(pReader);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
pReader->step = EXTERNAL_ROWS_PREV;
|
||||
if (*hasNext) {
|
||||
pStatus = &pReader->innerReader[0]->status;
|
||||
|
@ -4762,7 +4757,7 @@ int32_t tsdbNextDataBlock(STsdbReader* pReader, bool *hasNext) {
|
|||
tsdbReleaseReader(pReader);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
if (*hasNext) {
|
||||
if (pStatus->composedDataBlock) {
|
||||
qTrace("tsdb/read: %p, unlock read mutex", pReader);
|
||||
|
@ -4786,7 +4781,7 @@ int32_t tsdbNextDataBlock(STsdbReader* pReader, bool *hasNext) {
|
|||
tsdbReleaseReader(pReader);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
pReader->step = EXTERNAL_ROWS_NEXT;
|
||||
if (*hasNext) {
|
||||
pStatus = &pReader->innerReader[1]->status;
|
||||
|
|
|
@ -638,13 +638,17 @@ SColVal *tsdbRowIterNext(STSDBRowIter *pIter) {
|
|||
|
||||
// SRowMerger ======================================================
|
||||
|
||||
int32_t tsdbRowMergerInit2(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRow, STSchema *pTSchema) {
|
||||
int32_t tsdbRowMergerInit(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRow, STSchema *pTSchema) {
|
||||
int32_t code = 0;
|
||||
TSDBKEY key = TSDBROW_KEY(pRow);
|
||||
SColVal *pColVal = &(SColVal){0};
|
||||
STColumn *pTColumn;
|
||||
int32_t iCol, jCol = 0;
|
||||
|
||||
if (NULL == pResTSchema) {
|
||||
pResTSchema = pTSchema;
|
||||
}
|
||||
|
||||
pMerger->pTSchema = pResTSchema;
|
||||
pMerger->version = key.version;
|
||||
|
||||
|
@ -712,6 +716,9 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
|
|||
STColumn *pTColumn;
|
||||
int32_t iCol, jCol = 1;
|
||||
|
||||
if (NULL == pTSchema) {
|
||||
pTSchema = pMerger->pTSchema;
|
||||
}
|
||||
ASSERT(((SColVal *)pMerger->pArray->pData)->value.val == key.ts);
|
||||
|
||||
for (iCol = 1; iCol < pMerger->pTSchema->numOfCols && jCol < pTSchema->numOfCols; ++iCol) {
|
||||
|
@ -727,23 +734,6 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
|
|||
tsdbRowGetColVal(pRow, pTSchema, jCol++, pColVal);
|
||||
|
||||
if (key.version > pMerger->version) {
|
||||
#if 0
|
||||
if (!COL_VAL_IS_NONE(pColVal)) {
|
||||
if ((!COL_VAL_IS_NULL(pColVal)) && IS_VAR_DATA_TYPE(pColVal->type)) {
|
||||
SColVal *tColVal = taosArrayGet(pMerger->pArray, iCol);
|
||||
code = tRealloc(&tColVal->value.pData, pColVal->value.nData);
|
||||
if (code) return code;
|
||||
|
||||
tColVal->value.nData = pColVal->value.nData;
|
||||
if (pColVal->value.nData) {
|
||||
memcpy(tColVal->value.pData, pColVal->value.pData, pColVal->value.nData);
|
||||
}
|
||||
tColVal->flag = 0;
|
||||
} else {
|
||||
taosArraySet(pMerger->pArray, iCol, pColVal);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!COL_VAL_IS_NONE(pColVal)) {
|
||||
if (IS_VAR_DATA_TYPE(pColVal->type)) {
|
||||
SColVal *pTColVal = taosArrayGet(pMerger->pArray, iCol);
|
||||
|
@ -758,7 +748,6 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
|
|||
pTColVal->flag = 0;
|
||||
} else {
|
||||
tFree(pTColVal->value.pData);
|
||||
pTColVal->value.pData = NULL;
|
||||
taosArraySet(pMerger->pArray, iCol, pColVal);
|
||||
}
|
||||
} else {
|
||||
|
@ -789,7 +778,7 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
|
|||
pMerger->version = key.version;
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
int32_t tsdbRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) {
|
||||
int32_t code = 0;
|
||||
TSDBKEY key = TSDBROW_KEY(pRow);
|
||||
|
@ -840,7 +829,7 @@ int32_t tsdbRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema
|
|||
_exit:
|
||||
return code;
|
||||
}
|
||||
|
||||
*/
|
||||
void tsdbRowMergerClear(SRowMerger *pMerger) {
|
||||
for (int32_t iCol = 1; iCol < pMerger->pTSchema->numOfCols; iCol++) {
|
||||
SColVal *pTColVal = taosArrayGet(pMerger->pArray, iCol);
|
||||
|
@ -851,7 +840,7 @@ void tsdbRowMergerClear(SRowMerger *pMerger) {
|
|||
|
||||
taosArrayDestroy(pMerger->pArray);
|
||||
}
|
||||
|
||||
/*
|
||||
int32_t tsdbRowMerge(SRowMerger *pMerger, TSDBROW *pRow) {
|
||||
int32_t code = 0;
|
||||
TSDBKEY key = TSDBROW_KEY(pRow);
|
||||
|
@ -916,7 +905,7 @@ int32_t tsdbRowMerge(SRowMerger *pMerger, TSDBROW *pRow) {
|
|||
_exit:
|
||||
return code;
|
||||
}
|
||||
|
||||
*/
|
||||
int32_t tsdbRowMergerGetRow(SRowMerger *pMerger, SRow **ppRow) {
|
||||
return tRowBuild(pMerger->pArray, pMerger->pTSchema, ppRow);
|
||||
}
|
||||
|
|
|
@ -541,6 +541,7 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
|
|||
return vnodeGetBatchMeta(pVnode, pMsg);
|
||||
case TDMT_VND_TMQ_CONSUME:
|
||||
return tqProcessPollReq(pVnode->pTq, pMsg);
|
||||
|
||||
case TDMT_STREAM_TASK_RUN:
|
||||
return tqProcessTaskRunReq(pVnode->pTq, pMsg);
|
||||
#if 1
|
||||
|
|
|
@ -128,10 +128,10 @@ enum {
|
|||
|
||||
typedef struct {
|
||||
// TODO remove prepareStatus
|
||||
STqOffsetVal prepareStatus; // for tmq
|
||||
STqOffsetVal lastStatus; // for tmq
|
||||
// STqOffsetVal prepareStatus; // for tmq
|
||||
STqOffsetVal currentOffset; // for tmq
|
||||
SMqMetaRsp metaRsp; // for tmq fetching meta
|
||||
int8_t returned;
|
||||
// int8_t returned;
|
||||
int64_t snapshotVer;
|
||||
// const SSubmitReq* pReq;
|
||||
|
||||
|
@ -191,7 +191,7 @@ enum {
|
|||
OP_OPENED = 0x1,
|
||||
OP_RES_TO_RETURN = 0x5,
|
||||
OP_EXEC_DONE = 0x9,
|
||||
OP_EXEC_RECV = 0x11,
|
||||
// OP_EXEC_RECV = 0x11,
|
||||
};
|
||||
|
||||
typedef struct SOperatorFpSet {
|
||||
|
@ -502,32 +502,12 @@ typedef struct STableCountScanSupp {
|
|||
char stbNameFilter[TSDB_TABLE_NAME_LEN];
|
||||
} STableCountScanSupp;
|
||||
|
||||
typedef struct STableCountScanOperatorInfo {
|
||||
SReadHandle readHandle;
|
||||
SSDataBlock* pRes;
|
||||
|
||||
STableCountScanSupp supp;
|
||||
|
||||
int32_t currGrpIdx;
|
||||
SArray* stbUidList; // when group by db_name and/or stable_name
|
||||
} STableCountScanOperatorInfo;
|
||||
|
||||
typedef struct SOptrBasicInfo {
|
||||
SResultRowInfo resultRowInfo;
|
||||
SSDataBlock* pRes;
|
||||
bool mergeResultBlock;
|
||||
} SOptrBasicInfo;
|
||||
|
||||
typedef struct SAggOperatorInfo {
|
||||
SOptrBasicInfo binfo;
|
||||
SAggSupporter aggSup;
|
||||
STableQueryInfo* current;
|
||||
uint64_t groupId;
|
||||
SGroupResInfo groupResInfo;
|
||||
SExprSupp scalarExprSup;
|
||||
bool groupKeyOptimized;
|
||||
} SAggOperatorInfo;
|
||||
|
||||
typedef struct SIntervalAggOperatorInfo {
|
||||
SOptrBasicInfo binfo; // basic info
|
||||
SAggSupporter aggSup; // aggregate supporter
|
||||
|
@ -852,7 +832,7 @@ SArray* getTableListInfo(const SExecTaskInfo* pTaskInfo);
|
|||
|
||||
int32_t createExecTaskInfo(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId,
|
||||
int32_t vgId, char* sql, EOPTR_EXEC_MODEL model);
|
||||
int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, STableListInfo* pTableListInfo, SReadHandle* readHandle);
|
||||
int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo* pTask, SReadHandle* readHandle);
|
||||
int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInfoList);
|
||||
|
||||
STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowInfo, int64_t ts, SInterval* pInterval,
|
||||
|
|
|
@ -40,6 +40,16 @@ typedef struct {
|
|||
int32_t startOffset;
|
||||
} SFunctionCtxStatus;
|
||||
|
||||
typedef struct SAggOperatorInfo {
|
||||
SOptrBasicInfo binfo;
|
||||
SAggSupporter aggSup;
|
||||
STableQueryInfo* current;
|
||||
uint64_t groupId;
|
||||
SGroupResInfo groupResInfo;
|
||||
SExprSupp scalarExprSup;
|
||||
bool groupKeyOptimized;
|
||||
} SAggOperatorInfo;
|
||||
|
||||
static void destroyAggOperatorInfo(void* param);
|
||||
static void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId);
|
||||
|
||||
|
|
|
@ -127,12 +127,10 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
|
|||
pOperator->status = OP_NOT_OPENED;
|
||||
|
||||
SStreamScanInfo* pInfo = pOperator->info;
|
||||
qDebug("stream set total blocks:%d, task id:%s" PRIx64, (int32_t)numOfBlocks, id);
|
||||
ASSERT(pInfo->validBlockIndex == 0);
|
||||
ASSERT(taosArrayGetSize(pInfo->pBlockLists) == 0);
|
||||
qDebug("task stream set total blocks:%d %s", (int32_t)numOfBlocks, id);
|
||||
ASSERT(pInfo->validBlockIndex == 0 && taosArrayGetSize(pInfo->pBlockLists) == 0);
|
||||
|
||||
if (type == STREAM_INPUT__MERGED_SUBMIT) {
|
||||
// ASSERT(numOfBlocks > 1);
|
||||
for (int32_t i = 0; i < numOfBlocks; i++) {
|
||||
SPackedData* pReq = POINTER_SHIFT(input, i * sizeof(SPackedData));
|
||||
taosArrayPush(pInfo->pBlockLists, pReq);
|
||||
|
@ -505,12 +503,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
|
|||
|
||||
if (handle) {
|
||||
void* pSinkParam = NULL;
|
||||
|
||||
SArray* pInfoList = getTableListInfo(*pTask);
|
||||
STableListInfo* pTableListInfo = taosArrayGetP(pInfoList, 0);
|
||||
taosArrayDestroy(pInfoList);
|
||||
|
||||
code = createDataSinkParam(pSubplan->pDataSink, &pSinkParam, pTableListInfo, readHandle);
|
||||
code = createDataSinkParam(pSubplan->pDataSink, &pSinkParam, (*pTask), readHandle);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("failed to createDataSinkParam, vgId:%d, code:%s, %s", vgId, tstrerror(code), (*pTask)->id.str);
|
||||
goto _error;
|
||||
|
@ -1029,15 +1022,9 @@ SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) {
|
|||
return &pTaskInfo->streamInfo.metaRsp;
|
||||
}
|
||||
|
||||
int64_t qStreamExtractPrepareUid(qTaskInfo_t tinfo) {
|
||||
void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
return pTaskInfo->streamInfo.prepareStatus.uid;
|
||||
}
|
||||
|
||||
int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
memcpy(pOffset, &pTaskInfo->streamInfo.lastStatus, sizeof(STqOffsetVal));
|
||||
return 0;
|
||||
memcpy(pOffset, &pTaskInfo->streamInfo.currentOffset, sizeof(STqOffsetVal));
|
||||
}
|
||||
|
||||
int32_t initQueryTableDataCondForTmq(SQueryTableDataCond* pCond, SSnapContext* sContext, SMetaTableInfo* pMtInfo) {
|
||||
|
@ -1083,33 +1070,38 @@ int32_t qStreamSetScanMemData(qTaskInfo_t tinfo, SPackedData submit) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void qStreamSetOpen(qTaskInfo_t tinfo) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
SOperatorInfo* pOperator = pTaskInfo->pRoot;
|
||||
pOperator->status = OP_NOT_OPENED;
|
||||
}
|
||||
|
||||
int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subType) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
SOperatorInfo* pOperator = pTaskInfo->pRoot;
|
||||
const char* id = GET_TASKID(pTaskInfo);
|
||||
|
||||
pTaskInfo->streamInfo.prepareStatus = *pOffset;
|
||||
pTaskInfo->streamInfo.returned = 0;
|
||||
|
||||
if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus)) {
|
||||
// if pOffset equal to current offset, means continue consume
|
||||
if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.currentOffset)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||
pOperator->status = OP_OPENED;
|
||||
pOperator = extractOperatorInTree(pOperator, QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, id);
|
||||
|
||||
if (pOperator == NULL) {
|
||||
return -1;
|
||||
}
|
||||
SStreamScanInfo* pInfo = pOperator->info;
|
||||
STableScanInfo* pScanInfo = pInfo->pTableScanOp->info;
|
||||
STableScanBase* pScanBaseInfo = &pScanInfo->base;
|
||||
STableListInfo* pTableListInfo = pScanBaseInfo->pTableListInfo;
|
||||
STableListInfo* pTableListInfo = pScanBaseInfo->pTableListInfo;
|
||||
|
||||
if (pOffset->type == TMQ_OFFSET__LOG) {
|
||||
tsdbReaderClose(pScanBaseInfo->dataReader);
|
||||
pScanBaseInfo->dataReader = NULL;
|
||||
|
||||
// let's seek to the next version in wal file
|
||||
if (tqSeekVer(pInfo->tqReader, pOffset->version + 1, pTaskInfo->id.str) < 0) {
|
||||
if (tqSeekVer(pInfo->tqReader, pOffset->version + 1, id) < 0) {
|
||||
qError("tqSeekVer failed ver:%"PRId64", %s", pOffset->version + 1, id);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1137,6 +1129,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
|
|||
}
|
||||
}
|
||||
|
||||
qDebug("switch to table uid:%" PRId64 " ts:%" PRId64 "% "PRId64 " rows returned", uid, ts, pInfo->pTableScanOp->resultInfo.totalRows);
|
||||
pInfo->pTableScanOp->resultInfo.totalRows = 0;
|
||||
|
||||
// start from current accessed position
|
||||
|
@ -1207,7 +1200,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
|
|||
tableListClear(pTableListInfo);
|
||||
|
||||
if (mtInfo.uid == 0) {
|
||||
return 0; // no data
|
||||
goto end; // no data
|
||||
}
|
||||
|
||||
initQueryTableDataCondForTmq(&pTaskInfo->streamInfo.tableCond, sContext, &mtInfo);
|
||||
|
@ -1242,6 +1235,9 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
|
|||
}
|
||||
}
|
||||
|
||||
end:
|
||||
pTaskInfo->streamInfo.currentOffset = *pOffset;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1586,7 +1586,7 @@ int32_t extractTableScanNode(SPhysiNode* pNode, STableScanPhysiNode** ppNode) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, STableListInfo* pTableListInfo, SReadHandle* readHandle) {
|
||||
int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo* pTask, SReadHandle* readHandle) {
|
||||
switch (pNode->type) {
|
||||
case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: {
|
||||
SInserterParam* pInserterParam = taosMemoryCalloc(1, sizeof(SInserterParam));
|
||||
|
@ -1604,23 +1604,26 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, STableListInfo*
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
int32_t tbNum = tableListGetSize(pTableListInfo);
|
||||
SArray* pInfoList = getTableListInfo(pTask);
|
||||
STableListInfo* pTableListInfo = taosArrayGetP(pInfoList, 0);
|
||||
taosArrayDestroy(pInfoList);
|
||||
|
||||
pDeleterParam->suid = tableListGetSuid(pTableListInfo);
|
||||
|
||||
// TODO extract uid list
|
||||
pDeleterParam->pUidList = taosArrayInit(tbNum, sizeof(uint64_t));
|
||||
int32_t numOfTables = tableListGetSize(pTableListInfo);
|
||||
pDeleterParam->pUidList = taosArrayInit(numOfTables, sizeof(uint64_t));
|
||||
if (NULL == pDeleterParam->pUidList) {
|
||||
taosMemoryFree(pDeleterParam);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < tbNum; ++i) {
|
||||
for (int32_t i = 0; i < numOfTables; ++i) {
|
||||
STableKeyInfo* pTable = tableListGetInfo(pTableListInfo, i);
|
||||
taosArrayPush(pDeleterParam->pUidList, &pTable->uid);
|
||||
}
|
||||
|
||||
*pParam = pDeleterParam;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -1967,11 +1970,11 @@ void qStreamCloseTsdbReader(void* task) {
|
|||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)task;
|
||||
SOperatorInfo* pOp = pTaskInfo->pRoot;
|
||||
|
||||
qDebug("stream close tsdb reader, reset status uid:%" PRId64 " ts:%" PRId64, pTaskInfo->streamInfo.lastStatus.uid,
|
||||
pTaskInfo->streamInfo.lastStatus.ts);
|
||||
qDebug("stream close tsdb reader, reset status uid:%" PRId64 " ts:%" PRId64, pTaskInfo->streamInfo.currentOffset.uid,
|
||||
pTaskInfo->streamInfo.currentOffset.ts);
|
||||
|
||||
// todo refactor, other thread may already use this read to extract data.
|
||||
pTaskInfo->streamInfo.lastStatus = (STqOffsetVal){0};
|
||||
pTaskInfo->streamInfo.currentOffset = (STqOffsetVal){0};
|
||||
while (pOp->numOfDownstream == 1 && pOp->pDownstream[0]) {
|
||||
SOperatorInfo* pDownstreamOp = pOp->pDownstream[0];
|
||||
if (pDownstreamOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
||||
|
|
|
@ -227,17 +227,8 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
|
|||
blockDataCleanup(pFinalRes);
|
||||
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
if (pTaskInfo->streamInfo.submit.msgStr) {
|
||||
pOperator->status = OP_OPENED;
|
||||
}
|
||||
|
||||
if (pOperator->status == OP_EXEC_DONE) {
|
||||
if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) {
|
||||
pOperator->status = OP_OPENED;
|
||||
qDebug("projection in queue model, set status open and return null");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -263,23 +254,14 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
|
|||
// The downstream exec may change the value of the newgroup, so use a local variable instead.
|
||||
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
|
||||
if (pBlock == NULL) {
|
||||
if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE && pFinalRes->info.rows == 0) {
|
||||
pOperator->status = OP_OPENED;
|
||||
if (pOperator->status == OP_EXEC_RECV) {
|
||||
continue;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
qDebug("set op close, exec %d, status %d rows %" PRId64 , pTaskInfo->execModel, pOperator->status,
|
||||
pFinalRes->info.rows);
|
||||
qDebug("set op close, exec %d, status %d rows %" PRId64 , pTaskInfo->execModel, pOperator->status, pFinalRes->info.rows);
|
||||
setOperatorCompleted(pOperator);
|
||||
break;
|
||||
}
|
||||
if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) {
|
||||
qDebug("set status recv");
|
||||
pOperator->status = OP_EXEC_RECV;
|
||||
}
|
||||
// if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) {
|
||||
// qDebug("set status recv");
|
||||
// pOperator->status = OP_EXEC_RECV;
|
||||
// }
|
||||
|
||||
// for stream interval
|
||||
if (pBlock->info.type == STREAM_RETRIEVE || pBlock->info.type == STREAM_DELETE_RESULT ||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
int32_t scanDebug = 0;
|
||||
|
||||
|
||||
#define MULTI_READER_MAX_TABLE_NUM 5000
|
||||
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
|
||||
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
|
||||
|
@ -52,6 +51,16 @@ typedef struct STableMergeScanSortSourceParam {
|
|||
STsdbReader* dataReader;
|
||||
} STableMergeScanSortSourceParam;
|
||||
|
||||
typedef struct STableCountScanOperatorInfo {
|
||||
SReadHandle readHandle;
|
||||
SSDataBlock* pRes;
|
||||
|
||||
STableCountScanSupp supp;
|
||||
|
||||
int32_t currGrpIdx;
|
||||
SArray* stbUidList; // when group by db_name and/or stable_name
|
||||
} STableCountScanOperatorInfo;
|
||||
|
||||
static bool processBlockWithProbability(const SSampleExecInfo* pInfo);
|
||||
|
||||
bool processBlockWithProbability(const SSampleExecInfo* pInfo) {
|
||||
|
@ -698,9 +707,9 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
|
|||
// todo refactor
|
||||
/*pTableScanInfo->lastStatus.uid = pBlock->info.id.uid;*/
|
||||
/*pTableScanInfo->lastStatus.ts = pBlock->info.window.ekey;*/
|
||||
pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_DATA;
|
||||
pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.id.uid;
|
||||
pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey;
|
||||
// pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_DATA;
|
||||
// pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.id.uid;
|
||||
// pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey;
|
||||
|
||||
return pBlock;
|
||||
}
|
||||
|
@ -890,9 +899,11 @@ static void destroyTableScanOperatorInfo(void* param) {
|
|||
|
||||
SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle,
|
||||
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo) {
|
||||
int32_t code = 0;
|
||||
STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
if (pInfo == NULL || pOperator == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
|
@ -900,8 +911,7 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
|
|||
SDataBlockDescNode* pDescNode = pScanNode->node.pOutputDataBlockDesc;
|
||||
|
||||
int32_t numOfCols = 0;
|
||||
int32_t code =
|
||||
extractColMatchInfo(pScanNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, &pInfo->base.matchInfo);
|
||||
code = extractColMatchInfo(pScanNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, &pInfo->base.matchInfo);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
@ -1623,14 +1633,11 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
|
|||
qDebug("start to exec queue scan, %s", id);
|
||||
|
||||
if (pTaskInfo->streamInfo.submit.msgStr != NULL) {
|
||||
|
||||
if (pInfo->tqReader->msg2.msgStr == NULL) {
|
||||
SPackedData submit = pTaskInfo->streamInfo.submit;
|
||||
if (tqReaderSetSubmitReq2(pInfo->tqReader, submit.msgStr, submit.msgLen, submit.ver) < 0) {
|
||||
qError("submit msg messed up when initing stream submit block %p, %s", submit.msgStr, id);
|
||||
pInfo->tqReader->msg2 = (SPackedData){0};
|
||||
pInfo->tqReader->setMsg = 0;
|
||||
ASSERT(0);
|
||||
qError("submit msg messed up when initing stream submit block %p", submit.msgStr);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1653,73 +1660,49 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
|
|||
}
|
||||
|
||||
pInfo->tqReader->msg2 = (SPackedData){0};
|
||||
pInfo->tqReader->setMsg = 0;
|
||||
pTaskInfo->streamInfo.submit = (SPackedData){0};
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp);
|
||||
if (pResult && pResult->info.rows > 0) {
|
||||
qDebug("queue scan tsdb return %" PRId64 " rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64" %s", pResult->info.rows,
|
||||
pResult->info.window.skey, pResult->info.window.ekey, pInfo->tqReader->pWalReader->curVersion, id);
|
||||
pTaskInfo->streamInfo.returned = 1;
|
||||
qDebug("queue scan tsdb return %"PRId64" rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64, pResult->info.rows,
|
||||
pResult->info.window.skey, pResult->info.window.ekey, pInfo->tqReader->pWalReader->curVersion);
|
||||
tqOffsetResetToData(&pTaskInfo->streamInfo.currentOffset, pResult->info.id.uid, pResult->info.window.ekey);
|
||||
return pResult;
|
||||
} else {
|
||||
// no data has return already, try to extract data in the WAL
|
||||
if (!pTaskInfo->streamInfo.returned) {
|
||||
STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
|
||||
tsdbReaderClose(pTSInfo->base.dataReader);
|
||||
|
||||
pTSInfo->base.dataReader = NULL;
|
||||
tqOffsetResetToLog(&pTaskInfo->streamInfo.prepareStatus, pTaskInfo->streamInfo.snapshotVer);
|
||||
|
||||
qDebug("queue scan tsdb over, switch to wal ver:%" PRId64 " %s", pTaskInfo->streamInfo.snapshotVer + 1, id);
|
||||
if (tqSeekVer(pInfo->tqReader, pTaskInfo->streamInfo.snapshotVer + 1, pTaskInfo->id.str) < 0) {
|
||||
tqOffsetResetToLog(&pTaskInfo->streamInfo.lastStatus, pTaskInfo->streamInfo.snapshotVer);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
|
||||
tsdbReaderClose(pTSInfo->base.dataReader);
|
||||
pTSInfo->base.dataReader = NULL;
|
||||
qDebug("queue scan tsdb over, switch to wal ver %" PRId64 "", pTaskInfo->streamInfo.snapshotVer + 1);
|
||||
if (tqSeekVer(pInfo->tqReader, pTaskInfo->streamInfo.snapshotVer + 1, pTaskInfo->id.str) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
tqOffsetResetToLog(&pTaskInfo->streamInfo.currentOffset, pTaskInfo->streamInfo.snapshotVer);
|
||||
}
|
||||
|
||||
if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__LOG) {
|
||||
if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__LOG) {
|
||||
while (1) {
|
||||
SFetchRet ret = {0};
|
||||
terrno = 0;
|
||||
|
||||
if (tqNextBlock(pInfo->tqReader, &ret) < 0) {
|
||||
// if the end is reached, terrno is 0
|
||||
if (terrno != 0) {
|
||||
qError("failed to get next log block since %s, %s", terrstr(), id);
|
||||
}
|
||||
}
|
||||
tqNextBlock(pInfo->tqReader, &ret);
|
||||
tqOffsetResetToLog(&pTaskInfo->streamInfo.currentOffset, pInfo->tqReader->pWalReader->curVersion - 1); //curVersion move to next, so currentOffset = curVersion - 1
|
||||
|
||||
if (ret.fetchType == FETCH_TYPE__DATA) {
|
||||
qDebug("doQueueScan get data from log %"PRId64" rows, version:%" PRId64, ret.data.info.rows, pTaskInfo->streamInfo.currentOffset.version);
|
||||
blockDataCleanup(pInfo->pRes);
|
||||
setBlockIntoRes(pInfo, &ret.data, true);
|
||||
if (pInfo->pRes->info.rows > 0) {
|
||||
pOperator->status = OP_EXEC_RECV;
|
||||
qDebug("queue scan log return %" PRId64 " rows", pInfo->pRes->info.rows);
|
||||
qDebug("doQueueScan get data from log %"PRId64" rows, return, version:%" PRId64, pInfo->pRes->info.rows, pTaskInfo->streamInfo.currentOffset.version);
|
||||
return pInfo->pRes;
|
||||
}
|
||||
} else if (ret.fetchType == FETCH_TYPE__META) {
|
||||
qError("unexpected ret.fetchType:%d", ret.fetchType);
|
||||
continue;
|
||||
} else if (ret.fetchType == FETCH_TYPE__NONE ||
|
||||
(ret.fetchType == FETCH_TYPE__SEP && pOperator->status == OP_EXEC_RECV)) {
|
||||
pTaskInfo->streamInfo.lastStatus = ret.offset;
|
||||
char formatBuf[80];
|
||||
tFormatOffset(formatBuf, 80, &ret.offset);
|
||||
qDebug("queue scan log return null, offset %s", formatBuf);
|
||||
pOperator->status = OP_OPENED;
|
||||
}else if(ret.fetchType == FETCH_TYPE__NONE){
|
||||
qDebug("doQueueScan get none from log, return, version:%" PRId64, pTaskInfo->streamInfo.currentOffset.version);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qError("unexpected streamInfo prepare type: %d %s", pTaskInfo->streamInfo.prepareStatus.type, id);
|
||||
qError("unexpected streamInfo prepare type: %d", pTaskInfo->streamInfo.currentOffset.type);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -2074,7 +2057,6 @@ FETCH_NEXT_BLOCK:
|
|||
|
||||
int32_t current = pInfo->validBlockIndex++;
|
||||
SPackedData* pSubmit = taosArrayGet(pInfo->pBlockLists, current);
|
||||
/*if (tqReaderSetDataMsg(pInfo->tqReader, pSubmit, 0) < 0) {*/
|
||||
if (tqReaderSetSubmitReq2(pInfo->tqReader, pSubmit->msgStr, pSubmit->msgLen, pSubmit->ver) < 0) {
|
||||
qError("submit msg messed up when initing stream submit block %p, current %d, total %d", pSubmit, current,
|
||||
totBlockNum);
|
||||
|
@ -2166,7 +2148,7 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
|
|||
pTaskInfo->streamInfo.metaRsp.metaRsp = NULL;
|
||||
|
||||
qDebug("tmqsnap doRawScan called");
|
||||
if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
bool hasNext = false;
|
||||
if (pInfo->dataReader) {
|
||||
code = tsdbNextDataBlock(pInfo->dataReader, &hasNext);
|
||||
|
@ -2188,28 +2170,23 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
|
|||
}
|
||||
|
||||
qDebug("tmqsnap doRawScan get data uid:%" PRId64 "", pBlock->info.id.uid);
|
||||
pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_DATA;
|
||||
pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.id.uid;
|
||||
pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey;
|
||||
tqOffsetResetToData(&pTaskInfo->streamInfo.currentOffset, pBlock->info.id.uid, pBlock->info.window.ekey);
|
||||
return pBlock;
|
||||
}
|
||||
|
||||
SMetaTableInfo mtInfo = getUidfromSnapShot(pInfo->sContext);
|
||||
STqOffsetVal offset = {0};
|
||||
if (mtInfo.uid == 0) { // read snapshot done, change to get data from wal
|
||||
qDebug("tmqsnap read snapshot done, change to get data from wal");
|
||||
pTaskInfo->streamInfo.prepareStatus.uid = mtInfo.uid;
|
||||
pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__LOG;
|
||||
pTaskInfo->streamInfo.lastStatus.version = pInfo->sContext->snapVersion;
|
||||
tqOffsetResetToLog(&offset, pInfo->sContext->snapVersion);
|
||||
} else {
|
||||
pTaskInfo->streamInfo.prepareStatus.uid = mtInfo.uid;
|
||||
pTaskInfo->streamInfo.prepareStatus.ts = INT64_MIN;
|
||||
tqOffsetResetToData(&offset, mtInfo.uid, INT64_MIN);
|
||||
qDebug("tmqsnap change get data uid:%" PRId64 "", mtInfo.uid);
|
||||
qStreamPrepareScan(pTaskInfo, &pTaskInfo->streamInfo.prepareStatus, pInfo->sContext->subType);
|
||||
}
|
||||
qStreamPrepareScan(pTaskInfo, &offset, pInfo->sContext->subType);
|
||||
tDeleteSSchemaWrapper(mtInfo.schema);
|
||||
qDebug("tmqsnap stream scan tsdb return null");
|
||||
return NULL;
|
||||
} else if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_META) {
|
||||
} else if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_META) {
|
||||
SSnapContext* sContext = pInfo->sContext;
|
||||
void* data = NULL;
|
||||
int32_t dataLen = 0;
|
||||
|
@ -2221,16 +2198,12 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!sContext->queryMetaOrData) { // change to get data next poll request
|
||||
pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_META;
|
||||
pTaskInfo->streamInfo.lastStatus.uid = uid;
|
||||
pTaskInfo->streamInfo.metaRsp.rspOffset.type = TMQ_OFFSET__SNAPSHOT_DATA;
|
||||
pTaskInfo->streamInfo.metaRsp.rspOffset.uid = 0;
|
||||
pTaskInfo->streamInfo.metaRsp.rspOffset.ts = INT64_MIN;
|
||||
if (!sContext->queryMeta) { // change to get data next poll request
|
||||
STqOffsetVal offset = {0};
|
||||
tqOffsetResetToData(&offset, 0, INT64_MIN);
|
||||
qStreamPrepareScan(pTaskInfo, &offset, pInfo->sContext->subType);
|
||||
} else {
|
||||
pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_META;
|
||||
pTaskInfo->streamInfo.lastStatus.uid = uid;
|
||||
pTaskInfo->streamInfo.metaRsp.rspOffset = pTaskInfo->streamInfo.lastStatus;
|
||||
tqOffsetResetToMeta(&pTaskInfo->streamInfo.currentOffset, uid);
|
||||
pTaskInfo->streamInfo.metaRsp.resMsgType = type;
|
||||
pTaskInfo->streamInfo.metaRsp.metaRspLen = dataLen;
|
||||
pTaskInfo->streamInfo.metaRsp.metaRsp = data;
|
||||
|
@ -2444,7 +2417,6 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
|
|||
if (pHandle->initTableReader) {
|
||||
pTSInfo->scanMode = TABLE_SCAN__TABLE_ORDER;
|
||||
pTSInfo->base.dataReader = NULL;
|
||||
pTaskInfo->streamInfo.lastStatus.uid = -1;
|
||||
}
|
||||
|
||||
if (pHandle->initTqReader) {
|
||||
|
|
|
@ -4758,6 +4758,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
|
|||
if (!pInfo->pUpdated) {
|
||||
pInfo->pUpdated = taosArrayInit(4, sizeof(SWinKey));
|
||||
}
|
||||
|
||||
if (!pInfo->pUpdatedMap) {
|
||||
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
|
||||
pInfo->pUpdatedMap = tSimpleHashInit(1024, hashFn);
|
||||
|
|
|
@ -330,7 +330,7 @@ column_def_list(A) ::= column_def(B).
|
|||
column_def_list(A) ::= column_def_list(B) NK_COMMA column_def(C). { A = addNodeToList(pCxt, B, C); }
|
||||
|
||||
column_def(A) ::= column_name(B) type_name(C). { A = createColumnDefNode(pCxt, &B, C, NULL); }
|
||||
column_def(A) ::= column_name(B) type_name(C) COMMENT NK_STRING(D). { A = createColumnDefNode(pCxt, &B, C, &D); }
|
||||
//column_def(A) ::= column_name(B) type_name(C) COMMENT NK_STRING(D). { A = createColumnDefNode(pCxt, &B, C, &D); }
|
||||
|
||||
%type type_name { SDataType }
|
||||
%destructor type_name { }
|
||||
|
|
|
@ -125,6 +125,12 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem
|
|||
SSchema* pTagSchema = &pSchema[tags->pColIndex[i]];
|
||||
SSmlKv* kv = taosArrayGet(cols, i);
|
||||
|
||||
if(kv->keyLen != strlen(pTagSchema->name) || memcmp(kv->key, pTagSchema->name, kv->keyLen) != 0 || kv->type != pTagSchema->type){
|
||||
code = TSDB_CODE_SML_INVALID_DATA;
|
||||
uError("SML smlBuildCol error col not same %s", pTagSchema->name);
|
||||
goto end;
|
||||
}
|
||||
|
||||
taosArrayPush(*tagName, pTagSchema->name);
|
||||
STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type};
|
||||
// strcpy(val.colName, pTagSchema->name);
|
||||
|
|
|
@ -470,11 +470,11 @@ int32_t insMergeTableDataCxt(SHashObj* pTableHash, SArray** pVgDataBlocks) {
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
SVgroupDataCxt* pVgCxt = NULL;
|
||||
int32_t vgId = pTableCxt->pMeta->vgId;
|
||||
void** p = taosHashGet(pVgroupHash, &vgId, sizeof(vgId));
|
||||
if (NULL == p) {
|
||||
void** pp = taosHashGet(pVgroupHash, &vgId, sizeof(vgId));
|
||||
if (NULL == pp) {
|
||||
code = createVgroupDataCxt(pTableCxt, pVgroupHash, pVgroupList, &pVgCxt);
|
||||
} else {
|
||||
pVgCxt = *(SVgroupDataCxt**)p;
|
||||
pVgCxt = *(SVgroupDataCxt**)pp;
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = fillVgroupDataCxt(pTableCxt, pVgCxt);
|
||||
|
|
|
@ -1691,6 +1691,7 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
|
|||
pSelect->hasUniqueFunc = pSelect->hasUniqueFunc ? true : (FUNCTION_TYPE_UNIQUE == pFunc->funcType);
|
||||
pSelect->hasTailFunc = pSelect->hasTailFunc ? true : (FUNCTION_TYPE_TAIL == pFunc->funcType);
|
||||
pSelect->hasInterpFunc = pSelect->hasInterpFunc ? true : (FUNCTION_TYPE_INTERP == pFunc->funcType);
|
||||
pSelect->hasInterpPseudoColFunc = pSelect->hasInterpPseudoColFunc ? true : fmIsInterpPseudoColumnFunc(pFunc->funcId);
|
||||
pSelect->hasLastRowFunc = pSelect->hasLastRowFunc ? true : (FUNCTION_TYPE_LAST_ROW == pFunc->funcType);
|
||||
pSelect->hasLastFunc = pSelect->hasLastFunc ? true : (FUNCTION_TYPE_LAST == pFunc->funcType);
|
||||
pSelect->hasTimeLineFunc = pSelect->hasTimeLineFunc ? true : fmIsTimelineFunc(pFunc->funcId);
|
||||
|
@ -3369,6 +3370,9 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
|||
if (NULL != pSelect->pRange || NULL != pSelect->pEvery || NULL != pSelect->pFill) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE);
|
||||
}
|
||||
if (pSelect->hasInterpPseudoColFunc) {
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC, "Has Interp pseudo column(s) but missing interp function");
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -742,10 +742,10 @@ TEST_F(ParserInitialCTest, createStable) {
|
|||
addFieldToCreateStbReq(false, "a15", TSDB_DATA_TYPE_VARCHAR, 50 + VARSTR_HEADER_SIZE);
|
||||
run("CREATE STABLE IF NOT EXISTS rollup_db.t1("
|
||||
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), "
|
||||
"c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
|
||||
"c8 SMALLINT, c9 SMALLINT UNSIGNED, c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
|
||||
"c13 NCHAR(30), c14 VARCHAR(50)) "
|
||||
"TAGS (a1 TIMESTAMP, a2 INT, a3 INT UNSIGNED, a4 BIGINT, a5 BIGINT UNSIGNED, a6 FLOAT, a7 DOUBLE, "
|
||||
"a8 BINARY(20), a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, "
|
||||
"a8 BINARY(20), a9 SMALLINT, a10 SMALLINT UNSIGNED, a11 TINYINT, "
|
||||
"a12 TINYINT UNSIGNED, a13 BOOL, a14 NCHAR(30), a15 VARCHAR(50)) "
|
||||
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) MAX_DELAY 100s,10m WATERMARK 10a,1m "
|
||||
"DELETE_MARK 1000s,200m");
|
||||
|
@ -1005,16 +1005,16 @@ TEST_F(ParserInitialCTest, createTable) {
|
|||
|
||||
run("CREATE TABLE IF NOT EXISTS test.t1("
|
||||
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), "
|
||||
"c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
|
||||
"c8 SMALLINT, c9 SMALLINT UNSIGNED, c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
|
||||
"c13 NCHAR(30), c15 VARCHAR(50)) "
|
||||
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3)");
|
||||
|
||||
run("CREATE TABLE IF NOT EXISTS rollup_db.t1("
|
||||
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), "
|
||||
"c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
|
||||
"c8 SMALLINT, c9 SMALLINT UNSIGNED, c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
|
||||
"c13 NCHAR(30), c14 VARCHAR(50)) "
|
||||
"TAGS (a1 TIMESTAMP, a2 INT, a3 INT UNSIGNED, a4 BIGINT, a5 BIGINT UNSIGNED, a6 FLOAT, a7 DOUBLE, a8 BINARY(20), "
|
||||
"a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, a12 TINYINT UNSIGNED, a13 BOOL, "
|
||||
"a9 SMALLINT, a10 SMALLINT UNSIGNED, a11 TINYINT, a12 TINYINT UNSIGNED, a13 BOOL, "
|
||||
"a14 NCHAR(30), a15 VARCHAR(50)) "
|
||||
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN)");
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ void streamSchedByTimer(void* param, void* tmrId) {
|
|||
|
||||
atomic_store_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__INACTIVE);
|
||||
|
||||
if (streamTaskInput(pTask, (SStreamQueueItem*)trigger) < 0) {
|
||||
if (tAppendDataForStream(pTask, (SStreamQueueItem*)trigger) < 0) {
|
||||
taosFreeQitem(trigger);
|
||||
taosTmrReset(streamSchedByTimer, (int32_t)pTask->triggerParam, pTask, streamEnv.timer, &pTask->timer);
|
||||
return;
|
||||
|
@ -92,22 +92,22 @@ int32_t streamSetupTrigger(SStreamTask* pTask) {
|
|||
int32_t streamSchedExec(SStreamTask* pTask) {
|
||||
int8_t schedStatus =
|
||||
atomic_val_compare_exchange_8(&pTask->schedStatus, TASK_SCHED_STATUS__INACTIVE, TASK_SCHED_STATUS__WAITING);
|
||||
|
||||
if (schedStatus == TASK_SCHED_STATUS__INACTIVE) {
|
||||
SStreamTaskRunReq* pRunReq = rpcMallocCont(sizeof(SStreamTaskRunReq));
|
||||
if (pRunReq == NULL) {
|
||||
atomic_store_8(&pTask->schedStatus, TASK_SCHED_STATUS__INACTIVE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pRunReq->head.vgId = pTask->nodeId;
|
||||
pRunReq->streamId = pTask->streamId;
|
||||
pRunReq->taskId = pTask->taskId;
|
||||
SRpcMsg msg = {
|
||||
.msgType = TDMT_STREAM_TASK_RUN,
|
||||
.pCont = pRunReq,
|
||||
.contLen = sizeof(SStreamTaskRunReq),
|
||||
};
|
||||
|
||||
SRpcMsg msg = { .msgType = TDMT_STREAM_TASK_RUN, .pCont = pRunReq, .contLen = sizeof(SStreamTaskRunReq) };
|
||||
tmsgPutToQueue(pTask->pMsgCb, STREAM_QUEUE, &msg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ int32_t streamTaskEnqueue(SStreamTask* pTask, const SStreamDispatchReq* pReq, SR
|
|||
/*pData->blocks = pReq->data;*/
|
||||
/*pBlock->sourceVer = pReq->sourceVer;*/
|
||||
streamDispatchReqToData(pReq, pData);
|
||||
if (streamTaskInput(pTask, (SStreamQueueItem*)pData) == 0) {
|
||||
if (tAppendDataForStream(pTask, (SStreamQueueItem*)pData) == 0) {
|
||||
status = TASK_INPUT_STATUS__NORMAL;
|
||||
} else {
|
||||
status = TASK_INPUT_STATUS__FAILED;
|
||||
|
@ -164,7 +164,7 @@ int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq,
|
|||
/*pData->blocks = pReq->data;*/
|
||||
/*pBlock->sourceVer = pReq->sourceVer;*/
|
||||
streamRetrieveReqToData(pReq, pData);
|
||||
if (streamTaskInput(pTask, (SStreamQueueItem*)pData) == 0) {
|
||||
if (tAppendDataForStream(pTask, (SStreamQueueItem*)pData) == 0) {
|
||||
status = TASK_INPUT_STATUS__NORMAL;
|
||||
} else {
|
||||
status = TASK_INPUT_STATUS__FAILED;
|
||||
|
@ -275,7 +275,57 @@ int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, S
|
|||
return 0;
|
||||
}
|
||||
|
||||
// int32_t streamProcessRetrieveRsp(SStreamTask* pTask, SStreamRetrieveRsp* pRsp) {
|
||||
// //
|
||||
// return 0;
|
||||
// }
|
||||
int32_t tAppendDataForStream(SStreamTask* pTask, SStreamQueueItem* pItem) {
|
||||
int8_t type = pItem->type;
|
||||
|
||||
if (type == STREAM_INPUT__DATA_SUBMIT) {
|
||||
SStreamDataSubmit2* pSubmitBlock = streamSubmitBlockClone((SStreamDataSubmit2*)pItem);
|
||||
if (pSubmitBlock == NULL) {
|
||||
qDebug("task %d %p submit enqueue failed since out of memory", pTask->taskId, pTask);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__FAILED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t total = taosQueueItemSize(pTask->inputQueue->queue) + 1;
|
||||
qDebug("stream task:%d %p submit enqueue %p %p %p msgLen:%d ver:%" PRId64 ", total in queue:%d", pTask->taskId,
|
||||
pTask, pItem, pSubmitBlock, pSubmitBlock->submit.msgStr, pSubmitBlock->submit.msgLen,
|
||||
pSubmitBlock->submit.ver, total);
|
||||
|
||||
taosWriteQitem(pTask->inputQueue->queue, pSubmitBlock);
|
||||
} else if (type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__DATA_RETRIEVE ||
|
||||
type == STREAM_INPUT__REF_DATA_BLOCK) {
|
||||
taosWriteQitem(pTask->inputQueue->queue, pItem);
|
||||
} else if (type == STREAM_INPUT__CHECKPOINT) {
|
||||
taosWriteQitem(pTask->inputQueue->queue, pItem);
|
||||
} else if (type == STREAM_INPUT__GET_RES) {
|
||||
taosWriteQitem(pTask->inputQueue->queue, pItem);
|
||||
}
|
||||
|
||||
if (type != STREAM_INPUT__GET_RES && type != STREAM_INPUT__CHECKPOINT && pTask->triggerParam != 0) {
|
||||
atomic_val_compare_exchange_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__INACTIVE, TASK_TRIGGER_STATUS__ACTIVE);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TODO: back pressure
|
||||
atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__NORMAL);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* streamQueueNextItem(SStreamQueue* queue) {
|
||||
int8_t dequeueFlag = atomic_exchange_8(&queue->status, STREAM_QUEUE__PROCESSING);
|
||||
if (dequeueFlag == STREAM_QUEUE__FAILED) {
|
||||
ASSERT(queue->qItem != NULL);
|
||||
return streamQueueCurItem(queue);
|
||||
} else {
|
||||
queue->qItem = NULL;
|
||||
taosGetQitem(queue->qall, &queue->qItem);
|
||||
if (queue->qItem == NULL) {
|
||||
taosReadAllQitems(queue->queue, queue->qall);
|
||||
taosGetQitem(queue->qall, &queue->qItem);
|
||||
}
|
||||
return streamQueueCurItem(queue);
|
||||
}
|
||||
}
|
|
@ -48,10 +48,12 @@ int32_t streamRetrieveReqToData(const SStreamRetrieveReq* pReq, SStreamDataBlock
|
|||
if (pArray == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
taosArrayPush(pArray, &(SSDataBlock){0});
|
||||
SRetrieveTableRsp* pRetrieve = pReq->pRetrieve;
|
||||
SSDataBlock* pDataBlock = taosArrayGet(pArray, 0);
|
||||
blockDecode(pDataBlock, pRetrieve->data);
|
||||
|
||||
// TODO: refactor
|
||||
pDataBlock->info.window.skey = be64toh(pRetrieve->skey);
|
||||
pDataBlock->info.window.ekey = be64toh(pRetrieve->ekey);
|
||||
|
@ -68,32 +70,51 @@ int32_t streamRetrieveReqToData(const SStreamRetrieveReq* pReq, SStreamDataBlock
|
|||
SStreamDataSubmit2* streamDataSubmitNew(SPackedData submit) {
|
||||
SStreamDataSubmit2* pDataSubmit = (SStreamDataSubmit2*)taosAllocateQitem(sizeof(SStreamDataSubmit2), DEF_QITEM, 0);
|
||||
|
||||
if (pDataSubmit == NULL) return NULL;
|
||||
if (pDataSubmit == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pDataSubmit->dataRef = (int32_t*)taosMemoryMalloc(sizeof(int32_t));
|
||||
if (pDataSubmit->dataRef == NULL) goto FAIL;
|
||||
if (pDataSubmit->dataRef == NULL) {
|
||||
taosFreeQitem(pDataSubmit);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pDataSubmit->submit = submit;
|
||||
*pDataSubmit->dataRef = 1;
|
||||
*pDataSubmit->dataRef = 1; // initialize the reference count to be 1
|
||||
pDataSubmit->type = STREAM_INPUT__DATA_SUBMIT;
|
||||
|
||||
return pDataSubmit;
|
||||
FAIL:
|
||||
taosFreeQitem(pDataSubmit);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void streamDataSubmitDestroy(SStreamDataSubmit2* pDataSubmit) {
|
||||
int32_t ref = atomic_sub_fetch_32(pDataSubmit->dataRef, 1);
|
||||
ASSERT(ref >= 0 && pDataSubmit->type == STREAM_INPUT__DATA_SUBMIT);
|
||||
|
||||
if (ref == 0) {
|
||||
taosMemoryFree(pDataSubmit->submit.msgStr);
|
||||
taosMemoryFree(pDataSubmit->dataRef);
|
||||
}
|
||||
}
|
||||
|
||||
SStreamMergedSubmit2* streamMergedSubmitNew() {
|
||||
SStreamMergedSubmit2* pMerged = (SStreamMergedSubmit2*)taosAllocateQitem(sizeof(SStreamMergedSubmit2), DEF_QITEM, 0);
|
||||
if (pMerged == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pMerged == NULL) return NULL;
|
||||
pMerged->submits = taosArrayInit(0, sizeof(SPackedData));
|
||||
pMerged->dataRefs = taosArrayInit(0, sizeof(void*));
|
||||
if (pMerged->dataRefs == NULL || pMerged->submits == NULL) goto FAIL;
|
||||
|
||||
if (pMerged->dataRefs == NULL || pMerged->submits == NULL) {
|
||||
taosArrayDestroy(pMerged->submits);
|
||||
taosArrayDestroy(pMerged->dataRefs);
|
||||
taosFreeQitem(pMerged);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pMerged->type = STREAM_INPUT__MERGED_SUBMIT;
|
||||
return pMerged;
|
||||
FAIL:
|
||||
if (pMerged->submits) taosArrayDestroy(pMerged->submits);
|
||||
if (pMerged->dataRefs) taosArrayDestroy(pMerged->dataRefs);
|
||||
taosFreeQitem(pMerged);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int32_t streamMergeSubmit(SStreamMergedSubmit2* pMerged, SStreamDataSubmit2* pSubmit) {
|
||||
|
@ -107,26 +128,17 @@ static FORCE_INLINE void streamDataSubmitRefInc(SStreamDataSubmit2* pDataSubmit)
|
|||
atomic_add_fetch_32(pDataSubmit->dataRef, 1);
|
||||
}
|
||||
|
||||
SStreamDataSubmit2* streamSubmitRefClone(SStreamDataSubmit2* pSubmit) {
|
||||
SStreamDataSubmit2* streamSubmitBlockClone(SStreamDataSubmit2* pSubmit) {
|
||||
SStreamDataSubmit2* pSubmitClone = taosAllocateQitem(sizeof(SStreamDataSubmit2), DEF_QITEM, 0);
|
||||
|
||||
if (pSubmitClone == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
streamDataSubmitRefInc(pSubmit);
|
||||
memcpy(pSubmitClone, pSubmit, sizeof(SStreamDataSubmit2));
|
||||
return pSubmitClone;
|
||||
}
|
||||
|
||||
void streamDataSubmitRefDec(SStreamDataSubmit2* pDataSubmit) {
|
||||
int32_t ref = atomic_sub_fetch_32(pDataSubmit->dataRef, 1);
|
||||
ASSERT(ref >= 0);
|
||||
if (ref == 0) {
|
||||
taosMemoryFree(pDataSubmit->submit.msgStr);
|
||||
taosMemoryFree(pDataSubmit->dataRef);
|
||||
}
|
||||
}
|
||||
|
||||
SStreamQueueItem* streamMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem) {
|
||||
ASSERT(elem);
|
||||
if (dst->type == STREAM_INPUT__DATA_BLOCK && elem->type == STREAM_INPUT__DATA_BLOCK) {
|
||||
|
@ -164,7 +176,7 @@ void streamFreeQitem(SStreamQueueItem* data) {
|
|||
taosArrayDestroyEx(((SStreamDataBlock*)data)->blocks, (FDelete)blockDataFreeRes);
|
||||
taosFreeQitem(data);
|
||||
} else if (type == STREAM_INPUT__DATA_SUBMIT) {
|
||||
streamDataSubmitRefDec((SStreamDataSubmit2*)data);
|
||||
streamDataSubmitDestroy((SStreamDataSubmit2*)data);
|
||||
taosFreeQitem(data);
|
||||
} else if (type == STREAM_INPUT__MERGED_SUBMIT) {
|
||||
SStreamMergedSubmit2* pMerge = (SStreamMergedSubmit2*)data;
|
||||
|
|
|
@ -34,7 +34,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray*
|
|||
} else if (pItem->type == STREAM_INPUT__DATA_SUBMIT) {
|
||||
ASSERT(pTask->taskLevel == TASK_LEVEL__SOURCE);
|
||||
const SStreamDataSubmit2* pSubmit = (const SStreamDataSubmit2*)data;
|
||||
qDebug("task %d %p set submit input %p %p %d %" PRId64, pTask->taskId, pTask, pSubmit, pSubmit->submit.msgStr,
|
||||
qDebug("stream task:%d %p set submit input %p %p %d %" PRId64, pTask->taskId, pTask, pSubmit, pSubmit->submit.msgStr,
|
||||
pSubmit->submit.msgLen, pSubmit->submit.ver);
|
||||
qSetMultiStreamInput(exec, &pSubmit->submit, 1, STREAM_INPUT__DATA_SUBMIT);
|
||||
} else if (pItem->type == STREAM_INPUT__DATA_BLOCK || pItem->type == STREAM_INPUT__DATA_RETRIEVE) {
|
||||
|
@ -268,9 +268,10 @@ int32_t streamExecForAll(SStreamTask* pTask) {
|
|||
|
||||
SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock));
|
||||
|
||||
qDebug("stream task %d exec begin, msg batch: %d", pTask->taskId, batchCnt);
|
||||
qDebug("stream task:%d exec begin, msg batch: %d", pTask->taskId, batchCnt);
|
||||
streamTaskExecImpl(pTask, input, pRes);
|
||||
qDebug("stream task %d exec end", pTask->taskId);
|
||||
|
||||
qDebug("stream task:%d exec end", pTask->taskId);
|
||||
|
||||
if (taosArrayGetSize(pRes) != 0) {
|
||||
SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, 0);
|
||||
|
|
|
@ -59,36 +59,36 @@ typedef struct SSyncLogBuffer {
|
|||
} SSyncLogBuffer;
|
||||
|
||||
// SSyncLogRepMgr
|
||||
SSyncLogReplMgr* syncLogReplMgrCreate();
|
||||
void syncLogReplMgrDestroy(SSyncLogReplMgr* pMgr);
|
||||
void syncLogReplMgrReset(SSyncLogReplMgr* pMgr);
|
||||
SSyncLogReplMgr* syncLogReplCreate();
|
||||
void syncLogReplDestroy(SSyncLogReplMgr* pMgr);
|
||||
void syncLogReplReset(SSyncLogReplMgr* pMgr);
|
||||
|
||||
int32_t syncNodeLogReplMgrInit(SSyncNode* pNode);
|
||||
void syncNodeLogReplMgrDestroy(SSyncNode* pNode);
|
||||
int32_t syncNodeLogReplInit(SSyncNode* pNode);
|
||||
void syncNodeLogReplDestroy(SSyncNode* pNode);
|
||||
|
||||
// access
|
||||
static FORCE_INLINE int64_t syncLogGetRetryBackoffTimeMs(SSyncLogReplMgr* pMgr) {
|
||||
static FORCE_INLINE int64_t syncLogReplGetRetryBackoffTimeMs(SSyncLogReplMgr* pMgr) {
|
||||
return ((int64_t)1 << pMgr->retryBackoff) * SYNC_LOG_REPL_RETRY_WAIT_MS;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t syncLogGetNextRetryBackoff(SSyncLogReplMgr* pMgr) {
|
||||
static FORCE_INLINE int32_t syncLogReplGetNextRetryBackoff(SSyncLogReplMgr* pMgr) {
|
||||
return TMIN(pMgr->retryBackoff + 1, SYNC_MAX_RETRY_BACKOFF);
|
||||
}
|
||||
|
||||
SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index);
|
||||
SyncTerm syncLogReplGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index);
|
||||
|
||||
int32_t syncLogReplMgrReplicateOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
|
||||
int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm,
|
||||
SRaftId* pDestId, bool* pBarrier);
|
||||
int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
|
||||
int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index);
|
||||
int32_t syncLogReplReplicateOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
|
||||
int32_t syncLogReplReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm,
|
||||
SRaftId* pDestId, bool* pBarrier);
|
||||
int32_t syncLogReplReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
|
||||
int32_t syncLogReplReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index);
|
||||
|
||||
int32_t syncLogReplMgrProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
|
||||
int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
|
||||
int32_t syncLogReplMgrProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
|
||||
int32_t syncLogReplProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
|
||||
int32_t syncLogReplProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
|
||||
int32_t syncLogReplProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
|
||||
|
||||
int32_t syncLogReplMgrProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg);
|
||||
int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
|
||||
int32_t syncLogReplProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg);
|
||||
int32_t syncLogReplRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
|
||||
|
||||
// SSyncLogBuffer
|
||||
SSyncLogBuffer* syncLogBufferCreate();
|
||||
|
@ -111,8 +111,8 @@ SSyncRaftEntry* syncLogBufferGetOneEntry(SSyncLogBuffer* pBuf, SSyncNode* pNode,
|
|||
int32_t syncLogBufferValidate(SSyncLogBuffer* pBuf);
|
||||
int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex toIndex);
|
||||
|
||||
int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry,
|
||||
int32_t applyCode);
|
||||
int32_t syncFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry,
|
||||
int32_t applyCode);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -85,7 +85,7 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
|
|||
sError("vgId:%d, failed to get log repl mgr for src addr: 0x%016" PRIx64, ths->vgId, pMsg->srcId.addr);
|
||||
return -1;
|
||||
}
|
||||
(void)syncLogReplMgrProcessReply(pMgr, ths, pMsg);
|
||||
(void)syncLogReplProcessReply(pMgr, ths, pMsg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -949,7 +949,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
|
|||
pSyncNode->changing = false;
|
||||
|
||||
// replication mgr
|
||||
if (syncNodeLogReplMgrInit(pSyncNode) < 0) {
|
||||
if (syncNodeLogReplInit(pSyncNode) < 0) {
|
||||
sError("vgId:%d, failed to init repl mgr since %s.", pSyncNode->vgId, terrstr());
|
||||
goto _error;
|
||||
}
|
||||
|
@ -1122,7 +1122,7 @@ void syncNodeClose(SSyncNode* pSyncNode) {
|
|||
syncNodeStopPingTimer(pSyncNode);
|
||||
syncNodeStopElectTimer(pSyncNode);
|
||||
syncNodeStopHeartbeatTimer(pSyncNode);
|
||||
syncNodeLogReplMgrDestroy(pSyncNode);
|
||||
syncNodeLogReplDestroy(pSyncNode);
|
||||
|
||||
syncRespMgrDestroy(pSyncNode->pSyncRespMgr);
|
||||
pSyncNode->pSyncRespMgr = NULL;
|
||||
|
@ -2164,7 +2164,7 @@ int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) {
|
|||
if (syncLogBufferAppend(ths->pLogBuf, ths, pEntry) < 0) {
|
||||
sError("vgId:%d, failed to enqueue sync log buffer, index:%" PRId64, ths->vgId, pEntry->index);
|
||||
ASSERT(terrno != 0);
|
||||
(void)syncLogFsmExecute(ths, ths->pFsm, ths->state, raftStoreGetTerm(ths), pEntry, terrno);
|
||||
(void)syncFsmExecute(ths, ths->pFsm, ths->state, raftStoreGetTerm(ths), pEntry, terrno);
|
||||
syncEntryDestroy(pEntry);
|
||||
return -1;
|
||||
}
|
||||
|
@ -2374,7 +2374,7 @@ int32_t syncNodeOnHeartbeatReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
|
|||
|
||||
syncIndexMgrSetRecvTime(ths->pMatchIndex, &pMsg->srcId, tsMs);
|
||||
|
||||
return syncLogReplMgrProcessHeartbeatReply(pMgr, ths, pMsg);
|
||||
return syncLogReplProcessHeartbeatReply(pMgr, ths, pMsg);
|
||||
}
|
||||
|
||||
int32_t syncNodeOnHeartbeatReplyOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
|
||||
|
|
|
@ -86,7 +86,7 @@ _err:
|
|||
return -1;
|
||||
}
|
||||
|
||||
SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) {
|
||||
SyncTerm syncLogReplGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) {
|
||||
SSyncLogBuffer* pBuf = pNode->pLogBuf;
|
||||
SSyncRaftEntry* pEntry = NULL;
|
||||
SyncIndex prevIndex = index - 1;
|
||||
|
@ -316,7 +316,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
|
|||
" %" PRId64 ", %" PRId64 ")",
|
||||
pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex,
|
||||
pBuf->endIndex);
|
||||
SyncTerm term = syncLogReplMgrGetPrevLogTerm(NULL, pNode, index + 1);
|
||||
SyncTerm term = syncLogReplGetPrevLogTerm(NULL, pNode, index + 1);
|
||||
ASSERT(pEntry->term >= 0);
|
||||
if (term == pEntry->term) {
|
||||
ret = 0;
|
||||
|
@ -351,7 +351,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
|
|||
" %" PRId64 " %" PRId64 ", %" PRId64 ")",
|
||||
pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex,
|
||||
pBuf->endIndex);
|
||||
SyncTerm existPrevTerm = syncLogReplMgrGetPrevLogTerm(NULL, pNode, index);
|
||||
SyncTerm existPrevTerm = syncLogReplGetPrevLogTerm(NULL, pNode, index);
|
||||
ASSERT(pEntry->term == pExist->term && (pEntry->index > pBuf->matchIndex || prevTerm == existPrevTerm));
|
||||
ret = 0;
|
||||
goto _out;
|
||||
|
@ -482,8 +482,8 @@ _out:
|
|||
return matchIndex;
|
||||
}
|
||||
|
||||
int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry,
|
||||
int32_t applyCode) {
|
||||
int32_t syncFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry,
|
||||
int32_t applyCode) {
|
||||
if (pNode->replicaNum == 1 && pNode->restoreFinish && pNode->vgId != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -564,7 +564,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm
|
|||
pEntry->term, TMSG_INFO(pEntry->originalRpcType));
|
||||
}
|
||||
|
||||
if (syncLogFsmExecute(pNode, pFsm, role, currentTerm, pEntry, 0) != 0) {
|
||||
if (syncFsmExecute(pNode, pFsm, role, currentTerm, pEntry, 0) != 0) {
|
||||
sError("vgId:%d, failed to execute sync log entry. index:%" PRId64 ", term:%" PRId64
|
||||
", role:%d, current term:%" PRId64,
|
||||
vgId, pEntry->index, pEntry->term, role, currentTerm);
|
||||
|
@ -611,7 +611,7 @@ _out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
void syncLogReplMgrReset(SSyncLogReplMgr* pMgr) {
|
||||
void syncLogReplReset(SSyncLogReplMgr* pMgr) {
|
||||
if (pMgr == NULL) return;
|
||||
|
||||
ASSERT(pMgr->startIndex >= 0);
|
||||
|
@ -625,14 +625,14 @@ void syncLogReplMgrReset(SSyncLogReplMgr* pMgr) {
|
|||
pMgr->retryBackoff = 0;
|
||||
}
|
||||
|
||||
int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
|
||||
int32_t syncLogReplRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
|
||||
if (pMgr->endIndex <= pMgr->startIndex) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
SRaftId* pDestId = &pNode->replicasId[pMgr->peerId];
|
||||
if (pMgr->retryBackoff == SYNC_MAX_RETRY_BACKOFF) {
|
||||
syncLogReplMgrReset(pMgr);
|
||||
syncLogReplReset(pMgr);
|
||||
sWarn("vgId:%d, reset sync log repl mgr since retry backoff exceeding limit. peer:%" PRIx64, pNode->vgId,
|
||||
pDestId->addr);
|
||||
return -1;
|
||||
|
@ -640,7 +640,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
|
|||
|
||||
int32_t ret = -1;
|
||||
bool retried = false;
|
||||
int64_t retryWaitMs = syncLogGetRetryBackoffTimeMs(pMgr);
|
||||
int64_t retryWaitMs = syncLogReplGetRetryBackoffTimeMs(pMgr);
|
||||
int64_t nowMs = taosGetMonoTimestampMs();
|
||||
int count = 0;
|
||||
int64_t firstIndex = -1;
|
||||
|
@ -657,7 +657,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
|
|||
|
||||
if (pMgr->states[pos].acked) {
|
||||
if (pMgr->matchIndex < index && pMgr->states[pos].timeMs + (syncGetRetryMaxWaitMs() << 3) < nowMs) {
|
||||
syncLogReplMgrReset(pMgr);
|
||||
syncLogReplReset(pMgr);
|
||||
sWarn("vgId:%d, reset sync log repl mgr since stagnation. index:%" PRId64 ", peer:%" PRIx64, pNode->vgId,
|
||||
index, pDestId->addr);
|
||||
goto _out;
|
||||
|
@ -666,7 +666,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
|
|||
}
|
||||
|
||||
bool barrier = false;
|
||||
if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
|
||||
if (syncLogReplReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
|
||||
sError("vgId:%d, failed to replicate sync log entry since %s. index:%" PRId64 ", dest:%" PRIx64 "", pNode->vgId,
|
||||
terrstr(), index, pDestId->addr);
|
||||
goto _out;
|
||||
|
@ -687,7 +687,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
|
|||
ret = 0;
|
||||
_out:
|
||||
if (retried) {
|
||||
pMgr->retryBackoff = syncLogGetNextRetryBackoff(pMgr);
|
||||
pMgr->retryBackoff = syncLogReplGetNextRetryBackoff(pMgr);
|
||||
SSyncLogBuffer* pBuf = pNode->pLogBuf;
|
||||
sInfo("vgId:%d, resend %d sync log entries. dest:%" PRIx64 ", indexes:%" PRId64 " ..., terms: ... %" PRId64
|
||||
", retryWaitMs:%" PRId64 ", mgr: [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64
|
||||
|
@ -698,7 +698,7 @@ _out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
|
||||
int32_t syncLogReplProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
|
||||
SSyncLogBuffer* pBuf = pNode->pLogBuf;
|
||||
SRaftId destId = pMsg->srcId;
|
||||
ASSERT(pMgr->restored == false);
|
||||
|
@ -716,7 +716,7 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
|
|||
}
|
||||
} else {
|
||||
if (pMsg->lastSendIndex < pMgr->startIndex || pMsg->lastSendIndex >= pMgr->endIndex) {
|
||||
syncLogReplMgrRetryOnNeed(pMgr, pNode);
|
||||
syncLogReplRetryOnNeed(pMgr, pNode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -750,7 +750,7 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
|
|||
SyncIndex index = TMIN(pMsg->matchIndex, pNode->pLogBuf->matchIndex);
|
||||
|
||||
if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) {
|
||||
term = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index + 1);
|
||||
term = syncLogReplGetPrevLogTerm(pMgr, pNode, index + 1);
|
||||
if ((index + 1 < firstVer) || (term < 0) ||
|
||||
(term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) {
|
||||
ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST);
|
||||
|
@ -773,53 +773,53 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
|
|||
}
|
||||
|
||||
// attempt to replicate the raft log at index
|
||||
(void)syncLogReplMgrReset(pMgr);
|
||||
return syncLogReplMgrReplicateProbe(pMgr, pNode, index);
|
||||
(void)syncLogReplReset(pMgr);
|
||||
return syncLogReplReplicateProbe(pMgr, pNode, index);
|
||||
}
|
||||
|
||||
int32_t syncLogReplMgrProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg) {
|
||||
int32_t syncLogReplProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg) {
|
||||
SSyncLogBuffer* pBuf = pNode->pLogBuf;
|
||||
taosThreadMutexLock(&pBuf->mutex);
|
||||
if (pMsg->startTime != 0 && pMsg->startTime != pMgr->peerStartTime) {
|
||||
sInfo("vgId:%d, reset sync log repl mgr in heartbeat. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64 "",
|
||||
pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime);
|
||||
syncLogReplMgrReset(pMgr);
|
||||
syncLogReplReset(pMgr);
|
||||
pMgr->peerStartTime = pMsg->startTime;
|
||||
}
|
||||
taosThreadMutexUnlock(&pBuf->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t syncLogReplMgrProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
|
||||
int32_t syncLogReplProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
|
||||
SSyncLogBuffer* pBuf = pNode->pLogBuf;
|
||||
taosThreadMutexLock(&pBuf->mutex);
|
||||
if (pMsg->startTime != pMgr->peerStartTime) {
|
||||
sInfo("vgId:%d, reset sync log repl mgr in appendlog reply. peer:%" PRIx64 ", start time:%" PRId64
|
||||
", old:%" PRId64,
|
||||
pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime);
|
||||
syncLogReplMgrReset(pMgr);
|
||||
syncLogReplReset(pMgr);
|
||||
pMgr->peerStartTime = pMsg->startTime;
|
||||
}
|
||||
|
||||
if (pMgr->restored) {
|
||||
(void)syncLogReplMgrProcessReplyAsNormal(pMgr, pNode, pMsg);
|
||||
(void)syncLogReplProcessReplyAsNormal(pMgr, pNode, pMsg);
|
||||
} else {
|
||||
(void)syncLogReplMgrProcessReplyAsRecovery(pMgr, pNode, pMsg);
|
||||
(void)syncLogReplProcessReplyAsRecovery(pMgr, pNode, pMsg);
|
||||
}
|
||||
taosThreadMutexUnlock(&pBuf->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t syncLogReplMgrReplicateOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
|
||||
int32_t syncLogReplReplicateOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
|
||||
if (pMgr->restored) {
|
||||
(void)syncLogReplMgrReplicateAttempt(pMgr, pNode);
|
||||
(void)syncLogReplReplicateAttempt(pMgr, pNode);
|
||||
} else {
|
||||
(void)syncLogReplMgrReplicateProbe(pMgr, pNode, pNode->pLogBuf->matchIndex);
|
||||
(void)syncLogReplReplicateProbe(pMgr, pNode, pNode->pLogBuf->matchIndex);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) {
|
||||
int32_t syncLogReplReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) {
|
||||
ASSERT(!pMgr->restored);
|
||||
ASSERT(pMgr->startIndex >= 0);
|
||||
int64_t retryMaxWaitMs = syncGetRetryMaxWaitMs();
|
||||
|
@ -829,12 +829,12 @@ int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
|
|||
nowMs < pMgr->states[pMgr->startIndex % pMgr->size].timeMs + retryMaxWaitMs) {
|
||||
return 0;
|
||||
}
|
||||
(void)syncLogReplMgrReset(pMgr);
|
||||
(void)syncLogReplReset(pMgr);
|
||||
|
||||
SRaftId* pDestId = &pNode->replicasId[pMgr->peerId];
|
||||
bool barrier = false;
|
||||
SyncTerm term = -1;
|
||||
if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
|
||||
if (syncLogReplReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
|
||||
sError("vgId:%d, failed to replicate log entry since %s. index:%" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId,
|
||||
terrstr(), index, pDestId->addr);
|
||||
return -1;
|
||||
|
@ -857,7 +857,7 @@ int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
|
||||
int32_t syncLogReplReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
|
||||
ASSERT(pMgr->restored);
|
||||
|
||||
SRaftId* pDestId = &pNode->replicasId[pMgr->peerId];
|
||||
|
@ -879,7 +879,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode)
|
|||
SRaftId* pDestId = &pNode->replicasId[pMgr->peerId];
|
||||
bool barrier = false;
|
||||
SyncTerm term = -1;
|
||||
if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
|
||||
if (syncLogReplReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
|
||||
sError("vgId:%d, failed to replicate log entry since %s. index:%" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId,
|
||||
terrstr(), index, pDestId->addr);
|
||||
return -1;
|
||||
|
@ -902,7 +902,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode)
|
|||
}
|
||||
}
|
||||
|
||||
syncLogReplMgrRetryOnNeed(pMgr, pNode);
|
||||
syncLogReplRetryOnNeed(pMgr, pNode);
|
||||
|
||||
SSyncLogBuffer* pBuf = pNode->pLogBuf;
|
||||
sTrace("vgId:%d, replicated %d msgs to peer:%" PRIx64 ". indexes:%" PRId64 "..., terms: ...%" PRId64
|
||||
|
@ -913,7 +913,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t syncLogReplMgrProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
|
||||
int32_t syncLogReplProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
|
||||
ASSERT(pMgr->restored == true);
|
||||
if (pMgr->startIndex <= pMsg->lastSendIndex && pMsg->lastSendIndex < pMgr->endIndex) {
|
||||
if (pMgr->startIndex < pMgr->matchIndex && pMgr->retryBackoff > 0) {
|
||||
|
@ -932,10 +932,10 @@ int32_t syncLogReplMgrProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNo
|
|||
pMgr->startIndex = pMgr->matchIndex;
|
||||
}
|
||||
|
||||
return syncLogReplMgrReplicateAttempt(pMgr, pNode);
|
||||
return syncLogReplReplicateAttempt(pMgr, pNode);
|
||||
}
|
||||
|
||||
SSyncLogReplMgr* syncLogReplMgrCreate() {
|
||||
SSyncLogReplMgr* syncLogReplCreate() {
|
||||
SSyncLogReplMgr* pMgr = taosMemoryCalloc(1, sizeof(SSyncLogReplMgr));
|
||||
if (pMgr == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -949,7 +949,7 @@ SSyncLogReplMgr* syncLogReplMgrCreate() {
|
|||
return pMgr;
|
||||
}
|
||||
|
||||
void syncLogReplMgrDestroy(SSyncLogReplMgr* pMgr) {
|
||||
void syncLogReplDestroy(SSyncLogReplMgr* pMgr) {
|
||||
if (pMgr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -957,10 +957,10 @@ void syncLogReplMgrDestroy(SSyncLogReplMgr* pMgr) {
|
|||
return;
|
||||
}
|
||||
|
||||
int32_t syncNodeLogReplMgrInit(SSyncNode* pNode) {
|
||||
int32_t syncNodeLogReplInit(SSyncNode* pNode) {
|
||||
for (int i = 0; i < TSDB_MAX_REPLICA; i++) {
|
||||
ASSERT(pNode->logReplMgrs[i] == NULL);
|
||||
pNode->logReplMgrs[i] = syncLogReplMgrCreate();
|
||||
pNode->logReplMgrs[i] = syncLogReplCreate();
|
||||
if (pNode->logReplMgrs[i] == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
|
@ -970,9 +970,9 @@ int32_t syncNodeLogReplMgrInit(SSyncNode* pNode) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void syncNodeLogReplMgrDestroy(SSyncNode* pNode) {
|
||||
void syncNodeLogReplDestroy(SSyncNode* pNode) {
|
||||
for (int i = 0; i < TSDB_MAX_REPLICA; i++) {
|
||||
syncLogReplMgrDestroy(pNode->logReplMgrs[i]);
|
||||
syncLogReplDestroy(pNode->logReplMgrs[i]);
|
||||
pNode->logReplMgrs[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1103,7 +1103,7 @@ int32_t syncLogBufferReset(SSyncLogBuffer* pBuf, SSyncNode* pNode) {
|
|||
// reset repl mgr
|
||||
for (int i = 0; i < pNode->replicaNum; i++) {
|
||||
SSyncLogReplMgr* pMgr = pNode->logReplMgrs[i];
|
||||
syncLogReplMgrReset(pMgr);
|
||||
syncLogReplReset(pMgr);
|
||||
}
|
||||
syncLogBufferValidate(pBuf);
|
||||
taosThreadMutexUnlock(&pBuf->mutex);
|
||||
|
@ -1127,8 +1127,8 @@ SSyncRaftEntry* syncLogBufferGetOneEntry(SSyncLogBuffer* pBuf, SSyncNode* pNode,
|
|||
return pEntry;
|
||||
}
|
||||
|
||||
int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm,
|
||||
SRaftId* pDestId, bool* pBarrier) {
|
||||
int32_t syncLogReplReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm,
|
||||
SRaftId* pDestId, bool* pBarrier) {
|
||||
SSyncRaftEntry* pEntry = NULL;
|
||||
SRpcMsg msgOut = {0};
|
||||
bool inBuf = false;
|
||||
|
@ -1143,14 +1143,14 @@ int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
|
|||
if (pMgr) {
|
||||
sInfo("vgId:%d, reset sync log repl mgr of peer:%" PRIx64 " since %s. index:%" PRId64, pNode->vgId,
|
||||
pDestId->addr, terrstr(), index);
|
||||
(void)syncLogReplMgrReset(pMgr);
|
||||
(void)syncLogReplReset(pMgr);
|
||||
}
|
||||
}
|
||||
goto _err;
|
||||
}
|
||||
*pBarrier = syncLogIsReplicationBarrier(pEntry);
|
||||
|
||||
prevLogTerm = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index);
|
||||
prevLogTerm = syncLogReplGetPrevLogTerm(pMgr, pNode, index);
|
||||
if (prevLogTerm < 0) {
|
||||
sError("vgId:%d, failed to get prev log term since %s. index:%" PRId64 "", pNode->vgId, terrstr(), index);
|
||||
goto _err;
|
||||
|
|
|
@ -52,7 +52,7 @@ int32_t syncNodeReplicateReset(SSyncNode* pNode, SRaftId* pDestId) {
|
|||
SSyncLogBuffer* pBuf = pNode->pLogBuf;
|
||||
taosThreadMutexLock(&pBuf->mutex);
|
||||
SSyncLogReplMgr* pMgr = syncNodeGetLogReplMgr(pNode, pDestId);
|
||||
syncLogReplMgrReset(pMgr);
|
||||
syncLogReplReset(pMgr);
|
||||
taosThreadMutexUnlock(&pBuf->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ int32_t syncNodeReplicateWithoutLock(SSyncNode* pNode) {
|
|||
continue;
|
||||
}
|
||||
SSyncLogReplMgr* pMgr = pNode->logReplMgrs[i];
|
||||
(void)syncLogReplMgrReplicateOnce(pMgr, pNode);
|
||||
(void)syncLogReplReplicateOnce(pMgr, pNode);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ static void syncLogBufferStates2Str(SSyncNode* pSyncNode, char* buf, int32_t buf
|
|||
pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex);
|
||||
}
|
||||
|
||||
static void syncLogReplMgrStates2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
|
||||
static void syncLogReplStates2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
|
||||
int len = 0;
|
||||
len += snprintf(buf + len, bufLen - len, "%s", "{");
|
||||
for (int32_t i = 0; i < pSyncNode->replicaNum; i++) {
|
||||
|
@ -178,7 +178,7 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
|
|||
syncCfg2SimpleStr(&pNode->raftCfg.cfg, cfgStr, sizeof(cfgStr));
|
||||
|
||||
char replMgrStatesStr[1024] = "";
|
||||
syncLogReplMgrStates2Str(pNode, replMgrStatesStr, sizeof(replMgrStatesStr));
|
||||
syncLogReplStates2Str(pNode, replMgrStatesStr, sizeof(replMgrStatesStr));
|
||||
|
||||
char bufferStatesStr[256] = "";
|
||||
syncLogBufferStates2Str(pNode, bufferStatesStr, sizeof(bufferStatesStr));
|
||||
|
|
|
@ -33,7 +33,6 @@ SWalReader *walOpenReader(SWal *pWal, SWalFilterCond *cond) {
|
|||
pReader->pLogFile = NULL;
|
||||
pReader->curVersion = -1;
|
||||
pReader->curFileFirstVer = -1;
|
||||
pReader->curInvalid = 1;
|
||||
pReader->capacity = 0;
|
||||
if (cond) {
|
||||
pReader->cond = *cond;
|
||||
|
@ -81,7 +80,6 @@ int32_t walNextValidMsg(SWalReader *pReader) {
|
|||
wDebug("vgId:%d, wal start to fetch, index:%" PRId64 ", last index:%" PRId64 " commit index:%" PRId64
|
||||
", applied index:%" PRId64 ", end index:%" PRId64,
|
||||
pReader->pWal->cfg.vgId, fetchVer, lastVer, committedVer, appliedVer, endVer);
|
||||
pReader->curStopped = 0;
|
||||
while (fetchVer <= endVer) {
|
||||
if (walFetchHeadNew(pReader, fetchVer) < 0) {
|
||||
return -1;
|
||||
|
@ -99,7 +97,6 @@ int32_t walNextValidMsg(SWalReader *pReader) {
|
|||
fetchVer = pReader->curVersion;
|
||||
}
|
||||
}
|
||||
pReader->curStopped = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -196,17 +193,16 @@ int32_t walReadSeekVerImpl(SWalReader *pReader, int64_t ver) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
wDebug("vgId:%d, wal version reset from %" PRId64 "(invalid:%d) to %" PRId64, pReader->pWal->cfg.vgId,
|
||||
pReader->curVersion, pReader->curInvalid, ver);
|
||||
wDebug("vgId:%d, wal version reset from %" PRId64 " to %" PRId64, pReader->pWal->cfg.vgId,
|
||||
pReader->curVersion, ver);
|
||||
|
||||
pReader->curVersion = ver;
|
||||
pReader->curInvalid = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) {
|
||||
SWal *pWal = pReader->pWal;
|
||||
if (!pReader->curInvalid && ver == pReader->curVersion) {
|
||||
if (ver == pReader->curVersion) {
|
||||
wDebug("vgId:%d, wal index:%" PRId64 " match, no need to reset", pReader->pWal->cfg.vgId, ver);
|
||||
return 0;
|
||||
}
|
||||
|
@ -238,7 +234,7 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
|
|||
|
||||
wDebug("vgId:%d, wal starts to fetch head, index:%" PRId64, pRead->pWal->cfg.vgId, fetchVer);
|
||||
|
||||
if (pRead->curInvalid || pRead->curVersion != fetchVer) {
|
||||
if (pRead->curVersion != fetchVer) {
|
||||
if (walReadSeekVer(pRead, fetchVer) < 0) {
|
||||
// pRead->curVersion = fetchVer;
|
||||
// pRead->curInvalid = 1;
|
||||
|
@ -344,7 +340,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (pRead->curInvalid || pRead->curVersion != ver) {
|
||||
if (pRead->curVersion != ver) {
|
||||
code = walReadSeekVer(pRead, ver);
|
||||
if (code < 0) {
|
||||
// pRead->curVersion = ver;
|
||||
|
@ -479,7 +475,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) {
|
|||
|
||||
taosThreadMutexLock(&pReader->mutex);
|
||||
|
||||
if (pReader->curInvalid || pReader->curVersion != ver) {
|
||||
if (pReader->curVersion != ver) {
|
||||
if (walReadSeekVer(pReader, ver) < 0) {
|
||||
wError("vgId:%d, unexpected wal log, index:%" PRId64 ", since %s", pReader->pWal->cfg.vgId, ver, terrstr());
|
||||
taosThreadMutexUnlock(&pReader->mutex);
|
||||
|
@ -575,7 +571,6 @@ void walReadReset(SWalReader *pReader) {
|
|||
taosThreadMutexLock(&pReader->mutex);
|
||||
taosCloseFile(&pReader->pIdxFile);
|
||||
taosCloseFile(&pReader->pLogFile);
|
||||
pReader->curInvalid = 1;
|
||||
pReader->curFileFirstVer = -1;
|
||||
pReader->curVersion = -1;
|
||||
taosThreadMutexUnlock(&pReader->mutex);
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
#include "os.h"
|
||||
#include "taoserror.h"
|
||||
|
||||
#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
|
||||
#include "cus_name.h"
|
||||
#endif
|
||||
|
||||
#define PROCESS_ITEM 12
|
||||
#define UUIDLEN37 37
|
||||
|
||||
|
@ -252,7 +256,11 @@ int32_t taosGetEmail(char *email, int32_t maxLen) {
|
|||
#ifdef WINDOWS
|
||||
// ASSERT(0);
|
||||
#elif defined(_TD_DARWIN_64)
|
||||
#ifdef CUS_PROMPT
|
||||
const char *filepath = "/usr/local/"CUS_PROMPT"/email";
|
||||
#else
|
||||
const char *filepath = "/usr/local/taos/email";
|
||||
#endif // CUS_PROMPT
|
||||
|
||||
TdFilePtr pFile = taosOpenFile(filepath, TD_FILE_READ);
|
||||
if (pFile == NULL) return false;
|
||||
|
@ -264,8 +272,12 @@ int32_t taosGetEmail(char *email, int32_t maxLen) {
|
|||
|
||||
taosCloseFile(&pFile);
|
||||
return 0;
|
||||
#else
|
||||
#ifdef CUS_PROMPT
|
||||
const char *filepath = "/usr/local/"CUS_PROMPT"/email";
|
||||
#else
|
||||
const char *filepath = "/usr/local/taos/email";
|
||||
#endif // CUS_PROMPT
|
||||
|
||||
TdFilePtr pFile = taosOpenFile(filepath, TD_FILE_READ);
|
||||
if (pFile == NULL) return false;
|
||||
|
|
|
@ -628,6 +628,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INDEX_INVALID_FILE, "Index file is inval
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_INVALID_MSG, "Invalid message")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_CONSUMER_MISMATCH, "Consumer mismatch")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_CONSUMER_CLOSED, "Consumer closed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_CONSUMER_ERROR, "Consumer error, to see log")
|
||||
|
||||
// stream
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_TASK_NOT_EXIST, "Stream task not exist")
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStbCtb.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUdf.py
|
||||
#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUdf.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py
|
||||
|
|
|
@ -122,9 +122,11 @@ int insertAUTOTest2(TAOS_STMT *stmt, TAOS *taos);
|
|||
int insertAUTOTest3(TAOS_STMT *stmt, TAOS *taos);
|
||||
int queryColumnTest(TAOS_STMT *stmt, TAOS *taos);
|
||||
int queryMiscTest(TAOS_STMT *stmt, TAOS *taos);
|
||||
int insertNonExistsTb(TAOS_STMT *stmt, TAOS *taos);
|
||||
|
||||
enum {
|
||||
TTYPE_INSERT = 1,
|
||||
TTYPE_INSERT_NG,
|
||||
TTYPE_QUERY,
|
||||
};
|
||||
|
||||
|
@ -187,6 +189,8 @@ CaseCfg gCase[] = {
|
|||
{"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryColumnTest, 10, 10, 1, 3, 0, 0, 1, 2},
|
||||
{"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryMiscTest, 10, 10, 1, 3, 0, 0, 1, 2},
|
||||
|
||||
{"query:NG-TBNEXISTS",tListLen(fullColList), fullColList, TTYPE_INSERT_NG,0, false, false, insertNonExistsTb, 10, 10, 1, 3, 0, 0, 1, -1},
|
||||
|
||||
// {"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryColumnTest, 1, 10, 1, 1, 0, 0, 1, 2},
|
||||
// {"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryMiscTest, 2, 10, 1, 1, 0, 0, 1, 2},
|
||||
|
||||
|
@ -250,7 +254,7 @@ CaseCtrl gCaseCtrl = {
|
|||
.funcIdxList = NULL,
|
||||
.checkParamNum = false,
|
||||
.runTimes = 0,
|
||||
.caseIdx = 24,
|
||||
.caseIdx = 26,
|
||||
.caseNum = 1,
|
||||
.caseRunIdx = -1,
|
||||
.caseRunNum = -1,
|
||||
|
@ -2191,6 +2195,47 @@ int queryMiscTest(TAOS_STMT *stmt, TAOS *taos) {
|
|||
}
|
||||
|
||||
|
||||
int insertNonExistsTb(TAOS_STMT *stmt, TAOS *taos) {
|
||||
BindData data = {0};
|
||||
prepareInsertData(&data);
|
||||
|
||||
int code = taos_stmt_prepare(stmt, data.sql, 0);
|
||||
if (code != 0){
|
||||
printf("!!!failed to execute taos_stmt_prepare. error:%s\n", taos_stmt_errstr(stmt));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
bpCheckIsInsert(stmt, 1);
|
||||
|
||||
char *buf = "tbnexist";
|
||||
code = bpSetTableNameTags(&data, 0, buf, stmt);
|
||||
if (code == 0){
|
||||
printf("!!!taos_stmt_set_tbname expected error not occurred\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (0 == taos_stmt_bind_param_batch(stmt, data.pBind)) {
|
||||
printf("!!!taos_stmt_bind_param_batch expected error not occurred\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (0 == taos_stmt_add_batch(stmt)) {
|
||||
printf("!!!taos_stmt_add_batch expected error not occurred\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (0 == taos_stmt_execute(stmt)) {
|
||||
printf("!!!taos_stmt_execute expected error not occurred\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
destroyData(&data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int errorSQLTest1(TAOS_STMT *stmt, TAOS *taos) {
|
||||
BindData data = {0};
|
||||
|
||||
|
@ -2213,6 +2258,10 @@ int errorSQLTest1(TAOS_STMT *stmt, TAOS *taos) {
|
|||
}
|
||||
|
||||
void prepareCheckResultImpl(TAOS * taos, char *tname, bool printr, int expected, bool silent) {
|
||||
if (TTYPE_INSERT_NG == gCurCase->testType) {
|
||||
return;
|
||||
}
|
||||
|
||||
char sql[255] = "SELECT * FROM ";
|
||||
int32_t rows = 0;
|
||||
|
||||
|
|
|
@ -111,8 +111,8 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfStb = $ctbNum * $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfStb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from stb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
|
||||
|
@ -134,7 +134,7 @@ if $data[0][2] != $expectmsgcnt then
|
|||
print expect $expectmsgcnt , actual $data02
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $expectmsgcnt then
|
||||
if $data[0][3] != $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
$loop_cnt = $loop_cnt + 1
|
||||
|
@ -183,8 +183,8 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfCtb = $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfCtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ctb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -202,7 +202,7 @@ endi
|
|||
if $data[0][1] != $consumerId then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][2] != $totalMsgOfCtb then
|
||||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $totalMsgOfCtb then
|
||||
|
@ -254,8 +254,8 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfNtb = $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfNtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ntb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -273,7 +273,7 @@ endi
|
|||
if $data[0][1] != $consumerId then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][2] != $totalMsgOfNtb then
|
||||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $totalMsgOfNtb then
|
||||
|
|
|
@ -111,11 +111,11 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfStb = $ctbNum * $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfStb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from stb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
|
||||
|
@ -142,14 +142,14 @@ if $data[0][1] == 1 then
|
|||
endi
|
||||
endi
|
||||
|
||||
# either $data[0][2] == $totalMsgOfStb and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfStb
|
||||
if $data[0][2] == $totalMsgOfStb then
|
||||
# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 0 then
|
||||
goto check_ok_0
|
||||
endi
|
||||
elif $data[0][2] == 0 then
|
||||
if $data[1][2] == $totalMsgOfStb then
|
||||
if $data[1][2] == $expectmsgcnt then
|
||||
goto check_ok_0
|
||||
endi
|
||||
endi
|
||||
|
@ -214,10 +214,10 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfCtb = $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfCtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ctb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -244,14 +244,14 @@ if $data[0][1] == 1 then
|
|||
endi
|
||||
endi
|
||||
|
||||
# either $data[0][2] == $totalMsgOfCtb and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfCtb
|
||||
if $data[0][2] == $totalMsgOfCtb then
|
||||
# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 0 then
|
||||
goto check_ok_2
|
||||
endi
|
||||
elif $data[0][2] == 0 then
|
||||
if $data[1][2] == $totalMsgOfCtb then
|
||||
if $data[1][2] == $expectmsgcnt then
|
||||
goto check_ok_2
|
||||
endi
|
||||
endi
|
||||
|
@ -316,10 +316,10 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfNtb = $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfNtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ntb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -346,14 +346,14 @@ if $data[1][1] == 0 then
|
|||
endi
|
||||
endi
|
||||
|
||||
# either $data[0][2] == $totalMsgOfNtb and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfNtb
|
||||
if $data[0][2] == $totalMsgOfNtb then
|
||||
# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 0 then
|
||||
goto check_ok_4
|
||||
endi
|
||||
elif $data[0][2] == 0 then
|
||||
if $data[1][2] == $totalMsgOfNtb then
|
||||
if $data[1][2] == $expectmsgcnt then
|
||||
goto check_ok_4
|
||||
endi
|
||||
endi
|
||||
|
|
|
@ -83,8 +83,8 @@ $topicList = $topicList . '
|
|||
$consumerId = 0
|
||||
$totalMsgOfStb = $ctbNum * $rowsPerCtb
|
||||
$totalMsgOfStb = $totalMsgOfStb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfStb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from stb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
|
||||
|
@ -105,7 +105,7 @@ endi
|
|||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $expectmsgcnt then
|
||||
if $data[0][3] != $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -140,8 +140,8 @@ $topicList = $topicList . '
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfCtb = $rowsPerCtb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfCtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ctb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -159,7 +159,7 @@ endi
|
|||
if $data[0][1] != $consumerId then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][2] != $totalMsgOfCtb then
|
||||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $totalMsgOfCtb then
|
||||
|
@ -197,8 +197,8 @@ $topicList = $topicList . '
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfNtb = $rowsPerCtb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfNtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ntb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -216,7 +216,7 @@ endi
|
|||
if $data[0][1] != $consumerId then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][2] != $totalMsgOfNtb then
|
||||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $totalMsgOfNtb then
|
||||
|
|
|
@ -82,10 +82,10 @@ $topicList = $topicList . '
|
|||
$consumerId = 0
|
||||
$totalMsgOfStb = $ctbNum * $rowsPerCtb
|
||||
$totalMsgOfStb = $totalMsgOfStb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfStb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from stb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
|
||||
|
@ -112,14 +112,14 @@ if $data[0][1] == 1 then
|
|||
endi
|
||||
endi
|
||||
|
||||
# either $data[0][2] == $totalMsgOfStb and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfStb
|
||||
if $data[0][2] == $totalMsgOfStb then
|
||||
# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 0 then
|
||||
goto check_ok_0
|
||||
endi
|
||||
elif $data[0][2] == 0 then
|
||||
if $data[1][2] == $totalMsgOfStb then
|
||||
if $data[1][2] == $expectmsgcnt then
|
||||
goto check_ok_0
|
||||
endi
|
||||
endi
|
||||
|
@ -169,10 +169,10 @@ $topicList = $topicList . '
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfCtb = $rowsPerCtb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfCtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ctb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -199,14 +199,14 @@ if $data[0][1] == 1 then
|
|||
endi
|
||||
endi
|
||||
|
||||
# either $data[0][2] == $totalMsgOfCtb and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfCtb
|
||||
if $data[0][2] == $totalMsgOfCtb then
|
||||
# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 0 then
|
||||
goto check_ok_2
|
||||
endi
|
||||
elif $data[0][2] == 0 then
|
||||
if $data[1][2] == $totalMsgOfCtb then
|
||||
if $data[1][2] == $expectmsgcnt then
|
||||
goto check_ok_2
|
||||
endi
|
||||
endi
|
||||
|
@ -256,10 +256,10 @@ $topicList = $topicList . '
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfNtb = $rowsPerCtb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfNtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ntb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -286,14 +286,14 @@ if $data[1][1] == 0 then
|
|||
endi
|
||||
endi
|
||||
|
||||
# either $data[0][2] == $totalMsgOfNtb and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfNtb
|
||||
if $data[0][2] == $totalMsgOfNtb then
|
||||
# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 0 then
|
||||
goto check_ok_4
|
||||
endi
|
||||
elif $data[0][2] == 0 then
|
||||
if $data[1][2] == $totalMsgOfNtb then
|
||||
if $data[1][2] == $expectmsgcnt then
|
||||
goto check_ok_4
|
||||
endi
|
||||
endi
|
||||
|
|
|
@ -80,8 +80,8 @@ $topicList = $topicList . '
|
|||
$consumerId = 0
|
||||
$totalMsgOfOneTopic = $ctbNum * $rowsPerCtb
|
||||
$totalMsgOfStb = $totalMsgOfOneTopic * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfStb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 3
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
|
||||
$topicList = ' . topic_stb_all
|
||||
|
@ -89,7 +89,7 @@ $topicList = $topicList . ,
|
|||
$topicList = $topicList . topic_stb_function
|
||||
$topicList = $topicList . '
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now +1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now +1s , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from stb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
|
||||
|
@ -118,40 +118,40 @@ endi
|
|||
|
||||
# $data[0][2]/$data[1][2] should be between $totalMsgOfOneTopic and $totalMsgOfStb.
|
||||
|
||||
if $data[0][2] < $totalMsgOfOneTopic then
|
||||
#if $data[0][2] < $totalMsgOfOneTopic then
|
||||
# return -1
|
||||
#endi
|
||||
if $data[0][2] > $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][2] > $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
if $data[1][2] < $totalMsgOfOneTopic then
|
||||
return -1
|
||||
endi
|
||||
if $data[1][2] > $totalMsgOfStb then
|
||||
#if $data[1][2] < $totalMsgOfOneTopic then
|
||||
# return -1
|
||||
#endi
|
||||
if $data[1][2] > $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
|
||||
$totalMsgCons = $totalMsgOfOneTopic + $totalMsgOfStb
|
||||
#$totalMsgCons = $totalMsgOfOneTopic + $totalMsgOfStb
|
||||
$sumOfMsgCnt = $data[0][2] + $data[1][2]
|
||||
if $sumOfMsgCnt != $totalMsgCons then
|
||||
print total: $totalMsgCons
|
||||
if $sumOfMsgCnt != $expectmsgcnt then
|
||||
print total: $expectmsgcnt
|
||||
print sum: $sumOfMsgCnt
|
||||
return -1
|
||||
endi
|
||||
|
||||
# $data[0][3]/$data[1][3] should be between $totalMsgOfOneTopic and $totalMsgOfStb.
|
||||
if $data[0][3] < $totalMsgOfOneTopic then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] > $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
if $data[1][3] < $totalMsgOfOneTopic then
|
||||
return -1
|
||||
endi
|
||||
if $data[1][3] > $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
#if $data[0][3] < $totalMsgOfStb then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data[0][3] > $totalMsgOfStb then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data[1][3] < $totalMsgOfStb then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data[1][3] > $totalMsgOfStb then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
$totalMsgCons = $totalMsgOfOneTopic + $totalMsgOfStb
|
||||
$sumOfRows = $data[0][3] + $data[1][3]
|
||||
|
@ -189,15 +189,15 @@ $consumerId = 0
|
|||
|
||||
$totalMsgOfOneTopic = $rowsPerCtb
|
||||
$totalMsgOfCtb = $totalMsgOfOneTopic * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfCtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
$topicList = ' . topic_ctb_function
|
||||
$topicList = $topicList . ,
|
||||
$topicList = $topicList . topic_ctb_all
|
||||
$topicList = $topicList . '
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now +1s, $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now +1s, $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ctb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
|
||||
|
@ -226,24 +226,24 @@ endi
|
|||
|
||||
# either $data[0][2] $totalMsgOfOneTopic and $data[1][2] == $totalMsgOfCtb
|
||||
# or $data[0][2] $totalMsgOfCtb and $data[1][2] == $totalMsgOfOneTopic
|
||||
if $data[0][2] == $totalMsgOfOneTopic then
|
||||
if $data[1][2] == $totalMsgOfCtb then
|
||||
if $data[0][2] == $topicNum then
|
||||
if $data[1][2] == 1 then
|
||||
goto check_ok_0
|
||||
endi
|
||||
elif $data[1][2] == $totalMsgOfOneTopic then
|
||||
if $data[0][2] == $totalMsgOfCtb then
|
||||
elif $data[0][2] == 1 then
|
||||
if $data[1][2] == $topicNum then
|
||||
goto check_ok_0
|
||||
endi
|
||||
endi
|
||||
return -1
|
||||
check_ok_0:
|
||||
|
||||
if $data[0][3] == $totalMsgOfOneTopic then
|
||||
if $data[1][3] == $totalMsgOfCtb then
|
||||
if $data[0][3] == $totalMsgOfCtb then
|
||||
if $data[1][3] == $totalMsgOfOneTopic then
|
||||
goto check_ok_1
|
||||
endi
|
||||
elif $data[1][3] == $totalMsgOfOneTopic then
|
||||
if $data[0][3] == $totalMsgOfCtb then
|
||||
elif $data[0][3] == $totalMsgOfOneTopic then
|
||||
if $data[1][3] == $totalMsgOfCtb then
|
||||
goto check_ok_1
|
||||
endi
|
||||
endi
|
||||
|
@ -280,8 +280,8 @@ $topicList = $topicList . '
|
|||
$consumerId = 0
|
||||
$totalMsgOfOneTopic = $rowsPerCtb
|
||||
$totalMsgOfNtb = $totalMsgOfOneTopic * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfNtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
|
||||
$topicList = ' . topic_ntb_function
|
||||
|
@ -289,7 +289,7 @@ $topicList = $topicList . ,
|
|||
$topicList = $topicList . topic_ntb_all
|
||||
$topicList = $topicList . '
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ntb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -318,12 +318,12 @@ endi
|
|||
|
||||
# either $data[0][2] $totalMsgOfOneTopic and $data[1][2] == $totalMsgOfNtb
|
||||
# or $data[0][2] $totalMsgOfNtb and $data[1][2] == $totalMsgOfOneTopic
|
||||
if $data[0][2] == $totalMsgOfOneTopic then
|
||||
if $data[1][2] == $totalMsgOfNtb then
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 1 then
|
||||
goto check_ok_2
|
||||
endi
|
||||
elif $data[1][2] == $totalMsgOfOneTopic then
|
||||
if $data[0][2] == $totalMsgOfNtb then
|
||||
elif $data[0][2] == 1 then
|
||||
if $data[1][2] == $expectmsgcnt then
|
||||
goto check_ok_2
|
||||
endi
|
||||
endi
|
||||
|
@ -334,8 +334,8 @@ if $data[0][3] == $totalMsgOfOneTopic then
|
|||
if $data[1][3] == $totalMsgOfNtb then
|
||||
goto check_ok_3
|
||||
endi
|
||||
elif $data[1][3] == $totalMsgOfOneTopic then
|
||||
if $data[0][3] == $totalMsgOfNtb then
|
||||
elif $data[0][3] == $totalMsgOfNtb then
|
||||
if $data[1][3] == $totalMsgOfOneTopic then
|
||||
goto check_ok_3
|
||||
endi
|
||||
endi
|
||||
|
|
|
@ -111,8 +111,8 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfStb = $ctbNum * $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfStb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from stb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
|
||||
|
@ -130,10 +130,10 @@ endi
|
|||
if $data[0][1] != $consumerId then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $expectmsgcnt then
|
||||
#if $data[0][2] != $expectmsgcnt then
|
||||
# return -1
|
||||
#endi
|
||||
if $data[0][3] != $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
$loop_cnt = $loop_cnt + 1
|
||||
|
@ -182,8 +182,8 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfCtb = $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfCtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ctb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -201,7 +201,7 @@ endi
|
|||
if $data[0][1] != $consumerId then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][2] != $totalMsgOfCtb then
|
||||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $totalMsgOfCtb then
|
||||
|
@ -253,8 +253,8 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfNtb = $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfNtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ntb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -272,7 +272,7 @@ endi
|
|||
if $data[0][1] != $consumerId then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][2] != $totalMsgOfNtb then
|
||||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $totalMsgOfNtb then
|
||||
|
|
|
@ -110,10 +110,10 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfStb = $ctbNum * $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfStb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 3
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from stb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
|
||||
|
@ -163,19 +163,19 @@ endi
|
|||
if $data[0][3] <= 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] >= $expectmsgcnt then
|
||||
if $data[0][3] >= $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data[1][3] <= 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data[1][3] >= $expectmsgcnt then
|
||||
if $data[1][3] >= $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
|
||||
$sumOfMsgRows = $data[0][3] + $data[1][3]
|
||||
if $sumOfMsgRows != $expectmsgcnt then
|
||||
if $sumOfMsgRows != $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -225,10 +225,10 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfCtb = $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfCtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ctb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -255,13 +255,13 @@ if $data[0][1] == 1 then
|
|||
endi
|
||||
endi
|
||||
|
||||
# either $data[0][2] == $totalMsgOfCtb and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfCtb
|
||||
if $data[0][2] == $totalMsgOfCtb then
|
||||
# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 0 then
|
||||
goto check_ok_0
|
||||
endi
|
||||
elif $data[1][2] == $totalMsgOfCtb then
|
||||
elif $data[1][2] == $expectmsgcnt then
|
||||
if $data[0][2] == 0 then
|
||||
goto check_ok_0
|
||||
endi
|
||||
|
@ -327,10 +327,10 @@ endi
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfNtb = $rowsPerCtb
|
||||
$expectmsgcnt = $totalMsgOfNtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 1
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ntb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -357,13 +357,13 @@ if $data[1][1] == 0 then
|
|||
endi
|
||||
endi
|
||||
|
||||
# either $data[0][2] == $totalMsgOfNtb and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfNtb
|
||||
if $data[0][2] == $totalMsgOfNtb then
|
||||
# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 0 then
|
||||
goto check_ok_2
|
||||
endi
|
||||
elif $data[1][2] == $totalMsgOfNtb then
|
||||
elif $data[1][2] == $expectmsgcnt then
|
||||
if $data[0][2] == 0 then
|
||||
goto check_ok_2
|
||||
endi
|
||||
|
|
|
@ -80,8 +80,8 @@ $topicList = $topicList . '
|
|||
$consumerId = 0
|
||||
$totalMsgOfStb = $ctbNum * $rowsPerCtb
|
||||
$totalMsgOfStb = $totalMsgOfStb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfStb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 9
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from stb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
|
||||
|
@ -102,7 +102,7 @@ endi
|
|||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $expectmsgcnt then
|
||||
if $data[0][3] != $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -137,8 +137,8 @@ $topicList = $topicList . '
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfCtb = $rowsPerCtb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfCtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ctb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -156,7 +156,7 @@ endi
|
|||
if $data[0][1] != $consumerId then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][2] != $totalMsgOfCtb then
|
||||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $totalMsgOfCtb then
|
||||
|
@ -194,8 +194,8 @@ $topicList = $topicList . '
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfNtb = $rowsPerCtb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfNtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ntb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -213,7 +213,7 @@ endi
|
|||
if $data[0][1] != $consumerId then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][2] != $totalMsgOfNtb then
|
||||
if $data[0][2] != $expectmsgcnt then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] != $totalMsgOfNtb then
|
||||
|
|
|
@ -79,10 +79,10 @@ $topicList = $topicList . '
|
|||
$consumerId = 0
|
||||
$totalMsgOfStb = $ctbNum * $rowsPerCtb
|
||||
$totalMsgOfStb = $totalMsgOfStb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfStb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = 9
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from stb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
|
||||
|
@ -131,19 +131,19 @@ endi
|
|||
if $data[0][3] <= 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data[0][3] >= $expectmsgcnt then
|
||||
if $data[0][3] >= $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data[1][3] <= 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data[1][3] >= $expectmsgcnt then
|
||||
if $data[1][3] >= $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
|
||||
$sumOfConsRow = $data[0][3] + $data[1][3]
|
||||
if $sumOfConsRow != $expectmsgcnt then
|
||||
if $sumOfConsRow != $totalMsgOfStb then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -178,10 +178,10 @@ $topicList = $topicList . '
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfCtb = $rowsPerCtb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfCtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ctb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -208,14 +208,14 @@ if $data[0][1] == 1 then
|
|||
endi
|
||||
endi
|
||||
|
||||
# either $data[0][2] == $totalMsgOfCtb and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfCtb
|
||||
if $data[0][2] == $totalMsgOfCtb then
|
||||
# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 0 then
|
||||
goto check_ok_0
|
||||
endi
|
||||
elif $data[0][2] == 0 then
|
||||
if $data[1][2] == $totalMsgOfCtb then
|
||||
if $data[1][2] == $expectmsgcnt then
|
||||
goto check_ok_0
|
||||
endi
|
||||
endi
|
||||
|
@ -266,10 +266,10 @@ $topicList = $topicList . '
|
|||
|
||||
$consumerId = 0
|
||||
$totalMsgOfNtb = $rowsPerCtb * $topicNum
|
||||
$expectmsgcnt = $totalMsgOfNtb
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
$expectmsgcnt = $topicNum
|
||||
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
$consumerId = 1
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
|
||||
sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
|
||||
|
||||
print == start consumer to pull msgs from ntb
|
||||
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
|
||||
|
@ -296,14 +296,14 @@ if $data[1][1] == 0 then
|
|||
endi
|
||||
endi
|
||||
|
||||
# either $data[0][2] == $totalMsgOfNtb and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfNtb
|
||||
if $data[0][2] == $totalMsgOfNtb then
|
||||
# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
|
||||
# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
|
||||
if $data[0][2] == $expectmsgcnt then
|
||||
if $data[1][2] == 0 then
|
||||
goto check_ok_2
|
||||
endi
|
||||
elif $data[0][2] == 0 then
|
||||
if $data[1][2] == $totalMsgOfNtb then
|
||||
if $data[1][2] == $expectmsgcnt then
|
||||
goto check_ok_2
|
||||
endi
|
||||
endi
|
||||
|
|
|
@ -2040,6 +2040,8 @@ class TDTestCase:
|
|||
#tdSql.query(f"select _irowts,interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1h) fill(prev)")
|
||||
#tdSql.query(f"select tbname,_irowts,interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1h) fill(prev)")
|
||||
|
||||
tdLog.printNoPrefix("======step 14: test interp pseudo columns")
|
||||
tdSql.error(f"select _irowts, c6 from {dbname}.{tbname}")
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
|
|
|
@ -226,7 +226,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -307,7 +307,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
|
|
@ -228,7 +228,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -303,7 +303,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -315,7 +315,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != expectrowcnt/4:
|
||||
if totalConsumeRows < expectrowcnt/4:
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt/4))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
@ -333,7 +333,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != expectrowcnt:
|
||||
if totalConsumeRows < expectrowcnt:
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
@ -386,7 +386,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -398,7 +398,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != expectrowcnt/4:
|
||||
if totalConsumeRows < expectrowcnt/4:
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt/4))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
@ -416,7 +416,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != (expectrowcnt * (1 + 1/4)):
|
||||
if totalConsumeRows < (expectrowcnt * (1 + 1/4)):
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -320,7 +320,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
|
|
@ -233,7 +233,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume 0 processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 10
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -251,6 +251,7 @@ class TDTestCase:
|
|||
|
||||
tdLog.info("start consume 1 processor")
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
tdLog.sleep(2)
|
||||
|
||||
tdLog.info("start one new thread to insert data")
|
||||
parameterDict['actionType'] = actionType.INSERT_DATA
|
||||
|
@ -271,6 +272,7 @@ class TDTestCase:
|
|||
|
||||
tdLog.info("start consume 2 processor")
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
tdLog.sleep(2)
|
||||
|
||||
tdLog.info("start one new thread to insert data")
|
||||
parameterDict['actionType'] = actionType.INSERT_DATA
|
||||
|
@ -338,7 +340,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume 0 processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 20
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -380,6 +382,7 @@ class TDTestCase:
|
|||
|
||||
tdLog.info("start consume 2 processor")
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
tdLog.sleep(2)
|
||||
|
||||
tdLog.info("start one new thread to insert data")
|
||||
parameterDict['actionType'] = actionType.INSERT_DATA
|
||||
|
@ -394,7 +397,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != expectrowcnt*2:
|
||||
if totalConsumeRows < expectrowcnt*2:
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt*2))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
|
|
@ -215,7 +215,8 @@ class TDTestCase:
|
|||
parameterDict["stbName"],\
|
||||
parameterDict["ctbNum"],\
|
||||
parameterDict["rowsPerTbl"],\
|
||||
parameterDict["batchNum"])
|
||||
parameterDict["batchNum"],\
|
||||
parameterDict["startTs"])
|
||||
|
||||
tdLog.info("create topics from stb1")
|
||||
topicFromStb1 = 'topic_stb1'
|
||||
|
@ -233,7 +234,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume 0 processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -269,7 +270,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != expectrowcnt-10000:
|
||||
if totalConsumeRows < expectrowcnt-10000:
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt-10000))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
@ -328,7 +329,8 @@ class TDTestCase:
|
|||
parameterDict["stbName"],\
|
||||
parameterDict["ctbNum"],\
|
||||
parameterDict["rowsPerTbl"],\
|
||||
parameterDict["batchNum"])
|
||||
parameterDict["batchNum"],\
|
||||
parameterDict["startTs"])
|
||||
|
||||
tdLog.info("create topics from stb1")
|
||||
topicFromStb1 = 'topic_stb1'
|
||||
|
@ -346,7 +348,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -415,7 +417,8 @@ class TDTestCase:
|
|||
parameterDict["stbName"],\
|
||||
parameterDict["ctbNum"],\
|
||||
parameterDict["rowsPerTbl"],\
|
||||
parameterDict["batchNum"])
|
||||
parameterDict["batchNum"],\
|
||||
parameterDict["startTs"])
|
||||
|
||||
tdLog.info("create topics from stb1")
|
||||
topicFromStb1 = 'topic_stb1'
|
||||
|
@ -433,7 +436,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -445,7 +448,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != expectrowcnt/4:
|
||||
if totalConsumeRows < expectrowcnt/4:
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt/4))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
@ -467,7 +470,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != expectrowcnt/4:
|
||||
if totalConsumeRows < expectrowcnt/4:
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt/4))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
@ -502,7 +505,8 @@ class TDTestCase:
|
|||
parameterDict["stbName"],\
|
||||
parameterDict["ctbNum"],\
|
||||
parameterDict["rowsPerTbl"],\
|
||||
parameterDict["batchNum"])
|
||||
parameterDict["batchNum"],\
|
||||
parameterDict["startTs"])
|
||||
|
||||
tdLog.info("create topics from stb1")
|
||||
topicFromStb1 = 'topic_stb1'
|
||||
|
@ -520,7 +524,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -532,7 +536,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != expectrowcnt/4:
|
||||
if totalConsumeRows < expectrowcnt/4:
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt/4))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
@ -555,7 +559,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != expectrowcnt*(1/2+1/4):
|
||||
if totalConsumeRows < expectrowcnt*(1/2+1/4):
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt*(1/2+1/4)))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
@ -305,7 +305,7 @@ class TDTestCase:
|
|||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
pollDelay = 100
|
||||
pollDelay = 5
|
||||
showMsg = 1
|
||||
showRow = 1
|
||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||
|
|
|
@ -53,7 +53,7 @@ class TDTestCase:
|
|||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1,wal_retention_size=-1, wal_retention_period=-1)
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
|
@ -237,10 +237,10 @@ class TDTestCase:
|
|||
|
||||
if self.snapshot == 0:
|
||||
consumerId = 2
|
||||
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 + 1/4 + 3/4))
|
||||
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"])
|
||||
elif self.snapshot == 1:
|
||||
consumerId = 3
|
||||
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 - 1/4 + 1/4 + 3/4))
|
||||
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 + 1/4))
|
||||
|
||||
topicList = topicFromStb1
|
||||
ifcheckdata = 1
|
||||
|
@ -270,7 +270,7 @@ class TDTestCase:
|
|||
if totalConsumeRows != expectrowcnt:
|
||||
tdLog.exit("tmq consume rows error with snapshot = 0!")
|
||||
elif self.snapshot == 1:
|
||||
if totalConsumeRows != totalRowsFromQuery:
|
||||
if totalConsumeRows != expectrowcnt:
|
||||
tdLog.exit("tmq consume rows error with snapshot = 1!")
|
||||
|
||||
# tmqCom.checkFileContent(consumerId, queryString)
|
||||
|
@ -323,7 +323,7 @@ class TDTestCase:
|
|||
|
||||
if self.snapshot == 0:
|
||||
consumerId = 4
|
||||
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1/4 + 3/4))
|
||||
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"])
|
||||
elif self.snapshot == 1:
|
||||
consumerId = 5
|
||||
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 - 1/4 + 1/4 + 3/4))
|
||||
|
@ -369,11 +369,7 @@ class TDTestCase:
|
|||
tdLog.info("act consume rows: %d, act query rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsFromQuery, expectrowcnt))
|
||||
|
||||
if self.snapshot == 0:
|
||||
# If data writing is completed before consumer get snapshot, will consume 7500 from wal;
|
||||
# If data writing has not started before consumer get snapshot, will consume 10000 from wal;
|
||||
minRows = int(expectrowcnt * (1 - 1/4)) # 7500
|
||||
tdLog.info("consume rows should be between %d and %d, "%(minRows, expectrowcnt))
|
||||
if not ((totalConsumeRows >= minRows) and (totalConsumeRows <= expectrowcnt)):
|
||||
if (totalConsumeRows != expectrowcnt):
|
||||
tdLog.exit("tmq consume rows error with snapshot = 0!")
|
||||
elif self.snapshot == 1:
|
||||
tdLog.info("consume rows should be between %d and %d, "%(totalRowsFromQuery, expectrowcnt))
|
||||
|
@ -494,7 +490,7 @@ class TDTestCase:
|
|||
tdLog.printNoPrefix("======== test case 4 end ...... ")
|
||||
|
||||
def run(self):
|
||||
# tdSql.prepare()
|
||||
tdSql.prepare()
|
||||
tdLog.printNoPrefix("=============================================")
|
||||
tdLog.printNoPrefix("======== snapshot is 0: only consume from wal")
|
||||
self.snapshot = 0
|
||||
|
@ -520,11 +516,11 @@ class TDTestCase:
|
|||
self.prepareTestEnv()
|
||||
self.tmqCase3()
|
||||
|
||||
tdLog.printNoPrefix("=============================================")
|
||||
tdLog.printNoPrefix("======== snapshot is 0: only consume from wal")
|
||||
self.snapshot = 0
|
||||
self.prepareTestEnv()
|
||||
self.tmqCase4()
|
||||
# tdLog.printNoPrefix("=============================================")
|
||||
# tdLog.printNoPrefix("======== snapshot is 0: only consume from wal")
|
||||
# self.snapshot = 0
|
||||
# self.prepareTestEnv()
|
||||
# self.tmqCase4()
|
||||
tdLog.printNoPrefix("====================================================================")
|
||||
tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal")
|
||||
self.snapshot = 1
|
||||
|
|
|
@ -26,10 +26,6 @@ ELSE ()
|
|||
SET(LINK_WEBSOCKET "")
|
||||
ENDIF ()
|
||||
|
||||
IF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL)
|
||||
ADD_DEFINITIONS(-I${CMAKE_CURRENT_SOURCE_DIR}/../../../enterprise/packaging)
|
||||
ENDIF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL)
|
||||
|
||||
IF (TD_LINUX AND TD_ALPINE)
|
||||
SET(LINK_ARGP "/usr/lib/libargp.a")
|
||||
ELSE ()
|
||||
|
|
|
@ -59,8 +59,8 @@ char cusEmail[] = "<support@taosdata.com>";
|
|||
#define SHELL_VERSION "Print program version."
|
||||
|
||||
#ifdef WEBSOCKET
|
||||
#define SHELL_DSN "The dsn to use when connecting to cloud server."
|
||||
#define SHELL_REST "Use restful mode when connecting."
|
||||
#define SHELL_DSN "Use dsn to connect to the cloud server or to a remote server which provides WebSocket connection."
|
||||
#define SHELL_REST "Use RESTful mode when connecting."
|
||||
#define SHELL_TIMEOUT "Set the timeout for websocket query in seconds, default is 30."
|
||||
#endif
|
||||
|
||||
|
@ -93,7 +93,11 @@ void shellPrintHelp() {
|
|||
#endif
|
||||
printf("%s%s%s%s\r\n", indent, "-w,", indent, SHELL_WIDTH);
|
||||
printf("%s%s%s%s\r\n", indent, "-V,", indent, SHELL_VERSION);
|
||||
printf("\r\n\r\nReport bugs to %s.\r\n", cusEmail);
|
||||
#ifdef CUS_EMAIL
|
||||
printf("\r\n\r\nReport bugs to %s.\r\n", CUS_EMAIL);
|
||||
#else
|
||||
printf("\r\n\r\nReport bugs to %s.\r\n", "support@taosdata.com");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LINUX
|
||||
|
@ -105,7 +109,11 @@ void shellPrintHelp() {
|
|||
#endif
|
||||
|
||||
const char *argp_program_version = version;
|
||||
const char *argp_program_bug_address = cusEmail;
|
||||
#ifdef CUS_EMAIL
|
||||
const char *argp_program_bug_address = CUS_EMAIL;
|
||||
#else
|
||||
const char *argp_program_bug_address = "support@taosdata.com";
|
||||
#endif
|
||||
|
||||
static struct argp_option shellOptions[] = {
|
||||
{"host", 'h', "HOST", 0, SHELL_HOST},
|
||||
|
@ -411,10 +419,19 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) {
|
|||
shell.info.clientVersion =
|
||||
"Welcome to the %s Command Line Interface, Client Version:%s\r\n"
|
||||
"Copyright (c) 2022 by %s, all rights reserved.\r\n\r\n";
|
||||
strcpy(shell.info.cusName, cusName);
|
||||
sprintf(shell.info.promptHeader, "%s> ", cusPrompt);
|
||||
#ifdef CUS_NAME
|
||||
strcpy(shell.info.cusName, CUS_NAME);
|
||||
#else
|
||||
strcpy(shell.info.cusName, "TDengine");
|
||||
#endif
|
||||
char promptContinueFormat[32] = {0};
|
||||
sprintf(promptContinueFormat, "%%%zus> ", strlen(cusPrompt));
|
||||
#ifdef CUS_PROMPT
|
||||
sprintf(shell.info.promptHeader, "%s> ", CUS_PROMPT);
|
||||
sprintf(promptContinueFormat, "%%%zus> ", strlen(CUS_PROMPT));
|
||||
#else
|
||||
sprintf(shell.info.promptHeader, "taos> ");
|
||||
sprintf(promptContinueFormat, "%%%zus> ", strlen("taos"));
|
||||
#endif
|
||||
sprintf(shell.info.promptContinue, promptContinueFormat, " ");
|
||||
shell.info.promptSize = strlen(shell.info.promptHeader);
|
||||
#ifdef TD_ENTERPRISE
|
||||
|
|
|
@ -773,26 +773,26 @@ int sml_dup_time_Test() {
|
|||
taos_free_result(pRes);
|
||||
|
||||
const char *sql[] = {//"test_ms,t0=t c0=f 1626006833641",
|
||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
||||
"c0=f,c1=1i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
||||
"123456789f64,c7=\"xcxvwjvf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000",
|
||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
||||
"c0=T,c1=2i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
||||
"123456789f64,c7=\"fixrzcuq\",c8=L\"ncharColValue\",c9=7u64 1626006834639000000",
|
||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
||||
"c0=t,c1=3i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
||||
"123456789f64,c7=\"iupzdqub\",c8=L\"ncharColValue\",c9=7u64 1626006835639000000",
|
||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
||||
"c0=t,c1=4i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
||||
"123456789f64,c7=\"yvvtzzof\",c8=L\"ncharColValue\",c9=7u64 1626006836639000000",
|
||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
||||
"c0=t,c1=5i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
||||
"123456789f64,c7=\"vbxpilkj\",c8=L\"ncharColValue\",c9=7u64 1626006837639000000"};
|
||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
||||
"c0=f,c1=1i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
||||
"123456789f64,c7=\"xcxvwjvf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000",
|
||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
||||
"c0=T,c1=2i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
||||
"123456789f64,c7=\"fixrzcuq\",c8=L\"ncharColValue\",c9=7u64 1626006834639000000",
|
||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
||||
"c0=t,c1=3i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
||||
"123456789f64,c7=\"iupzdqub\",c8=L\"ncharColValue\",c9=7u64 1626006835639000000",
|
||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
||||
"c0=t,c1=4i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
||||
"123456789f64,c7=\"yvvtzzof\",c8=L\"ncharColValue\",c9=7u64 1626006836639000000",
|
||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
||||
"c0=t,c1=5i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
||||
"123456789f64,c7=\"vbxpilkj\",c8=L\"ncharColValue\",c9=7u64 1626006837639000000"};
|
||||
pRes = taos_query(taos, "use sml_db");
|
||||
taos_free_result(pRes);
|
||||
|
||||
|
@ -942,6 +942,8 @@ int sml_ts2164_Test() {
|
|||
"ts3038,location=l2a,groupid=ca current=L\"11.8\"",
|
||||
"ts3038,location=l2a,groupid=ca voltage=L\"221\"",
|
||||
"ts3038,location=l2a,groupid=ca phase=L\"221\"",
|
||||
// "qgyltizmkq,id=sub_table_0123456,t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64",
|
||||
// "qgyltizmkq,id=sub_table_0123456,t=3,t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64"
|
||||
// "meters,location=la,groupid=cb current=11.8,voltage=221,phase=0.27",
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue