format more code
This commit is contained in:
parent
98f3f183c6
commit
6ed0634fb7
|
@ -73,5 +73,3 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet) {
|
||||||
|
|
||||||
return ep;
|
return ep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,8 @@ static int32_t parseLocaltimeDst(char* timestr, int32_t len, int64_t* utime, int
|
||||||
static char* forwardToTimeStringEnd(char* str);
|
static char* forwardToTimeStringEnd(char* str);
|
||||||
static bool checkTzPresent(const char* str, int32_t len);
|
static bool checkTzPresent(const char* str, int32_t len);
|
||||||
|
|
||||||
static int32_t (*parseLocaltimeFp[])(char* timestr, int32_t len, int64_t* utime, int32_t timePrec, char delim) = {parseLocaltime,
|
static int32_t (*parseLocaltimeFp[])(char* timestr, int32_t len, int64_t* utime, int32_t timePrec, char delim) = {
|
||||||
parseLocaltimeDst};
|
parseLocaltime, parseLocaltimeDst};
|
||||||
|
|
||||||
int32_t taosParseTime(const char* timestr, int64_t* utime, int32_t len, int32_t timePrec, int8_t day_light) {
|
int32_t taosParseTime(const char* timestr, int64_t* utime, int32_t len, int32_t timePrec, int8_t day_light) {
|
||||||
/* parse datatime string in with tz */
|
/* parse datatime string in with tz */
|
||||||
|
@ -438,11 +438,9 @@ char getPrecisionUnit(int32_t precision) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision) {
|
int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision) {
|
||||||
assert(fromPrecision == TSDB_TIME_PRECISION_MILLI ||
|
assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||||
fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
|
||||||
fromPrecision == TSDB_TIME_PRECISION_NANO);
|
fromPrecision == TSDB_TIME_PRECISION_NANO);
|
||||||
assert(toPrecision == TSDB_TIME_PRECISION_MILLI ||
|
assert(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||||
toPrecision == TSDB_TIME_PRECISION_MICRO ||
|
|
||||||
toPrecision == TSDB_TIME_PRECISION_NANO);
|
toPrecision == TSDB_TIME_PRECISION_NANO);
|
||||||
double tempResult = (double)time;
|
double tempResult = (double)time;
|
||||||
switch (fromPrecision) {
|
switch (fromPrecision) {
|
||||||
|
@ -493,7 +491,8 @@ end_:
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
// !!!!notice:there are precision problems, double lose precison if time is too large, for example: 1626006833631000000*1.0 = double = 1626006833631000064
|
// !!!!notice:there are precision problems, double lose precison if time is too large, for example:
|
||||||
|
// 1626006833631000000*1.0 = double = 1626006833631000064
|
||||||
// int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision) {
|
// int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision) {
|
||||||
// assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
// assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||||
// fromPrecision == TSDB_TIME_PRECISION_NANO);
|
// fromPrecision == TSDB_TIME_PRECISION_NANO);
|
||||||
|
@ -503,8 +502,8 @@ end_:
|
||||||
// ((double)time * factors[fromPrecision][toPrecision]);
|
// ((double)time * factors[fromPrecision][toPrecision]);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
// !!!!notice: double lose precison if time is too large, for example: 1626006833631000000*1.0 = double =
|
||||||
// !!!!notice: double lose precison if time is too large, for example: 1626006833631000000*1.0 = double = 1626006833631000064
|
// 1626006833631000064
|
||||||
int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char toUnit) {
|
int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char toUnit) {
|
||||||
assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||||
fromPrecision == TSDB_TIME_PRECISION_NANO);
|
fromPrecision == TSDB_TIME_PRECISION_NANO);
|
||||||
|
|
|
@ -209,7 +209,8 @@ static STSGroupBlockInfoEx* addOneGroupInfo(STSBuf* pTSBuf, int32_t id) {
|
||||||
uint32_t newSize = (uint32_t)(pTSBuf->numOfAlloc * 1.5);
|
uint32_t newSize = (uint32_t)(pTSBuf->numOfAlloc * 1.5);
|
||||||
assert((int32_t)newSize > pTSBuf->numOfAlloc);
|
assert((int32_t)newSize > pTSBuf->numOfAlloc);
|
||||||
|
|
||||||
STSGroupBlockInfoEx* tmp = (STSGroupBlockInfoEx*)taosMemoryRealloc(pTSBuf->pData, sizeof(STSGroupBlockInfoEx) * newSize);
|
STSGroupBlockInfoEx* tmp =
|
||||||
|
(STSGroupBlockInfoEx*)taosMemoryRealloc(pTSBuf->pData, sizeof(STSGroupBlockInfoEx) * newSize);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,10 @@
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "dmMgmt.h"
|
#include "dmMgmt.h"
|
||||||
#include "tconfig.h"
|
|
||||||
#include "mnode.h"
|
#include "mnode.h"
|
||||||
|
#include "tconfig.h"
|
||||||
|
|
||||||
|
// 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_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."
|
#define DM_CFG_DIR "Configuration directory."
|
||||||
#define DM_DMP_CFG "Dump configuration."
|
#define DM_DMP_CFG "Dump configuration."
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
#define DM_MACHINE_CODE "Get machine code."
|
#define DM_MACHINE_CODE "Get machine code."
|
||||||
#define DM_VERSION "Print program version."
|
#define DM_VERSION "Print program version."
|
||||||
#define DM_EMAIL "<support@taosdata.com>"
|
#define DM_EMAIL "<support@taosdata.com>"
|
||||||
|
// clang-format on
|
||||||
static struct {
|
static struct {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
bool winServiceMode;
|
bool winServiceMode;
|
||||||
|
|
|
@ -21,7 +21,6 @@ void qmGetMonitorInfo(SQnodeMgmt *pMgmt, SMonQmInfo *qmInfo) {
|
||||||
qndGetLoad(pMgmt->pQnode, &qload);
|
qndGetLoad(pMgmt->pQnode, &qload);
|
||||||
|
|
||||||
qload.dnodeId = pMgmt->pData->dnodeId;
|
qload.dnodeId = pMgmt->pData->dnodeId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qmGetQnodeLoads(SQnodeMgmt *pMgmt, SQnodeLoad *pInfo) {
|
void qmGetQnodeLoads(SQnodeMgmt *pMgmt, SQnodeLoad *pInfo) {
|
||||||
|
|
|
@ -52,17 +52,23 @@ static int32_t dmInitMonitor() {
|
||||||
static bool dmCheckDiskSpace() {
|
static bool dmCheckDiskSpace() {
|
||||||
osUpdate();
|
osUpdate();
|
||||||
if (!osDataSpaceAvailable()) {
|
if (!osDataSpaceAvailable()) {
|
||||||
dError("free disk size: %f GB, too little, require %f GB at least at least , quit", (double)tsDataSpace.size.avail / 1024.0 / 1024.0 / 1024.0, (double)tsDataSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
dError("free disk size: %f GB, too little, require %f GB at least at least , quit",
|
||||||
|
(double)tsDataSpace.size.avail / 1024.0 / 1024.0 / 1024.0,
|
||||||
|
(double)tsDataSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
||||||
terrno = TSDB_CODE_NO_AVAIL_DISK;
|
terrno = TSDB_CODE_NO_AVAIL_DISK;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!osLogSpaceAvailable()) {
|
if (!osLogSpaceAvailable()) {
|
||||||
dError("free disk size: %f GB, too little, require %f GB at least at least, quit", (double)tsLogSpace.size.avail / 1024.0 / 1024.0 / 1024.0, (double)tsLogSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
dError("free disk size: %f GB, too little, require %f GB at least at least, quit",
|
||||||
|
(double)tsLogSpace.size.avail / 1024.0 / 1024.0 / 1024.0,
|
||||||
|
(double)tsLogSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
||||||
terrno = TSDB_CODE_NO_AVAIL_DISK;
|
terrno = TSDB_CODE_NO_AVAIL_DISK;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!osTempSpaceAvailable()) {
|
if (!osTempSpaceAvailable()) {
|
||||||
dError("free disk size: %f GB, too little, require %f GB at least at least, quit", (double)tsTempSpace.size.avail / 1024.0 / 1024.0 / 1024.0, (double)tsTempSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
dError("free disk size: %f GB, too little, require %f GB at least at least, quit",
|
||||||
|
(double)tsTempSpace.size.avail / 1024.0 / 1024.0 / 1024.0,
|
||||||
|
(double)tsTempSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
||||||
terrno = TSDB_CODE_NO_AVAIL_DISK;
|
terrno = TSDB_CODE_NO_AVAIL_DISK;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +79,8 @@ static bool dmCheckDataDirVersion() {
|
||||||
char checkDataDirJsonFileName[PATH_MAX];
|
char checkDataDirJsonFileName[PATH_MAX];
|
||||||
snprintf(checkDataDirJsonFileName, PATH_MAX, "%s/dnode/dnodeCfg.json", tsDataDir);
|
snprintf(checkDataDirJsonFileName, PATH_MAX, "%s/dnode/dnodeCfg.json", tsDataDir);
|
||||||
if (taosCheckExistFile(checkDataDirJsonFileName)) {
|
if (taosCheckExistFile(checkDataDirJsonFileName)) {
|
||||||
dError("The default data directory %s contains old data of tdengine 2.x, please clear it before running!", tsDataDir);
|
dError("The default data directory %s contains old data of tdengine 2.x, please clear it before running!",
|
||||||
|
tsDataDir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -183,4 +183,3 @@ void dmGetQnodeLoads(SQnodeLoad *pInfo) {
|
||||||
dmReleaseWrapper(pWrapper);
|
dmReleaseWrapper(pWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
||||||
#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
|
#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
|
||||||
|
|
|
@ -25,7 +25,6 @@ extern "C" {
|
||||||
int32_t mndInitQuery(SMnode *pMnode);
|
int32_t mndInitQuery(SMnode *pMnode);
|
||||||
void mndCleanupQuery(SMnode *pMnode);
|
void mndCleanupQuery(SMnode *pMnode);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mndBnode.h"
|
#include "mndBnode.h"
|
||||||
#include "mndPrivilege.h"
|
|
||||||
#include "mndDnode.h"
|
#include "mndDnode.h"
|
||||||
|
#include "mndPrivilege.h"
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mndMnode.h"
|
#include "mndMnode.h"
|
||||||
#include "mndPrivilege.h"
|
|
||||||
#include "mndDnode.h"
|
#include "mndDnode.h"
|
||||||
|
#include "mndPrivilege.h"
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
#include "mndSync.h"
|
#include "mndSync.h"
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
|
|
|
@ -150,4 +150,3 @@ void mndCleanupPerfs(SMnode *pMnode) {
|
||||||
taosHashCleanup(pMnode->perfsMeta);
|
taosHashCleanup(pMnode->perfsMeta);
|
||||||
pMnode->perfsMeta = NULL;
|
pMnode->perfsMeta = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mndQnode.h"
|
#include "mndQnode.h"
|
||||||
#include "mndPrivilege.h"
|
|
||||||
#include "mndDnode.h"
|
#include "mndDnode.h"
|
||||||
|
#include "mndPrivilege.h"
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mndSnode.h"
|
#include "mndSnode.h"
|
||||||
#include "mndPrivilege.h"
|
|
||||||
#include "mndDnode.h"
|
#include "mndDnode.h"
|
||||||
|
#include "mndPrivilege.h"
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
|
|
@ -1179,8 +1179,8 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
|
||||||
SNode *pNode = NULL;
|
SNode *pNode = NULL;
|
||||||
FOREACH(pNode, pNodeList) {
|
FOREACH(pNode, pNodeList) {
|
||||||
SColumnNode *pCol = (SColumnNode *)pNode;
|
SColumnNode *pCol = (SColumnNode *)pNode;
|
||||||
mInfo("topic:%s, check colId:%d tableId:%" PRId64 " ctbStbUid:%" PRId64, pTopic->name, pCol->colId,
|
mInfo("topic:%s, check colId:%d tableId:%" PRId64 " ctbStbUid:%" PRId64, pTopic->name, pCol->colId, pCol->tableId,
|
||||||
pCol->tableId, pTopic->ctbStbUid);
|
pTopic->ctbStbUid);
|
||||||
|
|
||||||
if (pCol->tableId != suid && pTopic->ctbStbUid != suid) {
|
if (pCol->tableId != suid && pTopic->ctbStbUid != suid) {
|
||||||
mInfo("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
|
mInfo("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
|
||||||
|
@ -1256,8 +1256,8 @@ static int32_t mndCheckAlterColForTSma(SMnode *pMnode, const char *stbFullName,
|
||||||
pIter = sdbFetch(pSdb, SDB_SMA, pIter, (void **)&pSma);
|
pIter = sdbFetch(pSdb, SDB_SMA, pIter, (void **)&pSma);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
mInfo("tsma:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, sql:%s", pSma->name,
|
mInfo("tsma:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, sql:%s", pSma->name, stbFullName,
|
||||||
stbFullName, suid, colId, pSma->sql);
|
suid, colId, pSma->sql);
|
||||||
|
|
||||||
SNode *pAst = NULL;
|
SNode *pAst = NULL;
|
||||||
if (nodesStringToNode(pSma->ast, &pAst) != 0) {
|
if (nodesStringToNode(pSma->ast, &pAst) != 0) {
|
||||||
|
|
|
@ -1555,8 +1555,8 @@ static int32_t mndCheckDnodeMemory(SMnode *pMnode, SDbObj *pOldDb, SDbObj *pNewD
|
||||||
terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE;
|
terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE;
|
||||||
return -1;
|
return -1;
|
||||||
} else if (inVgroup) {
|
} else if (inVgroup) {
|
||||||
mInfo("db:%s, vgId:%d, memory in dnode:%d, avail:%" PRId64 " used:%" PRId64, pNewVgroup->dbName,
|
mInfo("db:%s, vgId:%d, memory in dnode:%d, avail:%" PRId64 " used:%" PRId64, pNewVgroup->dbName, pNewVgroup->vgId,
|
||||||
pNewVgroup->vgId, pDnode->id, pDnode->memAvail, pDnode->memUsed);
|
pDnode->id, pDnode->memAvail, pDnode->memUsed);
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,7 @@ void MndTestFunc::SetComment(SCreateFuncReq* pReq, const char* pComment) {
|
||||||
strcpy(pReq->pComment, pComment);
|
strcpy(pReq->pComment, pComment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MndTestFunc::SetBufSize(SCreateFuncReq* pReq, int32_t size) {
|
void MndTestFunc::SetBufSize(SCreateFuncReq* pReq, int32_t size) { pReq->bufSize = size; }
|
||||||
pReq->bufSize = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(MndTestFunc, 01_Show_Func) {
|
TEST_F(MndTestFunc, 01_Show_Func) {
|
||||||
test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "ins_functions", "");
|
test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "ins_functions", "");
|
||||||
|
@ -509,5 +507,4 @@ TEST_F(MndTestFunc, 05_Actual_code) {
|
||||||
}
|
}
|
||||||
tFreeSRetrieveFuncRsp(&retrieveRsp);
|
tFreeSRetrieveFuncRsp(&retrieveRsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -32,7 +32,8 @@ class MndTestStb : public ::testing::Test {
|
||||||
void* BuildAlterStbUpdateTagBytesReq(const char* stbname, const char* tagname, int32_t bytes, int32_t* pContLen);
|
void* BuildAlterStbUpdateTagBytesReq(const char* stbname, const char* tagname, int32_t bytes, int32_t* pContLen);
|
||||||
void* BuildAlterStbAddColumnReq(const char* stbname, const char* colname, int32_t* pContLen);
|
void* BuildAlterStbAddColumnReq(const char* stbname, const char* colname, int32_t* pContLen);
|
||||||
void* BuildAlterStbDropColumnReq(const char* stbname, const char* colname, int32_t* pContLen);
|
void* BuildAlterStbDropColumnReq(const char* stbname, const char* colname, int32_t* pContLen);
|
||||||
void* BuildAlterStbUpdateColumnBytesReq(const char* stbname, const char* colname, int32_t bytes, int32_t* pContLen, int32_t verInBlock);
|
void* BuildAlterStbUpdateColumnBytesReq(const char* stbname, const char* colname, int32_t bytes, int32_t* pContLen,
|
||||||
|
int32_t verInBlock);
|
||||||
};
|
};
|
||||||
|
|
||||||
Testbase MndTestStb::test;
|
Testbase MndTestStb::test;
|
||||||
|
|
|
@ -306,8 +306,8 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
||||||
pSdb->commitTerm = pSdb->applyTerm;
|
pSdb->commitTerm = pSdb->applyTerm;
|
||||||
pSdb->commitConfig = pSdb->applyConfig;
|
pSdb->commitConfig = pSdb->applyConfig;
|
||||||
memcpy(pSdb->tableVer, tableVer, sizeof(tableVer));
|
memcpy(pSdb->tableVer, tableVer, sizeof(tableVer));
|
||||||
mInfo("read sdb file:%s success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64, file,
|
mInfo("read sdb file:%s success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64, file, pSdb->commitIndex,
|
||||||
pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig);
|
pSdb->commitTerm, pSdb->commitConfig);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
taosCloseFile(&pFile);
|
taosCloseFile(&pFile);
|
||||||
|
@ -556,8 +556,7 @@ int32_t sdbStartRead(SSdb *pSdb, SSdbIter **ppIter, int64_t *index, int64_t *ter
|
||||||
if (term != NULL) *term = commitTerm;
|
if (term != NULL) *term = commitTerm;
|
||||||
if (config != NULL) *config = commitConfig;
|
if (config != NULL) *config = commitConfig;
|
||||||
|
|
||||||
mInfo("sdbiter:%p, is created to read snapshot, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64
|
mInfo("sdbiter:%p, is created to read snapshot, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64 " file:%s",
|
||||||
" file:%s",
|
|
||||||
pIter, commitIndex, commitTerm, commitConfig, pIter->name);
|
pIter, commitIndex, commitTerm, commitConfig, pIter->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
#include "tmsg.h"
|
#include "tmsg.h"
|
||||||
#include "trpc.h"
|
|
||||||
#include "tmsgcb.h"
|
#include "tmsgcb.h"
|
||||||
|
#include "trpc.h"
|
||||||
|
|
||||||
#include "qnode.h"
|
#include "qnode.h"
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "executor.h"
|
#include "executor.h"
|
||||||
|
#include "libs/function/function.h"
|
||||||
#include "qndInt.h"
|
#include "qndInt.h"
|
||||||
#include "query.h"
|
#include "query.h"
|
||||||
#include "qworker.h"
|
#include "qworker.h"
|
||||||
#include "libs/function/function.h"
|
|
||||||
|
|
||||||
SQnode *qndOpen(const SQnodeOpt *pOption) {
|
SQnode *qndOpen(const SQnodeOpt *pOption) {
|
||||||
SQnode *pQnode = taosMemoryCalloc(1, sizeof(SQnode));
|
SQnode *pQnode = taosMemoryCalloc(1, sizeof(SQnode));
|
||||||
|
|
|
@ -78,8 +78,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
|
||||||
if (tDecodeI32(pCoder, &pME->ctbEntry.ttlDays) < 0) return -1;
|
if (tDecodeI32(pCoder, &pME->ctbEntry.ttlDays) < 0) return -1;
|
||||||
if (tDecodeI32v(pCoder, &pME->ctbEntry.commentLen) < 0) return -1;
|
if (tDecodeI32v(pCoder, &pME->ctbEntry.commentLen) < 0) return -1;
|
||||||
if (pME->ctbEntry.commentLen > 0) {
|
if (pME->ctbEntry.commentLen > 0) {
|
||||||
if (tDecodeCStr(pCoder, &pME->ctbEntry.comment) < 0)
|
if (tDecodeCStr(pCoder, &pME->ctbEntry.comment) < 0) return -1;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
if (tDecodeI64(pCoder, &pME->ctbEntry.suid) < 0) return -1;
|
if (tDecodeI64(pCoder, &pME->ctbEntry.suid) < 0) return -1;
|
||||||
if (tDecodeTag(pCoder, (STag **)&pME->ctbEntry.pTags) < 0) return -1; // (TODO)
|
if (tDecodeTag(pCoder, (STag **)&pME->ctbEntry.pTags) < 0) return -1; // (TODO)
|
||||||
|
|
|
@ -92,7 +92,8 @@ static int32_t smaEvalDays(SVnode *pVnode, SRetention *r, int8_t level, int8_t p
|
||||||
days = freqDuration;
|
days = freqDuration;
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
smaInfo("vgId:%d, evaluated duration for level %" PRIi8 " is %d, raw val:%d", TD_VID(pVnode), level + 1, days, duration);
|
smaInfo("vgId:%d, evaluated duration for level %" PRIi8 " is %d, raw val:%d", TD_VID(pVnode), level + 1, days,
|
||||||
|
duration);
|
||||||
return days;
|
return days;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -328,4 +328,3 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
|
||||||
tdbTbcClose(pCur);
|
tdbTbcClose(pCur);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,8 @@ static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) {
|
||||||
pInfo->elapsedTime += el;
|
pInfo->elapsedTime += el;
|
||||||
pInfo->loadBlocks += 1;
|
pInfo->loadBlocks += 1;
|
||||||
|
|
||||||
tsdbDebug("read last block, index:%d, last file index:%d, elapsed time:%.2f ms, %s", pIter->iSttBlk, pIter->iStt, el, idStr);
|
tsdbDebug("read last block, index:%d, last file index:%d, elapsed time:%.2f ms, %s", pIter->iSttBlk, pIter->iStt,
|
||||||
|
el, idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +151,8 @@ static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the earliest block that contains the required records
|
// find the earliest block that contains the required records
|
||||||
static FORCE_INLINE int32_t findEarliestIndex(int32_t index, uint64_t uid, const SSttBlk* pBlockList, int32_t num, int32_t backward) {
|
static FORCE_INLINE int32_t findEarliestIndex(int32_t index, uint64_t uid, const SSttBlk *pBlockList, int32_t num,
|
||||||
|
int32_t backward) {
|
||||||
int32_t i = index;
|
int32_t i = index;
|
||||||
int32_t step = backward ? 1 : -1;
|
int32_t step = backward ? 1 : -1;
|
||||||
while (i >= 0 && i < num && uid >= pBlockList[i].minUid && uid <= pBlockList[i].maxUid) {
|
while (i >= 0 && i < num && uid >= pBlockList[i].minUid && uid <= pBlockList[i].maxUid) {
|
||||||
|
@ -195,7 +197,8 @@ static int32_t binarySearchForStartBlock(SSttBlk*pBlockList, int32_t num, uint64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE int32_t findEarliestRow(int32_t index, uint64_t uid, const uint64_t* uidList, int32_t num, int32_t backward) {
|
static FORCE_INLINE int32_t findEarliestRow(int32_t index, uint64_t uid, const uint64_t *uidList, int32_t num,
|
||||||
|
int32_t backward) {
|
||||||
int32_t i = index;
|
int32_t i = index;
|
||||||
int32_t step = backward ? 1 : -1;
|
int32_t step = backward ? 1 : -1;
|
||||||
while (i >= 0 && i < num && uid == uidList[i]) {
|
while (i >= 0 && i < num && uid == uidList[i]) {
|
||||||
|
@ -319,9 +322,7 @@ _exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tLDataIterClose(SLDataIter *pIter) {
|
void tLDataIterClose(SLDataIter *pIter) { taosMemoryFree(pIter); }
|
||||||
taosMemoryFree(pIter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void tLDataIterNextBlock(SLDataIter *pIter) {
|
void tLDataIterNextBlock(SLDataIter *pIter) {
|
||||||
int32_t step = pIter->backward ? -1 : 1;
|
int32_t step = pIter->backward ? -1 : 1;
|
||||||
|
@ -383,7 +384,8 @@ static void findNextValidRow(SLDataIter *pIter, const char* idStr) {
|
||||||
SBlockData *pBlockData = loadLastBlock(pIter, idStr);
|
SBlockData *pBlockData = loadLastBlock(pIter, idStr);
|
||||||
|
|
||||||
// mostly we only need to find the start position for a given table
|
// mostly we only need to find the start position for a given table
|
||||||
if ((((i == 0) && (!pIter->backward)) || (i == pBlockData->nRow - 1 && pIter->backward)) && pBlockData->aUid != NULL) {
|
if ((((i == 0) && (!pIter->backward)) || (i == pBlockData->nRow - 1 && pIter->backward)) &&
|
||||||
|
pBlockData->aUid != NULL) {
|
||||||
i = binarySearchForStartRowIndex((uint64_t *)pBlockData->aUid, pBlockData->nRow, pIter->uid, pIter->backward);
|
i = binarySearchForStartRowIndex((uint64_t *)pBlockData->aUid, pBlockData->nRow, pIter->uid, pIter->backward);
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
pIter->iRow = -1;
|
pIter->iRow = -1;
|
||||||
|
@ -396,13 +398,15 @@ static void findNextValidRow(SLDataIter *pIter, const char* idStr) {
|
||||||
if (!pIter->backward) {
|
if (!pIter->backward) {
|
||||||
/*if (pBlockData->aUid[i] < pIter->uid) {
|
/*if (pBlockData->aUid[i] < pIter->uid) {
|
||||||
continue;
|
continue;
|
||||||
} else */if (pBlockData->aUid[i] > pIter->uid) {
|
} else */
|
||||||
|
if (pBlockData->aUid[i] > pIter->uid) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*if (pBlockData->aUid[i] > pIter->uid) {
|
/*if (pBlockData->aUid[i] > pIter->uid) {
|
||||||
continue;
|
continue;
|
||||||
} else */if (pBlockData->aUid[i] < pIter->uid) {
|
} else */
|
||||||
|
if (pBlockData->aUid[i] < pIter->uid) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -528,7 +532,8 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFRead
|
||||||
|
|
||||||
for (int32_t i = 0; i < pFReader->pSet->nSttF; ++i) { // open all last file
|
for (int32_t i = 0; i < pFReader->pSet->nSttF; ++i) { // open all last file
|
||||||
struct SLDataIter *pIter = NULL;
|
struct SLDataIter *pIter = NULL;
|
||||||
code = tLDataIterOpen(&pIter, pFReader, i, pMTree->backward, suid, uid, pTimeWindow, pVerRange, &pMTree->pLoadInfo[i], pMTree->idStr);
|
code = tLDataIterOpen(&pIter, pFReader, i, pMTree->backward, suid, uid, pTimeWindow, pVerRange,
|
||||||
|
&pMTree->pLoadInfo[i], pMTree->idStr);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
|
@ -799,4 +799,3 @@ bool vnodeIsLeader(SVnode *pVnode) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
#include <tglobal.h>
|
#include <tglobal.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <vnodeInt.h>
|
|
||||||
#include <tmsg.h>
|
#include <tmsg.h>
|
||||||
|
#include <vnodeInt.h>
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
|
@ -441,7 +441,6 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
|
||||||
pDataBlock->pDataBlock = taosArrayInit(tSmaNumOfCols, sizeof(SColumnInfoData *));
|
pDataBlock->pDataBlock = taosArrayInit(tSmaNumOfCols, sizeof(SColumnInfoData *));
|
||||||
EXPECT_NE(pDataBlock->pDataBlock, nullptr);
|
EXPECT_NE(pDataBlock->pDataBlock, nullptr);
|
||||||
for (int32_t c = 0; c < tSmaNumOfCols; ++c) {
|
for (int32_t c = 0; c < tSmaNumOfCols; ++c) {
|
||||||
|
|
||||||
SColumnInfoData *pColInfoData = (SColumnInfoData *)taosMemoryCalloc(1, sizeof(SColumnInfoData));
|
SColumnInfoData *pColInfoData = (SColumnInfoData *)taosMemoryCalloc(1, sizeof(SColumnInfoData));
|
||||||
EXPECT_NE(pColInfoData, nullptr);
|
EXPECT_NE(pColInfoData, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@ FORMAT_DIR_LIST=(
|
||||||
"include"
|
"include"
|
||||||
"source/os"
|
"source/os"
|
||||||
"source/util"
|
"source/util"
|
||||||
|
"source/common"
|
||||||
|
# "source/libs"
|
||||||
|
# "source/client"
|
||||||
|
"source/dnode"
|
||||||
)
|
)
|
||||||
|
|
||||||
for d in ${FORMAT_DIR_LIST[@]}; do
|
for d in ${FORMAT_DIR_LIST[@]}; do
|
||||||
|
|
Loading…
Reference in New Issue