Merge pull request #11955 from taosdata/fix/ZhiqiangWang/fix-14989-fix-new-compilation-errors
fix(os): fix new compilation errors.
This commit is contained in:
commit
cf8154551e
|
@ -219,8 +219,8 @@ endif(${BUILD_WITH_NURAFT})
|
|||
# pthread
|
||||
if(${BUILD_PTHREAD})
|
||||
set(CMAKE_BUILD_TYPE release)
|
||||
add_definitions(-DPTW32_STATIC_LIB)
|
||||
add_subdirectory(pthread EXCLUDE_FROM_ALL)
|
||||
add_definitions(-DPTW32_STATIC_LIB)
|
||||
add_subdirectory(pthread)
|
||||
set_target_properties(libpthreadVC3 PROPERTIES OUTPUT_NAME pthread)
|
||||
add_library(pthread STATIC IMPORTED GLOBAL)
|
||||
SET_PROPERTY(TARGET pthread PROPERTY IMPORTED_LOCATION ${LIBRARY_OUTPUT_PATH}/pthread.lib)
|
||||
|
|
|
@ -121,13 +121,14 @@ typedef struct setConfRet {
|
|||
DLL_EXPORT void taos_cleanup(void);
|
||||
DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...);
|
||||
DLL_EXPORT setConfRet taos_set_config(const char *config);
|
||||
DLL_EXPORT int taos_init(void);
|
||||
DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port);
|
||||
DLL_EXPORT TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, const char *pass, int passLen,
|
||||
DLL_EXPORT TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, const char *pass, int passLen,
|
||||
const char *db, int dbLen, uint16_t port);
|
||||
DLL_EXPORT TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port);
|
||||
DLL_EXPORT void taos_close(TAOS *taos);
|
||||
DLL_EXPORT TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port);
|
||||
DLL_EXPORT void taos_close(TAOS *taos);
|
||||
|
||||
const char *taos_data_type(int type);
|
||||
const char *taos_data_type(int type);
|
||||
|
||||
DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos);
|
||||
DLL_EXPORT int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length);
|
||||
|
|
|
@ -1538,6 +1538,10 @@ int tDecodeSVCreateStbReq(SCoder* pCoder, SVCreateStbReq* pReq);
|
|||
|
||||
typedef struct SVDropStbReq {
|
||||
// data
|
||||
#ifdef WINDOWS
|
||||
size_t avoidCompilationErrors;
|
||||
#endif
|
||||
|
||||
} SVDropStbReq;
|
||||
|
||||
typedef struct SVCreateStbRsp {
|
||||
|
@ -2117,7 +2121,7 @@ static FORCE_INLINE int32_t tDecodeSSchemaWrapper(SCoder* pDecoder, SSchemaWrapp
|
|||
if (tDecodeI32v(pDecoder, &pSW->nCols) < 0) return -1;
|
||||
if (tDecodeI32v(pDecoder, &pSW->sver) < 0) return -1;
|
||||
|
||||
pSW->pSchema = (SSchema*)TCODER_MALLOC(pDecoder, sizeof(SSchema) * pSW->nCols);
|
||||
pSW->pSchema = (SSchema*)tCoderMalloc(pDecoder, sizeof(SSchema) * pSW->nCols);
|
||||
if (pSW->pSchema == NULL) return -1;
|
||||
for (int32_t i = 0; i < pSW->nCols; i++) {
|
||||
if (tDecodeSSchema(pDecoder, &pSW->pSchema[i]) < 0) return -1;
|
||||
|
|
|
@ -59,6 +59,7 @@ extern "C" {
|
|||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#define __typeof(a) auto
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,27 +23,21 @@ extern "C" {
|
|||
#define TPOW2(x) ((x) * (x))
|
||||
#define TABS(x) ((x) > 0 ? (x) : -(x))
|
||||
|
||||
#define TSWAP(a, b) \
|
||||
do { \
|
||||
__typeof(a) __tmp = (a); \
|
||||
(a) = (b); \
|
||||
(b) = __tmp; \
|
||||
} while (0)
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
||||
#define TSWAP(a, b, c) \
|
||||
do { \
|
||||
c __tmp = (c)(a); \
|
||||
(a) = (c)(b); \
|
||||
(b) = __tmp; \
|
||||
} while (0)
|
||||
#define TMAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define TMIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define TRANGE(aa, bb, cc) ((aa) = TMAX((aa), (bb)),(aa) = TMIN((aa), (cc)))
|
||||
|
||||
#else
|
||||
|
||||
#define TSWAP(a, b, c) \
|
||||
do { \
|
||||
__typeof(a) __tmp = (a); \
|
||||
(a) = (b); \
|
||||
(b) = __tmp; \
|
||||
} while (0)
|
||||
|
||||
#define TMAX(a, b) \
|
||||
({ \
|
||||
__typeof(a) __a = (a); \
|
||||
|
@ -51,12 +45,12 @@ extern "C" {
|
|||
(__a > __b) ? __a : __b; \
|
||||
})
|
||||
|
||||
#define TMIN(a, b) \
|
||||
({ \
|
||||
__typeof(a) __a = (a); \
|
||||
__typeof(b) __b = (b); \
|
||||
(__a < __b) ? __a : __b; \
|
||||
})
|
||||
#define TMIN(a, b) \
|
||||
({ \
|
||||
__typeof(a) __a = (a); \
|
||||
__typeof(b) __b = (b); \
|
||||
(__a < __b) ? __a : __b; \
|
||||
})
|
||||
|
||||
#define TRANGE(a, b, c) \
|
||||
({ \
|
||||
|
|
|
@ -79,31 +79,52 @@ typedef struct {
|
|||
#define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos)
|
||||
#define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE))
|
||||
#define TD_CODER_CHECK_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE))
|
||||
#define TCODER_MALLOC(PCODER, SIZE) \
|
||||
({ \
|
||||
void* ptr = NULL; \
|
||||
SCoderMem* pMem = (SCoderMem*)taosMemoryMalloc(sizeof(*pMem) + (SIZE)); \
|
||||
if (pMem) { \
|
||||
pMem->next = (PCODER)->mList; \
|
||||
(PCODER)->mList = pMem; \
|
||||
ptr = (void*)&pMem[1]; \
|
||||
} \
|
||||
ptr; \
|
||||
})
|
||||
// #define TCODER_MALLOC(PCODER, SIZE) \
|
||||
// ({ \
|
||||
// void* ptr = NULL; \
|
||||
// SCoderMem* pMem = (SCoderMem*)taosMemoryMalloc(sizeof(*pMem) + (SIZE)); \
|
||||
// if (pMem) { \
|
||||
// pMem->next = (PCODER)->mList; \
|
||||
// (PCODER)->mList = pMem; \
|
||||
// ptr = (void*)&pMem[1]; \
|
||||
// } \
|
||||
// ptr; \
|
||||
// })
|
||||
static FORCE_INLINE void* tCoderMalloc(SCoder* pCoder, int32_t size) {
|
||||
void* ptr = NULL;
|
||||
SCoderMem* pMem = (SCoderMem*)taosMemoryMalloc(sizeof(SCoderMem*) + size);
|
||||
if (pMem) {
|
||||
pMem->next = pCoder->mList;
|
||||
pCoder->mList = pMem;
|
||||
ptr = (void*)&pMem[1];
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#define tEncodeSize(E, S, SIZE) \
|
||||
({ \
|
||||
#define tEncodeSize(E, S, SIZE, RET) \
|
||||
do{ \
|
||||
SCoder coder = {0}; \
|
||||
int ret = 0; \
|
||||
tCoderInit(&coder, TD_LITTLE_ENDIAN, NULL, 0, TD_ENCODER); \
|
||||
if ((E)(&coder, S) == 0) { \
|
||||
SIZE = coder.pos; \
|
||||
} else { \
|
||||
ret = -1; \
|
||||
RET = -1; \
|
||||
} \
|
||||
tCoderClear(&coder); \
|
||||
ret; \
|
||||
})
|
||||
}while(0)
|
||||
// #define tEncodeSize(E, S, SIZE) \
|
||||
// ({ \
|
||||
// SCoder coder = {0}; \
|
||||
// int ret = 0; \
|
||||
// tCoderInit(&coder, TD_LITTLE_ENDIAN, NULL, 0, TD_ENCODER); \
|
||||
// if ((E)(&coder, S) == 0) { \
|
||||
// SIZE = coder.pos; \
|
||||
// } else { \
|
||||
// ret = -1; \
|
||||
// } \
|
||||
// tCoderClear(&coder); \
|
||||
// ret; \
|
||||
// })
|
||||
|
||||
void tCoderInit(SCoder* pCoder, td_endian_t endian, uint8_t* data, int32_t size, td_coder_t type);
|
||||
void tCoderClear(SCoder* pCoder);
|
||||
|
|
|
@ -254,8 +254,6 @@ extern int (*handleRequestRspFp[TDMT_MAX])(void*, const SDataBuf* pMsg, int32_t
|
|||
int genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code);
|
||||
SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pReqObj);
|
||||
|
||||
int taos_init();
|
||||
|
||||
void* createTscObj(const char* user, const char* auth, const char* db, SAppInstInfo* pAppInfo);
|
||||
void destroyTscObj(void* pObj);
|
||||
STscObj* acquireTscObj(int64_t rid);
|
||||
|
|
|
@ -188,8 +188,8 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
|
|||
setResPrecision(&pRequest->body.resInfo, (*pQuery)->precision);
|
||||
}
|
||||
|
||||
TSWAP(pRequest->dbList, (*pQuery)->pDbList, SArray*);
|
||||
TSWAP(pRequest->tableList, (*pQuery)->pTableList, SArray*);
|
||||
TSWAP(pRequest->dbList, (*pQuery)->pDbList);
|
||||
TSWAP(pRequest->tableList, (*pQuery)->pTableList);
|
||||
}
|
||||
|
||||
return code;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
taos_cleanup
|
||||
taos_options
|
||||
taos_set_config
|
||||
taos_init
|
||||
taos_connect
|
||||
taos_connect_l
|
||||
taos_connect_auth
|
||||
|
|
|
@ -3231,7 +3231,7 @@ int32_t tEncodeSMqCMCommitOffsetReq(SCoder *encoder, const SMqCMCommitOffsetReq
|
|||
int32_t tDecodeSMqCMCommitOffsetReq(SCoder *decoder, SMqCMCommitOffsetReq *pReq) {
|
||||
if (tStartDecode(decoder) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pReq->num) < 0) return -1;
|
||||
pReq->offsets = (SMqOffset *)TCODER_MALLOC(decoder, sizeof(SMqOffset) * pReq->num);
|
||||
pReq->offsets = (SMqOffset *)tCoderMalloc(decoder, sizeof(SMqOffset) * pReq->num);
|
||||
if (pReq->offsets == NULL) return -1;
|
||||
for (int32_t i = 0; i < pReq->num; i++) {
|
||||
tDecodeSMqOffset(decoder, &pReq->offsets[i]);
|
||||
|
@ -3514,7 +3514,7 @@ int tDecodeSVCreateTbBatchRsp(SCoder *pCoder, SVCreateTbBatchRsp *pRsp) {
|
|||
if (tStartDecode(pCoder) < 0) return -1;
|
||||
|
||||
if (tDecodeI32v(pCoder, &pRsp->nRsps) < 0) return -1;
|
||||
pRsp->pRsps = (SVCreateTbRsp *)TCODER_MALLOC(pCoder, sizeof(*pRsp->pRsps) * pRsp->nRsps);
|
||||
pRsp->pRsps = (SVCreateTbRsp *)tCoderMalloc(pCoder, sizeof(*pRsp->pRsps) * pRsp->nRsps);
|
||||
for (int32_t i = 0; i < pRsp->nRsps; i++) {
|
||||
if (tDecodeSVCreateTbRsp(pCoder, pRsp->pRsps + i) < 0) return -1;
|
||||
}
|
||||
|
@ -3743,7 +3743,7 @@ int tDecodeSVCreateTbBatchReq(SCoder *pCoder, SVCreateTbBatchReq *pReq) {
|
|||
if (tStartDecode(pCoder) < 0) return -1;
|
||||
|
||||
if (tDecodeI32v(pCoder, &pReq->nReqs) < 0) return -1;
|
||||
pReq->pReqs = (SVCreateTbReq *)TCODER_MALLOC(pCoder, sizeof(SVCreateTbReq) * pReq->nReqs);
|
||||
pReq->pReqs = (SVCreateTbReq *)tCoderMalloc(pCoder, sizeof(SVCreateTbReq) * pReq->nReqs);
|
||||
if (pReq->pReqs == NULL) return -1;
|
||||
for (int iReq = 0; iReq < pReq->nReqs; iReq++) {
|
||||
if (tDecodeSVCreateTbReq(pCoder, pReq->pReqs + iReq) < 0) return -1;
|
||||
|
|
|
@ -651,35 +651,35 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void *buf
|
|||
switch (type) {
|
||||
case TSDB_DATA_TYPE_INT:
|
||||
case TSDB_DATA_TYPE_UINT: {
|
||||
TSWAP(*(int32_t *)(pLeft), *(int32_t *)(pRight), int32_t);
|
||||
TSWAP(*(int32_t *)(pLeft), *(int32_t *)(pRight));
|
||||
break;
|
||||
}
|
||||
|
||||
case TSDB_DATA_TYPE_BIGINT:
|
||||
case TSDB_DATA_TYPE_UBIGINT:
|
||||
case TSDB_DATA_TYPE_TIMESTAMP: {
|
||||
TSWAP(*(int64_t *)(pLeft), *(int64_t *)(pRight), int64_t);
|
||||
TSWAP(*(int64_t *)(pLeft), *(int64_t *)(pRight));
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_DOUBLE: {
|
||||
TSWAP(*(double *)(pLeft), *(double *)(pRight), double);
|
||||
TSWAP(*(double *)(pLeft), *(double *)(pRight));
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_SMALLINT:
|
||||
case TSDB_DATA_TYPE_USMALLINT: {
|
||||
TSWAP(*(int16_t *)(pLeft), *(int16_t *)(pRight), int16_t);
|
||||
TSWAP(*(int16_t *)(pLeft), *(int16_t *)(pRight));
|
||||
break;
|
||||
}
|
||||
|
||||
case TSDB_DATA_TYPE_FLOAT: {
|
||||
TSWAP(*(float *)(pLeft), *(float *)(pRight), float);
|
||||
TSWAP(*(float *)(pLeft), *(float *)(pRight));
|
||||
break;
|
||||
}
|
||||
|
||||
case TSDB_DATA_TYPE_BOOL:
|
||||
case TSDB_DATA_TYPE_TINYINT:
|
||||
case TSDB_DATA_TYPE_UTINYINT: {
|
||||
TSWAP(*(int8_t *)(pLeft), *(int8_t *)(pRight), int8_t);
|
||||
TSWAP(*(int8_t *)(pLeft), *(int8_t *)(pRight));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -395,7 +395,9 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
|
|||
}
|
||||
}
|
||||
// get length
|
||||
if (tEncodeSize(tEncodeSVCreateStbReq, &req, contLen) < 0) {
|
||||
int32_t ret = 0;
|
||||
tEncodeSize(tEncodeSVCreateStbReq, &req, contLen, ret);
|
||||
if (ret < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -230,8 +230,8 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) {
|
|||
memcpy(pOld->pass, pNew->pass, TSDB_PASSWORD_LEN);
|
||||
pOld->updateTime = pNew->updateTime;
|
||||
|
||||
TSWAP(pOld->readDbs, pNew->readDbs, (void *));
|
||||
TSWAP(pOld->writeDbs, pNew->writeDbs, (void *));
|
||||
TSWAP(pOld->readDbs, pNew->readDbs);
|
||||
TSWAP(pOld->writeDbs, pNew->writeDbs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -77,21 +77,25 @@ typedef struct {
|
|||
tb_uid_t uid;
|
||||
} STbDbKey;
|
||||
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
#pragma pack(push, 1)
|
||||
typedef struct {
|
||||
tb_uid_t uid;
|
||||
int32_t sver;
|
||||
} SSkmDbKey;
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct {
|
||||
tb_uid_t suid;
|
||||
tb_uid_t uid;
|
||||
} SCtbIdxKey;
|
||||
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
#pragma pack(push, 1)
|
||||
typedef struct {
|
||||
tb_uid_t suid;
|
||||
int16_t cid;
|
||||
char data[];
|
||||
} STagIdxKey;
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct {
|
||||
int64_t dtime;
|
||||
|
|
|
@ -158,7 +158,9 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) {
|
|||
pKey = &tbDbKey;
|
||||
kLen = sizeof(tbDbKey);
|
||||
|
||||
if (tEncodeSize(metaEncodeEntry, pME, vLen) < 0) {
|
||||
int32_t ret = 0;
|
||||
tEncodeSize(metaEncodeEntry, pME, vLen, ret);
|
||||
if (ret < 0) {
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
@ -250,7 +252,9 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
|
|||
skmDbKey.sver = pSW->sver;
|
||||
|
||||
// encode schema
|
||||
if (tEncodeSize(tEncodeSSchemaWrapper, pSW, vLen) < 0) return -1;
|
||||
int32_t ret = 0;
|
||||
tEncodeSize(tEncodeSSchemaWrapper, pSW, vLen, ret);
|
||||
if (ret < 0) return -1;
|
||||
pVal = taosMemoryMalloc(vLen);
|
||||
if (pVal == NULL) {
|
||||
rcode = -1;
|
||||
|
|
|
@ -454,7 +454,7 @@ void tsdbResetReadHandle(tsdbReaderT queryHandle, SQueryTableDataCond* pCond) {
|
|||
if (emptyQueryTimewindow(pTsdbReadHandle)) {
|
||||
if (pCond->order != pTsdbReadHandle->order) {
|
||||
pTsdbReadHandle->order = pCond->order;
|
||||
TSWAP(pTsdbReadHandle->window.skey, pTsdbReadHandle->window.ekey, int64_t);
|
||||
TSWAP(pTsdbReadHandle->window.skey, pTsdbReadHandle->window.ekey);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -924,7 +924,7 @@ static bool hasMoreDataInCache(STsdbReadHandle* pHandle) {
|
|||
pHandle->cur.mixBlock = true;
|
||||
|
||||
if (!ASCENDING_TRAVERSE(pHandle->order)) {
|
||||
TSWAP(win->skey, win->ekey, TSKEY);
|
||||
TSWAP(win->skey, win->ekey);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1203,7 +1203,7 @@ static int32_t handleDataMergeIfNeeded(STsdbReadHandle* pTsdbReadHandle, SBlock*
|
|||
// update the last key value
|
||||
pCheckInfo->lastKey = cur->win.ekey + step;
|
||||
if (!ASCENDING_TRAVERSE(pTsdbReadHandle->order)) {
|
||||
TSWAP(cur->win.skey, cur->win.ekey, TSKEY);
|
||||
TSWAP(cur->win.skey, cur->win.ekey);
|
||||
}
|
||||
|
||||
cur->mixBlock = true;
|
||||
|
@ -1701,7 +1701,7 @@ static void copyAllRemainRowsFromFileBlock(STsdbReadHandle* pTsdbReadHandle, STa
|
|||
int32_t end = endPos;
|
||||
|
||||
if (!ASCENDING_TRAVERSE(pTsdbReadHandle->order)) {
|
||||
TSWAP(start, end, int32_t);
|
||||
TSWAP(start, end);
|
||||
}
|
||||
|
||||
assert(pTsdbReadHandle->outputCapacity >= (end - start + 1));
|
||||
|
@ -1932,7 +1932,7 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
|
|||
((pos < endPos || cur->lastKey < pTsdbReadHandle->window.ekey) && !ASCENDING_TRAVERSE(pTsdbReadHandle->order)));
|
||||
|
||||
if (!ASCENDING_TRAVERSE(pTsdbReadHandle->order)) {
|
||||
TSWAP(cur->win.skey, cur->win.ekey, TSKEY);
|
||||
TSWAP(cur->win.skey, cur->win.ekey);
|
||||
}
|
||||
|
||||
moveDataToFront(pTsdbReadHandle, numOfRows, numOfCols);
|
||||
|
|
|
@ -369,7 +369,8 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
|
|||
tCoderClear(&coder);
|
||||
|
||||
// prepare rsp
|
||||
tEncodeSize(tEncodeSVCreateTbBatchRsp, &rsp, pRsp->contLen);
|
||||
int32_t ret = 0;
|
||||
tEncodeSize(tEncodeSVCreateTbBatchRsp, &rsp, pRsp->contLen, ret);
|
||||
pRsp->pCont = rpcMallocCont(pRsp->contLen);
|
||||
if (pRsp->pCont == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
|
|
@ -2100,7 +2100,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
|
|||
//
|
||||
// pQueryAttr->order.order = TSDB_ORDER_ASC;
|
||||
// if (pQueryAttr->window.skey > pQueryAttr->window.ekey) {
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY);
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
|
||||
// }
|
||||
//
|
||||
// pQueryAttr->needReverseScan = false;
|
||||
|
@ -2110,7 +2110,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
|
|||
// if (pQueryAttr->groupbyColumn && pQueryAttr->order.order == TSDB_ORDER_DESC) {
|
||||
// pQueryAttr->order.order = TSDB_ORDER_ASC;
|
||||
// if (pQueryAttr->window.skey > pQueryAttr->window.ekey) {
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY);
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
|
||||
// }
|
||||
//
|
||||
// pQueryAttr->needReverseScan = false;
|
||||
|
@ -2135,7 +2135,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
|
|||
// //qDebug(msg, pQInfo->qId, "only-first", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey,
|
||||
//// pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
|
||||
//
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY);
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
|
||||
// doUpdateLastKey(pQueryAttr);
|
||||
// }
|
||||
//
|
||||
|
@ -2146,7 +2146,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
|
|||
// //qDebug(msg, pQInfo->qId, "only-last", pQueryAttr->order.order, TSDB_ORDER_DESC, pQueryAttr->window.skey,
|
||||
//// pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
|
||||
//
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY);
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
|
||||
// doUpdateLastKey(pQueryAttr);
|
||||
// }
|
||||
//
|
||||
|
@ -2162,7 +2162,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
|
|||
//// pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey,
|
||||
/// pQueryAttr->window.skey);
|
||||
//
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY);
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
|
||||
// doUpdateLastKey(pQueryAttr);
|
||||
// }
|
||||
//
|
||||
|
@ -2174,7 +2174,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
|
|||
//// pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey,
|
||||
/// pQueryAttr->window.skey);
|
||||
//
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY);
|
||||
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
|
||||
// doUpdateLastKey(pQueryAttr);
|
||||
// }
|
||||
//
|
||||
|
@ -2673,7 +2673,7 @@ static void updateTableQueryInfoForReverseScan(STableQueryInfo* pTableQueryInfo)
|
|||
return;
|
||||
}
|
||||
|
||||
// TSWAP(pTableQueryInfo->win.skey, pTableQueryInfo->win.ekey, TSKEY);
|
||||
// TSWAP(pTableQueryInfo->win.skey, pTableQueryInfo->win.ekey);
|
||||
// pTableQueryInfo->lastKey = pTableQueryInfo->win.skey;
|
||||
|
||||
// SWITCH_ORDER(pTableQueryInfo->cur.order);
|
||||
|
@ -6652,7 +6652,7 @@ static int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableS
|
|||
//todo work around a problem, remove it later
|
||||
if ((pCond->order == TSDB_ORDER_ASC && pCond->twindow.skey > pCond->twindow.ekey) ||
|
||||
(pCond->order == TSDB_ORDER_DESC && pCond->twindow.skey < pCond->twindow.ekey)) {
|
||||
TSWAP(pCond->twindow.skey, pCond->twindow.ekey, int64_t);
|
||||
TSWAP(pCond->twindow.skey, pCond->twindow.ekey);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ static void prepareForDescendingScan(STableScanInfo* pTableScanInfo, SqlFunction
|
|||
// setupQueryRangeForReverseScan(pTableScanInfo);
|
||||
|
||||
STimeWindow* pTWindow = &pTableScanInfo->cond.twindow;
|
||||
TSWAP(pTWindow->skey, pTWindow->ekey, int64_t);
|
||||
TSWAP(pTWindow->skey, pTWindow->ekey);
|
||||
pTableScanInfo->cond.order = TSDB_ORDER_DESC;
|
||||
}
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ static int32_t buildOutput(SInsertParseContext* pCxt) {
|
|||
taosHashGetDup(pCxt->pVgroupsHashObj, (const char*)&src->vgId, sizeof(src->vgId), &dst->vg);
|
||||
dst->numOfTables = src->numOfTables;
|
||||
dst->size = src->size;
|
||||
TSWAP(dst->pData, src->pData, char*);
|
||||
TSWAP(dst->pData, src->pData);
|
||||
buildMsgHeader(src, dst);
|
||||
taosArrayPush(pCxt->pOutput->pDataBlocks, &dst);
|
||||
}
|
||||
|
|
|
@ -159,9 +159,10 @@ static int32_t createDataBlock(size_t defaultSize, int32_t rowSize, int32_t star
|
|||
int32_t buildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq) {
|
||||
SCoder coder = {0};
|
||||
char* pBuf;
|
||||
int32_t len;
|
||||
int32_t len;
|
||||
|
||||
tEncodeSize(tEncodeSVCreateTbReq, pCreateTbReq, len);
|
||||
int32_t ret = 0;
|
||||
tEncodeSize(tEncodeSVCreateTbReq, pCreateTbReq, len, ret);
|
||||
if (pBlocks->nAllocSize - pBlocks->size < len) {
|
||||
pBlocks->nAllocSize += len + pBlocks->rowSize;
|
||||
char* pTmp = taosMemoryRealloc(pBlocks->pData, pBlocks->nAllocSize);
|
||||
|
|
|
@ -2049,10 +2049,10 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch
|
|||
}
|
||||
strcpy(pTable->table.dbName, pInfo->pDbName);
|
||||
strcpy(pTable->table.tableName, pInfo->pTableName);
|
||||
TSWAP(pTable->pMeta, pInfo->pRollupTableMeta, STableMeta*);
|
||||
TSWAP(pTable->pMeta, pInfo->pRollupTableMeta);
|
||||
pSelect->pFromTable = (SNode*)pTable;
|
||||
|
||||
TSWAP(pSelect->pProjectionList, pInfo->pFuncs, SNodeList*);
|
||||
TSWAP(pSelect->pProjectionList, pInfo->pFuncs);
|
||||
SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION);
|
||||
if (NULL == pSelect->pProjectionList || NULL == pFunc) {
|
||||
nodesDestroyNode(pSelect);
|
||||
|
@ -2069,9 +2069,9 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
pSelect->pWindow = (SNode*)pInterval;
|
||||
TSWAP(pInterval->pInterval, pInfo->pInterval, SNode*);
|
||||
TSWAP(pInterval->pOffset, pInfo->pOffset, SNode*);
|
||||
TSWAP(pInterval->pSliding, pInfo->pSliding, SNode*);
|
||||
TSWAP(pInterval->pInterval, pInfo->pInterval);
|
||||
TSWAP(pInterval->pOffset, pInfo->pOffset);
|
||||
TSWAP(pInterval->pSliding, pInfo->pSliding);
|
||||
pInterval->pCol = nodesMakeNode(QUERY_NODE_COLUMN);
|
||||
if (NULL == pInterval->pCol) {
|
||||
nodesDestroyNode(pSelect);
|
||||
|
@ -3282,7 +3282,8 @@ static int32_t serializeVgroupTablesBatch(SVgroupTablesBatch* pTbBatch, SArray*
|
|||
int tlen;
|
||||
SCoder coder = {0};
|
||||
|
||||
tEncodeSize(tEncodeSVCreateTbBatchReq, &pTbBatch->req, tlen);
|
||||
int32_t ret = 0;
|
||||
tEncodeSize(tEncodeSVCreateTbBatchReq, &pTbBatch->req, tlen, ret);
|
||||
tlen += sizeof(SMsgHead); //+ tSerializeSVCreateTbBatchReq(NULL, &(pTbBatch->req));
|
||||
void* buf = taosMemoryMalloc(tlen);
|
||||
if (NULL == buf) {
|
||||
|
@ -3696,7 +3697,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
default:
|
||||
pQuery->execMode = QUERY_EXEC_MODE_RPC;
|
||||
if (NULL != pCxt->pCmdMsg) {
|
||||
TSWAP(pQuery->pCmdMsg, pCxt->pCmdMsg, SCmdMsgInfo*);
|
||||
TSWAP(pQuery->pCmdMsg, pCxt->pCmdMsg);
|
||||
pQuery->msgType = pQuery->pCmdMsg->msgType;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -251,8 +251,8 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
TSWAP(pScan->pMeta, pRealTable->pMeta, STableMeta*);
|
||||
TSWAP(pScan->pVgroupList, pRealTable->pVgroupList, SVgroupsInfo*);
|
||||
TSWAP(pScan->pMeta, pRealTable->pMeta);
|
||||
TSWAP(pScan->pVgroupList, pRealTable->pVgroupList);
|
||||
pScan->scanSeq[0] = 1;
|
||||
pScan->scanSeq[1] = 0;
|
||||
pScan->scanRange = TSWINDOW_INITIALIZER;
|
||||
|
@ -954,7 +954,7 @@ static int32_t createVnodeModifLogicNode(SLogicPlanContext* pCxt, SVnodeModifOpS
|
|||
if (NULL == pModif) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
TSWAP(pModif->pDataBlocks, pStmt->pDataBlocks, SArray*);
|
||||
TSWAP(pModif->pDataBlocks, pStmt->pDataBlocks);
|
||||
pModif->msgType = getMsgType(pStmt->sqlNodeType);
|
||||
*pLogicNode = (SLogicNode*)pModif;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -246,7 +246,7 @@ static int32_t cpdMergeConds(SNode** pDst, SNodeList** pSrc) {
|
|||
|
||||
static int32_t cpdCondAppend(SNode** pCond, SNode** pAdditionalCond) {
|
||||
if (NULL == *pCond) {
|
||||
TSWAP(*pCond, *pAdditionalCond, SNode*);
|
||||
TSWAP(*pCond, *pAdditionalCond);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -1097,7 +1097,7 @@ static int32_t createDataInserter(SPhysiPlanContext* pCxt, SVgDataBlocks* pBlock
|
|||
|
||||
pInserter->numOfTables = pBlocks->numOfTables;
|
||||
pInserter->size = pBlocks->size;
|
||||
TSWAP(pInserter->pData, pBlocks->pData, char*);
|
||||
TSWAP(pInserter->pData, pBlocks->pData);
|
||||
|
||||
*pSink = (SDataSinkNode*)pInserter;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -65,7 +65,7 @@ static SLogicSubplan* splCreateScanSubplan(SSplitContext* pCxt, SScanLogicNode*
|
|||
pSubplan->id.groupId = pCxt->groupId;
|
||||
pSubplan->subplanType = SUBPLAN_TYPE_SCAN;
|
||||
pSubplan->pNode = (SLogicNode*)nodesCloneNode(pScan);
|
||||
TSWAP(pSubplan->pVgroupList, ((SScanLogicNode*)pSubplan->pNode)->pVgroupList, SVgroupsInfo*);
|
||||
TSWAP(pSubplan->pVgroupList, ((SScanLogicNode*)pSubplan->pNode)->pVgroupList);
|
||||
SPLIT_FLAG_SET_MASK(pSubplan->splitFlag, flag);
|
||||
return pSubplan;
|
||||
}
|
||||
|
@ -406,8 +406,7 @@ int32_t splitLogicPlan(SPlanContext* pCxt, SLogicNode* pLogicNode, SLogicSubplan
|
|||
}
|
||||
if (QUERY_NODE_LOGIC_PLAN_VNODE_MODIF == nodeType(pLogicNode)) {
|
||||
pSubplan->subplanType = SUBPLAN_TYPE_MODIFY;
|
||||
TSWAP(((SVnodeModifLogicNode*)pLogicNode)->pDataBlocks, ((SVnodeModifLogicNode*)pSubplan->pNode)->pDataBlocks,
|
||||
SArray*);
|
||||
TSWAP(((SVnodeModifLogicNode*)pLogicNode)->pDataBlocks, ((SVnodeModifLogicNode*)pSubplan->pNode)->pDataBlocks);
|
||||
} else {
|
||||
pSubplan->subplanType = SUBPLAN_TYPE_SCAN;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,12 @@ int32_t tsem_wait(tsem_t* sem) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int32_t tsem_timewait(tsem_t* sem, int64_t nanosecs) {
|
||||
int ret = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#elif defined(_TD_DARWIN_64)
|
||||
|
||||
/*
|
||||
|
|
|
@ -230,7 +230,7 @@ static int32_t tSStructA_v1_decode(SCoder *pCoder, SStructA_v1 *pSAV1) {
|
|||
const char *tstr;
|
||||
uint64_t len;
|
||||
if (tDecodeCStrAndLen(pCoder, &tstr, &len) < 0) return -1;
|
||||
pSAV1->A_c = (char *)TCODER_MALLOC(pCoder, len + 1);
|
||||
pSAV1->A_c = (char *)tCoderMalloc(pCoder, len + 1);
|
||||
memcpy(pSAV1->A_c, tstr, len + 1);
|
||||
|
||||
tEndDecode(pCoder);
|
||||
|
@ -269,7 +269,7 @@ static int32_t tSStructA_v2_decode(SCoder *pCoder, SStructA_v2 *pSAV2) {
|
|||
const char *tstr;
|
||||
uint64_t len;
|
||||
if (tDecodeCStrAndLen(pCoder, &tstr, &len) < 0) return -1;
|
||||
pSAV2->A_c = (char *)TCODER_MALLOC(pCoder, len + 1);
|
||||
pSAV2->A_c = (char *)tCoderMalloc(pCoder, len + 1);
|
||||
memcpy(pSAV2->A_c, tstr, len + 1);
|
||||
|
||||
// ------------------------NEW FIELDS DECODE-------------------------------
|
||||
|
@ -305,7 +305,7 @@ static int32_t tSFinalReq_v1_encode(SCoder *pCoder, const SFinalReq_v1 *ps1) {
|
|||
static int32_t tSFinalReq_v1_decode(SCoder *pCoder, SFinalReq_v1 *ps1) {
|
||||
if (tStartDecode(pCoder) < 0) return -1;
|
||||
|
||||
ps1->pA = (SStructA_v1 *)TCODER_MALLOC(pCoder, sizeof(*(ps1->pA)));
|
||||
ps1->pA = (SStructA_v1 *)tCoderMalloc(pCoder, sizeof(*(ps1->pA)));
|
||||
if (tSStructA_v1_decode(pCoder, ps1->pA) < 0) return -1;
|
||||
if (tDecodeI32(pCoder, &ps1->v_a) < 0) return -1;
|
||||
if (tDecodeI8(pCoder, &ps1->v_b) < 0) return -1;
|
||||
|
@ -339,7 +339,7 @@ static int32_t tSFinalReq_v2_encode(SCoder *pCoder, const SFinalReq_v2 *ps2) {
|
|||
static int32_t tSFinalReq_v2_decode(SCoder *pCoder, SFinalReq_v2 *ps2) {
|
||||
if (tStartDecode(pCoder) < 0) return -1;
|
||||
|
||||
ps2->pA = (SStructA_v2 *)TCODER_MALLOC(pCoder, sizeof(*(ps2->pA)));
|
||||
ps2->pA = (SStructA_v2 *)tCoderMalloc(pCoder, sizeof(*(ps2->pA)));
|
||||
if (tSStructA_v2_decode(pCoder, ps2->pA) < 0) return -1;
|
||||
if (tDecodeI32(pCoder, &ps2->v_a) < 0) return -1;
|
||||
if (tDecodeI8(pCoder, &ps2->v_b) < 0) return -1;
|
||||
|
|
|
@ -111,6 +111,5 @@ void shellTestNetWork();
|
|||
|
||||
// shellMain.c
|
||||
extern SShellObj shell;
|
||||
extern void taos_init();
|
||||
|
||||
#endif /*_TD_SHELL_INT_H_*/
|
||||
|
|
Loading…
Reference in New Issue