提交 63d9b856 编写于 作者: H Hongze Cheng

more code format

上级 d5255f1e
...@@ -48,7 +48,7 @@ double sifLeftVd = 21.0, sifRightVd = 10.0; ...@@ -48,7 +48,7 @@ double sifLeftVd = 21.0, sifRightVd = 10.0;
void sifFreeDataBlock(void *block) { blockDataDestroy(*(SSDataBlock **)block); } void sifFreeDataBlock(void *block) { blockDataDestroy(*(SSDataBlock **)block); }
void sifInitLogFile() { void sifInitLogFile() {
const char * defaultLogFileNamePrefix = "taoslog"; const char *defaultLogFileNamePrefix = "taoslog";
const int32_t maxLogFileNum = 10; const int32_t maxLogFileNum = 10;
tsAsyncLog = 0; tsAsyncLog = 0;
...@@ -96,7 +96,7 @@ void sifAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t *sl ...@@ -96,7 +96,7 @@ void sifAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t *sl
} }
void sifMakeValueNode(SNode **pNode, int32_t dataType, void *value) { void sifMakeValueNode(SNode **pNode, int32_t dataType, void *value) {
SNode * node = (SNode *)nodesMakeNode(QUERY_NODE_VALUE); SNode *node = (SNode *)nodesMakeNode(QUERY_NODE_VALUE);
SValueNode *vnode = (SValueNode *)node; SValueNode *vnode = (SValueNode *)node;
vnode->node.resType.type = dataType; vnode->node.resType.type = dataType;
...@@ -113,7 +113,7 @@ void sifMakeValueNode(SNode **pNode, int32_t dataType, void *value) { ...@@ -113,7 +113,7 @@ void sifMakeValueNode(SNode **pNode, int32_t dataType, void *value) {
} }
void sifMakeColumnNode(SNode **pNode, const char *db, const char *colName, EColumnType colType, uint8_t colValType) { void sifMakeColumnNode(SNode **pNode, const char *db, const char *colName, EColumnType colType, uint8_t colValType) {
SNode * node = (SNode *)nodesMakeNode(QUERY_NODE_COLUMN); SNode *node = (SNode *)nodesMakeNode(QUERY_NODE_COLUMN);
SColumnNode *rnode = (SColumnNode *)node; SColumnNode *rnode = (SColumnNode *)node;
memcpy(rnode->dbName, db, strlen(db)); memcpy(rnode->dbName, db, strlen(db));
memcpy(rnode->colName, colName, strlen(colName)); memcpy(rnode->colName, colName, strlen(colName));
...@@ -125,7 +125,7 @@ void sifMakeColumnNode(SNode **pNode, const char *db, const char *colName, EColu ...@@ -125,7 +125,7 @@ void sifMakeColumnNode(SNode **pNode, const char *db, const char *colName, EColu
} }
void sifMakeOpNode(SNode **pNode, EOperatorType opType, int32_t resType, SNode *pLeft, SNode *pRight) { void sifMakeOpNode(SNode **pNode, EOperatorType opType, int32_t resType, SNode *pLeft, SNode *pRight) {
SNode * node = (SNode *)nodesMakeNode(QUERY_NODE_OPERATOR); SNode *node = (SNode *)nodesMakeNode(QUERY_NODE_OPERATOR);
SOperatorNode *onode = (SOperatorNode *)node; SOperatorNode *onode = (SOperatorNode *)node;
onode->node.resType.type = resType; onode->node.resType.type = resType;
onode->node.resType.bytes = tDataTypes[resType].bytes; onode->node.resType.bytes = tDataTypes[resType].bytes;
...@@ -138,7 +138,7 @@ void sifMakeOpNode(SNode **pNode, EOperatorType opType, int32_t resType, SNode * ...@@ -138,7 +138,7 @@ void sifMakeOpNode(SNode **pNode, EOperatorType opType, int32_t resType, SNode *
} }
void sifMakeListNode(SNode **pNode, SNodeList *list, int32_t resType) { void sifMakeListNode(SNode **pNode, SNodeList *list, int32_t resType) {
SNode * node = (SNode *)nodesMakeNode(QUERY_NODE_NODE_LIST); SNode *node = (SNode *)nodesMakeNode(QUERY_NODE_NODE_LIST);
SNodeListNode *lnode = (SNodeListNode *)node; SNodeListNode *lnode = (SNodeListNode *)node;
lnode->dataType.type = resType; lnode->dataType.type = resType;
lnode->pNodeList = list; lnode->pNodeList = list;
...@@ -147,7 +147,7 @@ void sifMakeListNode(SNode **pNode, SNodeList *list, int32_t resType) { ...@@ -147,7 +147,7 @@ void sifMakeListNode(SNode **pNode, SNodeList *list, int32_t resType) {
} }
void sifMakeLogicNode(SNode **pNode, ELogicConditionType opType, SNode **nodeList, int32_t nodeNum) { void sifMakeLogicNode(SNode **pNode, ELogicConditionType opType, SNode **nodeList, int32_t nodeNum) {
SNode * node = (SNode *)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); SNode *node = (SNode *)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION);
SLogicConditionNode *onode = (SLogicConditionNode *)node; SLogicConditionNode *onode = (SLogicConditionNode *)node;
onode->condType = opType; onode->condType = opType;
onode->node.resType.type = TSDB_DATA_TYPE_BOOL; onode->node.resType.type = TSDB_DATA_TYPE_BOOL;
...@@ -162,7 +162,7 @@ void sifMakeLogicNode(SNode **pNode, ELogicConditionType opType, SNode **nodeLis ...@@ -162,7 +162,7 @@ void sifMakeLogicNode(SNode **pNode, ELogicConditionType opType, SNode **nodeLis
} }
void sifMakeTargetNode(SNode **pNode, int16_t dataBlockId, int16_t slotId, SNode *snode) { void sifMakeTargetNode(SNode **pNode, int16_t dataBlockId, int16_t slotId, SNode *snode) {
SNode * node = (SNode *)nodesMakeNode(QUERY_NODE_TARGET); SNode *node = (SNode *)nodesMakeNode(QUERY_NODE_TARGET);
STargetNode *onode = (STargetNode *)node; STargetNode *onode = (STargetNode *)node;
onode->pExpr = snode; onode->pExpr = snode;
onode->dataBlockId = dataBlockId; onode->dataBlockId = dataBlockId;
......
...@@ -556,7 +556,7 @@ void monSendReport() { ...@@ -556,7 +556,7 @@ void monSendReport() {
char *pCont = tjsonToString(pMonitor->pJson); char *pCont = tjsonToString(pMonitor->pJson);
// uDebugL("report cont:%s\n", pCont); // uDebugL("report cont:%s\n", pCont);
if (pCont != NULL) { if (pCont != NULL) {
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT; EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
if (taosSendHttpReport(tsMonitor.cfg.server, tsMonitor.cfg.port, pCont, strlen(pCont), flag) != 0) { if (taosSendHttpReport(tsMonitor.cfg.server, tsMonitor.cfg.port, pCont, strlen(pCont), flag) != 0) {
uError("failed to send monitor msg"); uError("failed to send monitor msg");
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
#include "catalog.h" #include "catalog.h"
#include "os.h" #include "os.h"
#include "query.h"
#include "tname.h" #include "tname.h"
#include "ttypes.h" #include "ttypes.h"
#include "query.h"
#define IS_DATA_COL_ORDERED(spd) ((spd->orderStatus) == (int8_t)ORDER_STATUS_ORDERED) #define IS_DATA_COL_ORDERED(spd) ((spd->orderStatus) == (int8_t)ORDER_STATUS_ORDERED)
......
...@@ -174,13 +174,14 @@ bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts) { ...@@ -174,13 +174,14 @@ bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts) {
if (res == TSDB_CODE_SUCCESS) { if (res == TSDB_CODE_SUCCESS) {
return false; return false;
} else { } else {
qDebug("===stream===Update close window sbf. tableId:%" PRIu64 ", maxTs:%" PRIu64 ", mapMaxTs:%" PRIu64 ", ts:%" PRIu64, tableId, qDebug("===stream===Update close window sbf. tableId:%" PRIu64 ", maxTs:%" PRIu64 ", mapMaxTs:%" PRIu64
maxTs, *pMapMaxTs, ts); ", ts:%" PRIu64,
tableId, maxTs, *pMapMaxTs, ts);
return true; return true;
} }
} }
qDebug("===stream===Update close window. tableId:%" PRIu64 ", maxTs:%" PRIu64 ", mapMaxTs:%" PRIu64 ", ts:%" PRIu64, tableId, qDebug("===stream===Update close window. tableId:%" PRIu64 ", maxTs:%" PRIu64 ", mapMaxTs:%" PRIu64 ", ts:%" PRIu64,
maxTs, *pMapMaxTs, ts); tableId, maxTs, *pMapMaxTs, ts);
return true; return true;
} }
...@@ -202,8 +203,8 @@ bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts) { ...@@ -202,8 +203,8 @@ bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts) {
} }
if (ts < pInfo->minTS) { if (ts < pInfo->minTS) {
qDebug("===stream===Update min ts. tableId:%" PRIu64 ", maxTs:%" PRIu64 ", mapMaxTs:%" PRIu64 ", ts:%" PRIu64, tableId, qDebug("===stream===Update min ts. tableId:%" PRIu64 ", maxTs:%" PRIu64 ", mapMaxTs:%" PRIu64 ", ts:%" PRIu64,
maxTs, *pMapMaxTs, ts); tableId, maxTs, *pMapMaxTs, ts);
return true; return true;
} else if (res == TSDB_CODE_SUCCESS) { } else if (res == TSDB_CODE_SUCCESS) {
return false; return false;
......
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
#include "ttime.h" #include "ttime.h"
using namespace std; using namespace std;
#define MAX_NUM_SCALABLE_BF 100000 #define MAX_NUM_SCALABLE_BF 100000
bool equalSBF(SScalableBf* left, SScalableBf* right) { bool equalSBF(SScalableBf *left, SScalableBf *right) {
if (left->growth != right->growth) return false; if (left->growth != right->growth) return false;
if (left->numBits != right->numBits) return false; if (left->numBits != right->numBits) return false;
int lsize = taosArrayGetSize(left->bfArray); int lsize = taosArrayGetSize(left->bfArray);
int rsize = taosArrayGetSize(right->bfArray); int rsize = taosArrayGetSize(right->bfArray);
if (lsize != rsize) return false; if (lsize != rsize) return false;
for (int32_t i = 0; i < lsize; i++) { for (int32_t i = 0; i < lsize; i++) {
SBloomFilter* pLeftBF = (SBloomFilter*)taosArrayGetP(left->bfArray, i); SBloomFilter *pLeftBF = (SBloomFilter *)taosArrayGetP(left->bfArray, i);
SBloomFilter* pRightBF = (SBloomFilter*)taosArrayGetP(right->bfArray, i); SBloomFilter *pRightBF = (SBloomFilter *)taosArrayGetP(right->bfArray, i);
if (pLeftBF->errorRate != pRightBF->errorRate) return false; if (pLeftBF->errorRate != pRightBF->errorRate) return false;
if (pLeftBF->expectedEntries != pRightBF->expectedEntries) return false; if (pLeftBF->expectedEntries != pRightBF->expectedEntries) return false;
if (pLeftBF->hashFn1 != pRightBF->hashFn1) return false; if (pLeftBF->hashFn1 != pRightBF->hashFn1) return false;
...@@ -23,8 +23,8 @@ bool equalSBF(SScalableBf* left, SScalableBf* right) { ...@@ -23,8 +23,8 @@ bool equalSBF(SScalableBf* left, SScalableBf* right) {
if (pLeftBF->numBits != pRightBF->numBits) return false; if (pLeftBF->numBits != pRightBF->numBits) return false;
if (pLeftBF->numUnits != pRightBF->numUnits) return false; if (pLeftBF->numUnits != pRightBF->numUnits) return false;
if (pLeftBF->size != pRightBF->size) return false; if (pLeftBF->size != pRightBF->size) return false;
uint64_t* leftUint = (uint64_t*) pLeftBF->buffer; uint64_t *leftUint = (uint64_t *)pLeftBF->buffer;
uint64_t* rightUint = (uint64_t*) pRightBF->buffer; uint64_t *rightUint = (uint64_t *)pRightBF->buffer;
for (int32_t j = 0; j < pLeftBF->numUnits; j++) { for (int32_t j = 0; j < pLeftBF->numUnits; j++) {
if (leftUint[j] != rightUint[j]) return false; if (leftUint[j] != rightUint[j]) return false;
} }
...@@ -35,86 +35,86 @@ bool equalSBF(SScalableBf* left, SScalableBf* right) { ...@@ -35,86 +35,86 @@ bool equalSBF(SScalableBf* left, SScalableBf* right) {
TEST(TD_STREAM_UPDATE_TEST, update) { TEST(TD_STREAM_UPDATE_TEST, update) {
const int64_t interval = 20 * 1000; const int64_t interval = 20 * 1000;
const int64_t watermark = 10 * 60 * 1000; const int64_t watermark = 10 * 60 * 1000;
SUpdateInfo *pSU = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark); SUpdateInfo *pSU = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark);
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU,1, 0), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, 1, 0), false);
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU,1, -1), true); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, 1, -1), true);
for(int i=0; i < 1024; i++) { for (int i = 0; i < 1024; i++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU,i, 1), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, i, 1), false);
} }
for(int i=0; i < 1024; i++) { for (int i = 0; i < 1024; i++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU,i, 1), true); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, i, 1), true);
} }
for(int i=0; i < 1024; i++) { for (int i = 0; i < 1024; i++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU,i, 2), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, i, 2), false);
} }
for(int i=0; i < 1024; i++) { for (int i = 0; i < 1024; i++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU,i, 2), true); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, i, 2), true);
} }
for(int i=0; i < 1024; i++) { for (int i = 0; i < 1024; i++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU,i, 1), true); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, i, 1), true);
} }
TSKEY uid = 0; TSKEY uid = 0;
for(int i=3; i < 1024; i++) { for (int i = 3; i < 1024; i++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, uid, i), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, uid, i), false);
} }
GTEST_ASSERT_EQ(*(TSKEY*)taosHashGet(pSU->pMap, &uid, sizeof(uint64_t)), 1023); GTEST_ASSERT_EQ(*(TSKEY *)taosHashGet(pSU->pMap, &uid, sizeof(uint64_t)), 1023);
for(int i=3; i < 1024; i++) { for (int i = 3; i < 1024; i++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, uid, i), true); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU, uid, i), true);
} }
GTEST_ASSERT_EQ(*(TSKEY*)taosHashGet(pSU->pMap, &uid, sizeof(uint64_t)), 1023); GTEST_ASSERT_EQ(*(TSKEY *)taosHashGet(pSU->pMap, &uid, sizeof(uint64_t)), 1023);
SUpdateInfo *pSU1 = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark); SUpdateInfo *pSU1 = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark);
for(int i=1; i <= watermark / interval; i++) { for (int i = 1; i <= watermark / interval; i++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU1, 1, i * interval + 5), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU1, 1, i * interval + 5), false);
GTEST_ASSERT_EQ(pSU1->minTS, interval); GTEST_ASSERT_EQ(pSU1->minTS, interval);
GTEST_ASSERT_EQ(pSU1->numSBFs, watermark / interval); GTEST_ASSERT_EQ(pSU1->numSBFs, watermark / interval);
} }
for(int i=0; i < pSU1->numSBFs; i++) { for (int i = 0; i < pSU1->numSBFs; i++) {
SScalableBf *pSBF = (SScalableBf *)taosArrayGetP(pSU1->pTsSBFs, i); SScalableBf *pSBF = (SScalableBf *)taosArrayGetP(pSU1->pTsSBFs, i);
SBloomFilter *pBF = (SBloomFilter *)taosArrayGetP(pSBF->bfArray, 0); SBloomFilter *pBF = (SBloomFilter *)taosArrayGetP(pSBF->bfArray, 0);
GTEST_ASSERT_EQ(pBF->size, 1); GTEST_ASSERT_EQ(pBF->size, 1);
} }
for(int i= watermark / interval + 1, j = 2 ; i <= watermark / interval + 10; i++,j++) { for (int i = watermark / interval + 1, j = 2; i <= watermark / interval + 10; i++, j++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU1, 1, i * interval + 5), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU1, 1, i * interval + 5), false);
GTEST_ASSERT_EQ(pSU1->minTS, interval*j); GTEST_ASSERT_EQ(pSU1->minTS, interval * j);
GTEST_ASSERT_EQ(pSU1->numSBFs, watermark / interval); GTEST_ASSERT_EQ(pSU1->numSBFs, watermark / interval);
SScalableBf *pSBF = (SScalableBf *)taosArrayGetP(pSU1->pTsSBFs, pSU1->numSBFs - 1); SScalableBf *pSBF = (SScalableBf *)taosArrayGetP(pSU1->pTsSBFs, pSU1->numSBFs - 1);
SBloomFilter *pBF = (SBloomFilter *)taosArrayGetP(pSBF->bfArray, 0); SBloomFilter *pBF = (SBloomFilter *)taosArrayGetP(pSBF->bfArray, 0);
GTEST_ASSERT_EQ(pBF->size, 1); GTEST_ASSERT_EQ(pBF->size, 1);
} }
for(int i= watermark / interval * 100, j = 0; j < 10; i+= (watermark / interval * 2), j++) { for (int i = watermark / interval * 100, j = 0; j < 10; i += (watermark / interval * 2), j++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU1, 1, i * interval + 5), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU1, 1, i * interval + 5), false);
GTEST_ASSERT_EQ(pSU1->minTS, (i-(pSU1->numSBFs-1))*interval); GTEST_ASSERT_EQ(pSU1->minTS, (i - (pSU1->numSBFs - 1)) * interval);
GTEST_ASSERT_EQ(pSU1->numSBFs, watermark / interval); GTEST_ASSERT_EQ(pSU1->numSBFs, watermark / interval);
} }
SUpdateInfo *pSU2 = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark); SUpdateInfo *pSU2 = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark);
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU2, 1, 1 * interval + 5), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU2, 1, 1 * interval + 5), false);
GTEST_ASSERT_EQ(pSU2->minTS, interval); GTEST_ASSERT_EQ(pSU2->minTS, interval);
for(int i= watermark / interval * 100, j = 0; j < 10; i+= (watermark / interval * 10), j++) { for (int i = watermark / interval * 100, j = 0; j < 10; i += (watermark / interval * 10), j++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU2, 1, i * interval + 5), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU2, 1, i * interval + 5), false);
GTEST_ASSERT_EQ(pSU2->minTS, (i-(pSU2->numSBFs-1))*interval); GTEST_ASSERT_EQ(pSU2->minTS, (i - (pSU2->numSBFs - 1)) * interval);
GTEST_ASSERT_EQ(pSU2->numSBFs, watermark / interval); GTEST_ASSERT_EQ(pSU2->numSBFs, watermark / interval);
TSKEY uid2 = 1; TSKEY uid2 = 1;
GTEST_ASSERT_EQ(*(TSKEY*)taosHashGet(pSU2->pMap, &uid2, sizeof(uint64_t)), i * interval + 5); GTEST_ASSERT_EQ(*(TSKEY *)taosHashGet(pSU2->pMap, &uid2, sizeof(uint64_t)), i * interval + 5);
} }
SUpdateInfo *pSU3 = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark); SUpdateInfo *pSU3 = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark);
for(int j = 1; j < 100; j++) { for (int j = 1; j < 100; j++) {
for(int i = 0; i < pSU3->numSBFs; i++) { for (int i = 0; i < pSU3->numSBFs; i++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU3, i, i * interval + 5 * j), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU3, i, i * interval + 5 * j), false);
GTEST_ASSERT_EQ(pSU3->minTS, 0); GTEST_ASSERT_EQ(pSU3->minTS, 0);
GTEST_ASSERT_EQ(pSU3->numSBFs, watermark / interval); GTEST_ASSERT_EQ(pSU3->numSBFs, watermark / interval);
uint64_t uid3 = i; uint64_t uid3 = i;
GTEST_ASSERT_EQ(*(TSKEY*)taosHashGet(pSU3->pMap, &uid3, sizeof(uint64_t)), i * interval + 5 * j); GTEST_ASSERT_EQ(*(TSKEY *)taosHashGet(pSU3->pMap, &uid3, sizeof(uint64_t)), i * interval + 5 * j);
SScalableBf *pSBF = (SScalableBf *)taosArrayGetP(pSU3->pTsSBFs, i); SScalableBf *pSBF = (SScalableBf *)taosArrayGetP(pSU3->pTsSBFs, i);
SBloomFilter *pBF = (SBloomFilter *)taosArrayGetP(pSBF->bfArray, 0); SBloomFilter *pBF = (SBloomFilter *)taosArrayGetP(pSBF->bfArray, 0);
GTEST_ASSERT_EQ(pBF->size, j); GTEST_ASSERT_EQ(pBF->size, j);
} }
...@@ -130,19 +130,19 @@ TEST(TD_STREAM_UPDATE_TEST, update) { ...@@ -130,19 +130,19 @@ TEST(TD_STREAM_UPDATE_TEST, update) {
SUpdateInfo *pSU7 = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark); SUpdateInfo *pSU7 = updateInfoInit(interval, TSDB_TIME_PRECISION_MILLI, watermark);
updateInfoAddCloseWindowSBF(pSU7); updateInfoAddCloseWindowSBF(pSU7);
for(int64_t i = 1; i < 2048000; i++) { for (int64_t i = 1; i < 2048000; i++) {
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU7,i, i), false); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU7, i, i), false);
} }
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU7,100, 1), true); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU7, 100, 1), true);
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU7,110, 10), true); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU7, 110, 10), true);
GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU7,200, 20), true); GTEST_ASSERT_EQ(updateInfoIsUpdated(pSU7, 200, 20), true);
int32_t bufLen = updateInfoSerialize(NULL, 0, pSU7); int32_t bufLen = updateInfoSerialize(NULL, 0, pSU7);
void* buf = taosMemoryCalloc(1, bufLen); void *buf = taosMemoryCalloc(1, bufLen);
int32_t resSize = updateInfoSerialize(buf, bufLen, pSU7); int32_t resSize = updateInfoSerialize(buf, bufLen, pSU7);
SUpdateInfo *pSU6 = updateInfoInit(0, TSDB_TIME_PRECISION_MILLI, 0); SUpdateInfo *pSU6 = updateInfoInit(0, TSDB_TIME_PRECISION_MILLI, 0);
int32_t desSize = updateInfoDeserialize(buf, bufLen, pSU6); int32_t desSize = updateInfoDeserialize(buf, bufLen, pSU6);
GTEST_ASSERT_EQ(desSize, 0); GTEST_ASSERT_EQ(desSize, 0);
GTEST_ASSERT_EQ(pSU7->interval, pSU6->interval); GTEST_ASSERT_EQ(pSU7->interval, pSU6->interval);
...@@ -150,7 +150,7 @@ TEST(TD_STREAM_UPDATE_TEST, update) { ...@@ -150,7 +150,7 @@ TEST(TD_STREAM_UPDATE_TEST, update) {
GTEST_ASSERT_EQ(pSU7->minTS, pSU6->minTS); GTEST_ASSERT_EQ(pSU7->minTS, pSU6->minTS);
GTEST_ASSERT_EQ(pSU7->numBuckets, pSU6->numBuckets); GTEST_ASSERT_EQ(pSU7->numBuckets, pSU6->numBuckets);
GTEST_ASSERT_EQ(pSU7->numSBFs, pSU6->numSBFs); GTEST_ASSERT_EQ(pSU7->numSBFs, pSU6->numSBFs);
GTEST_ASSERT_EQ(pSU7->scanGroupId, pSU6->scanGroupId); GTEST_ASSERT_EQ(pSU7->scanGroupId, pSU6->scanGroupId);
GTEST_ASSERT_EQ(pSU7->scanWindow.ekey, pSU6->scanWindow.ekey); GTEST_ASSERT_EQ(pSU7->scanWindow.ekey, pSU6->scanWindow.ekey);
GTEST_ASSERT_EQ(pSU7->scanWindow.skey, pSU6->scanWindow.skey); GTEST_ASSERT_EQ(pSU7->scanWindow.skey, pSU6->scanWindow.skey);
GTEST_ASSERT_EQ(pSU7->watermark, pSU6->watermark); GTEST_ASSERT_EQ(pSU7->watermark, pSU6->watermark);
...@@ -158,27 +158,27 @@ TEST(TD_STREAM_UPDATE_TEST, update) { ...@@ -158,27 +158,27 @@ TEST(TD_STREAM_UPDATE_TEST, update) {
int32_t mapSize = taosHashGetSize(pSU7->pMap); int32_t mapSize = taosHashGetSize(pSU7->pMap);
GTEST_ASSERT_EQ(mapSize, taosHashGetSize(pSU6->pMap)); GTEST_ASSERT_EQ(mapSize, taosHashGetSize(pSU6->pMap));
void* pIte = NULL; void *pIte = NULL;
size_t keyLen = 0; size_t keyLen = 0;
while ((pIte = taosHashIterate(pSU7->pMap, pIte)) != NULL) { while ((pIte = taosHashIterate(pSU7->pMap, pIte)) != NULL) {
void* key = taosHashGetKey(pIte, &keyLen); void *key = taosHashGetKey(pIte, &keyLen);
void* value6 = taosHashGet(pSU6->pMap, key, keyLen); void *value6 = taosHashGet(pSU6->pMap, key, keyLen);
GTEST_ASSERT_EQ(*(TSKEY*)pIte, *(TSKEY*)value6); GTEST_ASSERT_EQ(*(TSKEY *)pIte, *(TSKEY *)value6);
} }
int32_t buSize = taosArrayGetSize(pSU7->pTsBuckets); int32_t buSize = taosArrayGetSize(pSU7->pTsBuckets);
GTEST_ASSERT_EQ(buSize, taosArrayGetSize(pSU6->pTsBuckets)); GTEST_ASSERT_EQ(buSize, taosArrayGetSize(pSU6->pTsBuckets));
for (int32_t i = 0; i < buSize; i++) { for (int32_t i = 0; i < buSize; i++) {
TSKEY ts1 = *(TSKEY*)taosArrayGet(pSU7->pTsBuckets, i); TSKEY ts1 = *(TSKEY *)taosArrayGet(pSU7->pTsBuckets, i);
TSKEY ts2 = *(TSKEY*)taosArrayGet(pSU6->pTsBuckets, i); TSKEY ts2 = *(TSKEY *)taosArrayGet(pSU6->pTsBuckets, i);
GTEST_ASSERT_EQ(ts1, ts2); GTEST_ASSERT_EQ(ts1, ts2);
} }
int32_t lSize = taosArrayGetSize(pSU7->pTsSBFs); int32_t lSize = taosArrayGetSize(pSU7->pTsSBFs);
int32_t rSize = taosArrayGetSize(pSU6->pTsSBFs); int32_t rSize = taosArrayGetSize(pSU6->pTsSBFs);
GTEST_ASSERT_EQ(lSize, rSize); GTEST_ASSERT_EQ(lSize, rSize);
for (int32_t i = 0; i < lSize; i++) { for (int32_t i = 0; i < lSize; i++) {
SScalableBf* pLeftSBF = (SScalableBf*)taosArrayGetP(pSU7->pTsSBFs, i); SScalableBf *pLeftSBF = (SScalableBf *)taosArrayGetP(pSU7->pTsSBFs, i);
SScalableBf* pRightSBF = (SScalableBf*)taosArrayGetP(pSU6->pTsSBFs, i); SScalableBf *pRightSBF = (SScalableBf *)taosArrayGetP(pSU6->pTsSBFs, i);
GTEST_ASSERT_EQ(equalSBF(pLeftSBF, pRightSBF), true); GTEST_ASSERT_EQ(equalSBF(pLeftSBF, pRightSBF), true);
} }
...@@ -190,10 +190,9 @@ TEST(TD_STREAM_UPDATE_TEST, update) { ...@@ -190,10 +190,9 @@ TEST(TD_STREAM_UPDATE_TEST, update) {
updateInfoDestroy(pSU5); updateInfoDestroy(pSU5);
updateInfoDestroy(pSU6); updateInfoDestroy(pSU6);
updateInfoDestroy(pSU7); updateInfoDestroy(pSU7);
} }
int main(int argc, char* argv[]) { int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }
\ No newline at end of file
...@@ -99,7 +99,7 @@ class Client { ...@@ -99,7 +99,7 @@ class Client {
private: private:
tsem_t sem; tsem_t sem;
SRpcInit rpcInit_; SRpcInit rpcInit_;
void * transCli; void *transCli;
SRpcMsg resp; SRpcMsg resp;
}; };
class Server { class Server {
...@@ -146,7 +146,7 @@ class Server { ...@@ -146,7 +146,7 @@ class Server {
private: private:
SRpcInit rpcInit_; SRpcInit rpcInit_;
void * transSrv; void *transSrv;
}; };
static void processReq(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { static void processReq(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
SRpcMsg rpcMsg = {0}; SRpcMsg rpcMsg = {0};
...@@ -330,7 +330,7 @@ TEST_F(TransEnv, clientUserDefined) { ...@@ -330,7 +330,7 @@ TEST_F(TransEnv, clientUserDefined) {
TEST_F(TransEnv, cliPersistHandle) { TEST_F(TransEnv, cliPersistHandle) {
SRpcMsg resp = {0}; SRpcMsg resp = {0};
void * handle = NULL; void *handle = NULL;
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
SRpcMsg req = {0}; SRpcMsg req = {0};
req.info = resp.info; req.info = resp.info;
...@@ -366,7 +366,7 @@ TEST_F(TransEnv, srvReleaseHandle) { ...@@ -366,7 +366,7 @@ TEST_F(TransEnv, srvReleaseHandle) {
SRpcMsg resp = {0}; SRpcMsg resp = {0};
tr->SetSrvContinueSend(processReleaseHandleCb); tr->SetSrvContinueSend(processReleaseHandleCb);
// tr->Restart(processReleaseHandleCb); // tr->Restart(processReleaseHandleCb);
void * handle = NULL; void *handle = NULL;
SRpcMsg req = {0}; SRpcMsg req = {0};
for (int i = 0; i < 1; i++) { for (int i = 0; i < 1; i++) {
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
......
...@@ -11,23 +11,23 @@ ...@@ -11,23 +11,23 @@
typedef struct SThreadObj { typedef struct SThreadObj {
TdThread thread; TdThread thread;
uv_pipe_t * pipe; uv_pipe_t *pipe;
uv_loop_t * loop; uv_loop_t *loop;
uv_async_t *workerAsync; // uv_async_t *workerAsync; //
int fd; int fd;
} SThreadObj; } SThreadObj;
typedef struct SServerObj { typedef struct SServerObj {
uv_tcp_t server; uv_tcp_t server;
uv_loop_t * loop; uv_loop_t *loop;
int workerIdx; int workerIdx;
int numOfThread; int numOfThread;
SThreadObj **pThreadObj; SThreadObj **pThreadObj;
uv_pipe_t ** pipe; uv_pipe_t **pipe;
} SServerObj; } SServerObj;
typedef struct SConnCtx { typedef struct SConnCtx {
uv_tcp_t * pClient; uv_tcp_t *pClient;
uv_timer_t *pTimer; uv_timer_t *pTimer;
uv_async_t *pWorkerAsync; uv_async_t *pWorkerAsync;
int ref; int ref;
......
...@@ -8,35 +8,42 @@ ORIGIN_DIR=$(pwd) ...@@ -8,35 +8,42 @@ ORIGIN_DIR=$(pwd)
cd ${PRJ_ROOT_DIR} cd ${PRJ_ROOT_DIR}
FORMAT_DIR_LIST=( FORMAT_DIR_LIST=(
"include" "${PRJ_ROOT_DIR}/include"
"source/os" "${PRJ_ROOT_DIR}/source/os"
"source/util" "${PRJ_ROOT_DIR}/source/util"
"source/common" "${PRJ_ROOT_DIR}/source/common"
"source/libs/cache" "${PRJ_ROOT_DIR}/source/libs/cache"
"source/libs/catalog" "${PRJ_ROOT_DIR}/source/libs/catalog"
"source/libs/command" "${PRJ_ROOT_DIR}/source/libs/command"
"source/libs/executor" "${PRJ_ROOT_DIR}/source/libs/executor"
# "source/libs/function" # "${PRJ_ROOT_DIR}/source/libs/function"
# "source/libs/index" "${PRJ_ROOT_DIR}/source/libs/index"
# "source/libs/monitor" "${PRJ_ROOT_DIR}/source/libs/monitor"
# "source/libs/nodes" "${PRJ_ROOT_DIR}/source/libs/nodes"
# "source/libs/parser" # "${PRJ_ROOT_DIR}/source/libs/parser"
# "source/libs/planner" "${PRJ_ROOT_DIR}/source/libs/planner"
# "source/libs/qcom" # "${PRJ_ROOT_DIR}/source/libs/qcom"
# "source/libs/qworker" # "${PRJ_ROOT_DIR}/source/libs/qworker"
# "source/libs/scalar" # "${PRJ_ROOT_DIR}/source/libs/scalar"
# "source/libs/stream" "${PRJ_ROOT_DIR}/source/libs/stream"
# "source/libs/sync" # "${PRJ_ROOT_DIR}/source/libs/sync"
"source/libs/tdb" "${PRJ_ROOT_DIR}/source/libs/tdb"
"source/libs/tfs" "${PRJ_ROOT_DIR}/source/libs/tfs"
# "source/libs/transport" "${PRJ_ROOT_DIR}/source/libs/transport"
"source/libs/wal" "${PRJ_ROOT_DIR}/source/libs/wal"
# "source/client" # "${PRJ_ROOT_DIR}/source/client"
"source/dnode" "${PRJ_ROOT_DIR}/source/dnode"
)
EXCLUDE_DIR_LIST=(
)
EXCLUDE_FILE_LIST=(
"source/libs/parser/sql.c"
) )
for d in ${FORMAT_DIR_LIST[@]}; do for d in ${FORMAT_DIR_LIST[@]}; do
for f in $(find ${PRJ_ROOT_DIR}/$d/ -regex '.*\.\(cpp\|hpp\|c\|h\)'); do for f in $(find $d -regex '.*\.\(cpp\|hpp\|c\|h\)'); do
${FORMAT_BIN} -i $f ${FORMAT_BIN} -i $f
done done
done done
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册