Merge branch 'main' of https://github.com/taosdata/TDengine into main
This commit is contained in:
commit
2527769f36
|
@ -117,12 +117,18 @@ ELSE ()
|
||||||
IF (${BUILD_SANITIZER})
|
IF (${BUILD_SANITIZER})
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=shift-base -fno-sanitize=alignment -g3 -Wformat=0")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=shift-base -fno-sanitize=alignment -g3 -Wformat=0")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=shift-base -fno-sanitize=alignment -g3 -Wformat=0")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=shift-base -fno-sanitize=alignment -g3 -Wformat=0")
|
||||||
MESSAGE(STATUS "Will compile with Address Sanitizer!")
|
MESSAGE(STATUS "Compile with Address Sanitizer!")
|
||||||
ELSE ()
|
ELSE ()
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
# disable all assert
|
||||||
|
IF ((${DISABLE_ASSERT} MATCHES "true") OR (${DISABLE_ASSERTS} MATCHES "true"))
|
||||||
|
ADD_DEFINITIONS(-DDISABLE_ASSERT)
|
||||||
|
MESSAGE(STATUS "Disable all asserts")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
INCLUDE(CheckCCompilerFlag)
|
INCLUDE(CheckCCompilerFlag)
|
||||||
IF (TD_ARM_64 OR TD_ARM_32)
|
IF (TD_ARM_64 OR TD_ARM_32)
|
||||||
SET(COMPILER_SUPPORT_SSE42 false)
|
SET(COMPILER_SUPPORT_SSE42 false)
|
||||||
|
@ -155,7 +161,7 @@ ELSE ()
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
MESSAGE(STATUS "SIMD instructions (AVX/AVX2) is ACTIVATED")
|
MESSAGE(STATUS "SIMD instructions (FMA/AVX/AVX2) is ACTIVATED")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
|
@ -85,12 +85,19 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons
|
||||||
|
|
||||||
bool taosAssertDebug(bool condition, const char *file, int32_t line, const char *format, ...);
|
bool taosAssertDebug(bool condition, const char *file, int32_t line, const char *format, ...);
|
||||||
bool taosAssertRelease(bool condition);
|
bool taosAssertRelease(bool condition);
|
||||||
|
|
||||||
|
// Disable all asserts that may compromise the performance.
|
||||||
|
#if defined DISABLE_ASSERT
|
||||||
|
#define ASSERT(condition)
|
||||||
|
#define ASSERTS(condition, ...)
|
||||||
|
#else
|
||||||
#define ASSERTS(condition, ...) taosAssertDebug(condition, __FILE__, __LINE__, __VA_ARGS__)
|
#define ASSERTS(condition, ...) taosAssertDebug(condition, __FILE__, __LINE__, __VA_ARGS__)
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define ASSERT(condition) taosAssertRelease(condition)
|
#define ASSERT(condition) taosAssertRelease(condition)
|
||||||
#else
|
#else
|
||||||
#define ASSERT(condition) taosAssertDebug(condition, __FILE__, __LINE__, "assert info not provided")
|
#define ASSERT(condition) taosAssertDebug(condition, __FILE__, __LINE__, "assert info not provided")
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||||
|
|
|
@ -41,6 +41,7 @@ typedef struct SDataInserterHandle {
|
||||||
SHashObj* pCols;
|
SHashObj* pCols;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
bool queryEnd;
|
bool queryEnd;
|
||||||
|
bool fullOrderColList;
|
||||||
uint64_t useconds;
|
uint64_t useconds;
|
||||||
uint64_t cachedSize;
|
uint64_t cachedSize;
|
||||||
TdThreadMutex mutex;
|
TdThreadMutex mutex;
|
||||||
|
@ -125,7 +126,6 @@ int32_t dataBlockToSubmit(SDataInserterHandle* pInserter, SSubmitReq** pReq) {
|
||||||
int64_t uid = pInserter->pNode->tableId;
|
int64_t uid = pInserter->pNode->tableId;
|
||||||
int64_t suid = pInserter->pNode->stableId;
|
int64_t suid = pInserter->pNode->stableId;
|
||||||
int32_t vgId = pInserter->pNode->vgId;
|
int32_t vgId = pInserter->pNode->vgId;
|
||||||
bool fullCol = (pInserter->pNode->pCols->length == pTSchema->numOfCols);
|
|
||||||
|
|
||||||
SSubmitReq* ret = NULL;
|
SSubmitReq* ret = NULL;
|
||||||
int32_t sz = taosArrayGetSize(pBlocks);
|
int32_t sz = taosArrayGetSize(pBlocks);
|
||||||
|
@ -176,7 +176,7 @@ int32_t dataBlockToSubmit(SDataInserterHandle* pInserter, SSubmitReq** pReq) {
|
||||||
const STColumn* pColumn = &pTSchema->columns[k];
|
const STColumn* pColumn = &pTSchema->columns[k];
|
||||||
SColumnInfoData* pColData = NULL;
|
SColumnInfoData* pColData = NULL;
|
||||||
int16_t colIdx = k;
|
int16_t colIdx = k;
|
||||||
if (!fullCol) {
|
if (!pInserter->fullOrderColList) {
|
||||||
int16_t* slotId = taosHashGet(pInserter->pCols, &pColumn->colId, sizeof(pColumn->colId));
|
int16_t* slotId = taosHashGet(pInserter->pCols, &pColumn->colId, sizeof(pColumn->colId));
|
||||||
if (NULL == slotId) {
|
if (NULL == slotId) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -212,7 +212,7 @@ int32_t dataBlockToSubmit(SDataInserterHandle* pInserter, SSubmitReq** pReq) {
|
||||||
tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NORM, data, true, pColumn->offset, k);
|
tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NORM, data, true, pColumn->offset, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fullCol) {
|
if (!pInserter->fullOrderColList) {
|
||||||
rb.hasNone = true;
|
rb.hasNone = true;
|
||||||
}
|
}
|
||||||
tdSRowEnd(&rb);
|
tdSRowEnd(&rb);
|
||||||
|
@ -346,12 +346,19 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inserter->fullOrderColList = pInserterNode->pCols->length == inserter->pSchema->numOfCols;
|
||||||
|
|
||||||
inserter->pCols = taosHashInit(pInserterNode->pCols->length, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT),
|
inserter->pCols = taosHashInit(pInserterNode->pCols->length, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT),
|
||||||
false, HASH_NO_LOCK);
|
false, HASH_NO_LOCK);
|
||||||
SNode* pNode = NULL;
|
SNode* pNode = NULL;
|
||||||
|
int32_t i = 0;
|
||||||
FOREACH(pNode, pInserterNode->pCols) {
|
FOREACH(pNode, pInserterNode->pCols) {
|
||||||
SColumnNode* pCol = (SColumnNode*)pNode;
|
SColumnNode* pCol = (SColumnNode*)pNode;
|
||||||
taosHashPut(inserter->pCols, &pCol->colId, sizeof(pCol->colId), &pCol->slotId, sizeof(pCol->slotId));
|
taosHashPut(inserter->pCols, &pCol->colId, sizeof(pCol->colId), &pCol->slotId, sizeof(pCol->slotId));
|
||||||
|
if (inserter->fullOrderColList && pCol->colId != inserter->pSchema->columns[i].colId) {
|
||||||
|
inserter->fullOrderColList = false;
|
||||||
|
}
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
tsem_init(&inserter->ready, 0, 0);
|
tsem_init(&inserter->ready, 0, 0);
|
||||||
|
|
|
@ -273,42 +273,90 @@ int32_t tsDecompressINTImp(const char *const input, const int32_t nelements, cha
|
||||||
char bit = bit_per_integer[(int32_t)selector]; // bit = 3
|
char bit = bit_per_integer[(int32_t)selector]; // bit = 3
|
||||||
int32_t elems = selector_to_elems[(int32_t)selector];
|
int32_t elems = selector_to_elems[(int32_t)selector];
|
||||||
|
|
||||||
for (int32_t i = 0; i < elems; i++) {
|
// Optimize the performance, by remove the constantly switch operation.
|
||||||
|
int32_t v = 0;
|
||||||
uint64_t zigzag_value;
|
uint64_t zigzag_value;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case TSDB_DATA_TYPE_BIGINT: {
|
||||||
|
for (int32_t i = 0; i < elems; i++) {
|
||||||
if (selector == 0 || selector == 1) {
|
if (selector == 0 || selector == 1) {
|
||||||
zigzag_value = 0;
|
zigzag_value = 0;
|
||||||
} else {
|
} else {
|
||||||
zigzag_value = ((w >> (4 + bit * i)) & INT64MASK(bit));
|
zigzag_value = ((w >> (4 + v)) & INT64MASK(bit));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value);
|
int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value);
|
||||||
int64_t curr_value = diff + prev_value;
|
int64_t curr_value = diff + prev_value;
|
||||||
prev_value = curr_value;
|
prev_value = curr_value;
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
|
||||||
*((int64_t *)output + _pos) = (int64_t)curr_value;
|
*((int64_t *)output + _pos) = (int64_t)curr_value;
|
||||||
_pos++;
|
_pos++;
|
||||||
break;
|
|
||||||
case TSDB_DATA_TYPE_INT:
|
v += bit;
|
||||||
|
if ((++count) == nelements) break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case TSDB_DATA_TYPE_INT: {
|
||||||
|
for (int32_t i = 0; i < elems; i++) {
|
||||||
|
if (selector == 0 || selector == 1) {
|
||||||
|
zigzag_value = 0;
|
||||||
|
} else {
|
||||||
|
zigzag_value = ((w >> (4 + v)) & INT64MASK(bit));
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value);
|
||||||
|
int64_t curr_value = diff + prev_value;
|
||||||
|
prev_value = curr_value;
|
||||||
|
|
||||||
*((int32_t *)output + _pos) = (int32_t)curr_value;
|
*((int32_t *)output + _pos) = (int32_t)curr_value;
|
||||||
_pos++;
|
_pos++;
|
||||||
break;
|
|
||||||
case TSDB_DATA_TYPE_SMALLINT:
|
v += bit;
|
||||||
|
if ((++count) == nelements) break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case TSDB_DATA_TYPE_SMALLINT: {
|
||||||
|
for (int32_t i = 0; i < elems; i++) {
|
||||||
|
if (selector == 0 || selector == 1) {
|
||||||
|
zigzag_value = 0;
|
||||||
|
} else {
|
||||||
|
zigzag_value = ((w >> (4 + v)) & INT64MASK(bit));
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value);
|
||||||
|
int64_t curr_value = diff + prev_value;
|
||||||
|
prev_value = curr_value;
|
||||||
|
|
||||||
*((int16_t *)output + _pos) = (int16_t)curr_value;
|
*((int16_t *)output + _pos) = (int16_t)curr_value;
|
||||||
_pos++;
|
_pos++;
|
||||||
break;
|
|
||||||
case TSDB_DATA_TYPE_TINYINT:
|
v += bit;
|
||||||
|
if ((++count) == nelements) break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case TSDB_DATA_TYPE_TINYINT: {
|
||||||
|
for (int32_t i = 0; i < elems; i++) {
|
||||||
|
if (selector == 0 || selector == 1) {
|
||||||
|
zigzag_value = 0;
|
||||||
|
} else {
|
||||||
|
zigzag_value = ((w >> (4 + v)) & INT64MASK(bit));
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value);
|
||||||
|
int64_t curr_value = diff + prev_value;
|
||||||
|
prev_value = curr_value;
|
||||||
|
|
||||||
*((int8_t *)output + _pos) = (int8_t)curr_value;
|
*((int8_t *)output + _pos) = (int8_t)curr_value;
|
||||||
_pos++;
|
_pos++;
|
||||||
break;
|
|
||||||
default:
|
v += bit;
|
||||||
perror("Wrong integer types.\n");
|
if ((++count) == nelements) break;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
count++;
|
} break;
|
||||||
if (count == nelements) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ip += LONG_BYTES;
|
ip += LONG_BYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,7 +806,7 @@ int32_t tsDecompressDoubleImp(const char *const input, const int32_t nelements,
|
||||||
uint64_t prev_value = 0;
|
uint64_t prev_value = 0;
|
||||||
|
|
||||||
for (int32_t i = 0; i < nelements; i++) {
|
for (int32_t i = 0; i < nelements; i++) {
|
||||||
if (i % 2 == 0) {
|
if ((i & 0x01) == 0) {
|
||||||
flags = input[ipos++];
|
flags = input[ipos++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,4 +42,24 @@ if $rows != 2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
print ======== step2
|
||||||
|
sql drop database if exists db1;
|
||||||
|
sql create database db1 vgroups 1;
|
||||||
|
sql use db1;
|
||||||
|
sql create table t1(ts timestamp, a int, b int );
|
||||||
|
sql create table t2(ts timestamp, a int, b int );
|
||||||
|
sql insert into t1 values(1648791211000,1,2);
|
||||||
|
sql insert into t2 (ts, b, a) select ts, a, b from t1;
|
||||||
|
sql select * from t2;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data01 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data02 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
|
Loading…
Reference in New Issue