refactor code
This commit is contained in:
parent
2d6c9ec7de
commit
3ccf9942a9
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
# xz
|
||||||
|
ExternalProject_Add(xz
|
||||||
|
GIT_REPOSITORY https://github.com/xz-mirror/xz.git
|
||||||
|
GIT_TAG v5.4.4
|
||||||
|
SOURCE_DIR "${TD_CONTRIB_DIR}/xz"
|
||||||
|
BINARY_DIR ""
|
||||||
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ""
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
TEST_COMMAND ""
|
||||||
|
)
|
|
@ -109,7 +109,8 @@ cat("${TD_SUPPORT_DIR}/zlib_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||||
# cJson
|
# cJson
|
||||||
cat("${TD_SUPPORT_DIR}/cjson_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
cat("${TD_SUPPORT_DIR}/cjson_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||||
|
|
||||||
# zstd
|
# xz
|
||||||
|
cat("${TD_SUPPORT_DIR}/xz_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||||
|
|
||||||
if (${BUILD_CONTRIB})
|
if (${BUILD_CONTRIB})
|
||||||
if(${BUILD_WITH_ROCKSDB})
|
if(${BUILD_WITH_ROCKSDB})
|
||||||
|
@ -258,6 +259,13 @@ target_include_directories(
|
||||||
)
|
)
|
||||||
unset(CMAKE_PROJECT_INCLUDE_BEFORE)
|
unset(CMAKE_PROJECT_INCLUDE_BEFORE)
|
||||||
|
|
||||||
|
add_subdirectory(xz EXCLUDE_FROM_ALL)
|
||||||
|
target_include_directories(
|
||||||
|
xz
|
||||||
|
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/xz
|
||||||
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xz
|
||||||
|
)
|
||||||
|
|
||||||
# leveldb
|
# leveldb
|
||||||
if(${BUILD_WITH_LEVELDB})
|
if(${BUILD_WITH_LEVELDB})
|
||||||
option(LEVELDB_BUILD_TESTS "" OFF)
|
option(LEVELDB_BUILD_TESTS "" OFF)
|
||||||
|
@ -392,7 +400,6 @@ endif()
|
||||||
if(${BUILD_WITH_S3})
|
if(${BUILD_WITH_S3})
|
||||||
INCLUDE_DIRECTORIES($ENV{HOME}/.cos-local.2/include)
|
INCLUDE_DIRECTORIES($ENV{HOME}/.cos-local.2/include)
|
||||||
MESSAGE("build with s3: ${BUILD_WITH_S3}")
|
MESSAGE("build with s3: ${BUILD_WITH_S3}")
|
||||||
|
|
||||||
# cos
|
# cos
|
||||||
elseif(${BUILD_WITH_COS})
|
elseif(${BUILD_WITH_COS})
|
||||||
if(${TD_LINUX})
|
if(${TD_LINUX})
|
||||||
|
@ -432,8 +439,6 @@ if(${BUILD_PTHREAD})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
#target_link_libraries(zstd)
|
|
||||||
#target_include_directories()
|
|
||||||
# jemalloc
|
# jemalloc
|
||||||
if(${JEMALLOC_ENABLED})
|
if(${JEMALLOC_ENABLED})
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
|
|
@ -232,16 +232,17 @@ typedef int32_t (*__data_decompress_l2_fn_t)(const char *const input, const int3
|
||||||
int32_t outputSize, const char type);
|
int32_t outputSize, const char type);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
char *name;
|
||||||
__data_compress_init initFn;
|
__data_compress_init initFn;
|
||||||
__data_compress_l1_fn_t comprFn;
|
__data_compress_l1_fn_t comprFn;
|
||||||
__data_decompress_l1_fn_t decomprFn;
|
__data_decompress_l1_fn_t decomprFn;
|
||||||
} TCompressL1FnSet;
|
} TCompressL1FnSet;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
char *name;
|
||||||
__data_compress_init initFn;
|
__data_compress_init initFn;
|
||||||
__data_compress_l2_fn_t comprFn;
|
__data_compress_l2_fn_t comprFn;
|
||||||
__data_decompress_l2_fn_t decomprFn;
|
__data_decompress_l2_fn_t decomprFn;
|
||||||
|
|
||||||
} TCompressL2FnSet;
|
} TCompressL2FnSet;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -2546,6 +2546,7 @@ int32_t metaGetColCmpr(SMeta *pMeta, tb_uid_t uid, SHashObj **ppColCmprObj) {
|
||||||
rc = metaDecodeEntry(&dc, &e);
|
rc = metaDecodeEntry(&dc, &e);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
|
tdbFree(pData);
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
taosHashClear(pColCmprObj);
|
taosHashClear(pColCmprObj);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -2557,6 +2558,8 @@ int32_t metaGetColCmpr(SMeta *pMeta, tb_uid_t uid, SHashObj **ppColCmprObj) {
|
||||||
taosHashPut(pColCmprObj, &pCmpr->id, sizeof(pCmpr->id), &pCmpr->alg, sizeof(pCmpr->alg));
|
taosHashPut(pColCmprObj, &pCmpr->id, sizeof(pCmpr->id), &pCmpr->alg, sizeof(pCmpr->alg));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
tDecoderClear(&dc);
|
||||||
|
tdbFree(pData);
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
taosHashClear(pColCmprObj);
|
taosHashClear(pColCmprObj);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -24,8 +24,8 @@ target_include_directories(
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
util
|
util
|
||||||
PUBLIC os
|
PUBLIC os
|
||||||
PUBLIC lz4_static
|
PUBLIC lz4_static
|
||||||
PUBLIC api cjson geos_c TSZ
|
PUBLIC api cjson geos_c TSZ
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${BUILD_TEST})
|
if(${BUILD_TEST})
|
||||||
|
|
|
@ -246,18 +246,19 @@ int32_t l2DecompressImpl_xz(const char *const input, const int32_t nelements, ch
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TCompressL1FnSet compressL1Dict[] = {{NULL, NULL, NULL},
|
TCompressL1FnSet compressL1Dict[] = {{"distabled", NULL, NULL, NULL},
|
||||||
{NULL, tsCompressTimestampImp2, tsDecompressTimestampImp2},
|
{"timestamp", NULL, tsCompressTimestampImp2, tsDecompressTimestampImp2},
|
||||||
{NULL, tsCompressINTImp2, tsDecompressINTImp2},
|
{"int", NULL, tsCompressINTImp2, tsDecompressINTImp2},
|
||||||
{NULL, tsCompressDoubleImp2, tsDecompressDoubleImp2},
|
{"double", NULL, tsCompressDoubleImp2, tsDecompressDoubleImp2},
|
||||||
{NULL, tsCompressBoolImp2, tsDecompressBoolImp2},
|
{"bool", NULL, tsCompressBoolImp2, tsDecompressBoolImp2},
|
||||||
{NULL, NULL, NULL}};
|
{NULL, NULL, NULL}};
|
||||||
TCompressL2FnSet compressL2Dict[] = {{l2ComressInitImpl_disabled, l2CompressImpl_disabled, l2DecompressImpl_disabled},
|
TCompressL2FnSet compressL2Dict[] = {
|
||||||
{l2ComressInitImpl_lz4, l2CompressImpl_lz4, l2DecompressImpl_lz4},
|
{"disabled", l2ComressInitImpl_disabled, l2CompressImpl_disabled, l2DecompressImpl_disabled},
|
||||||
{l2ComressInitImpl_zlib, l2CompressImpl_zlib, l2DecompressImpl_zlib},
|
{"lz4", l2ComressInitImpl_lz4, l2CompressImpl_lz4, l2DecompressImpl_lz4},
|
||||||
{l2ComressInitImpl_zstd, l2CompressImpl_zstd, l2DecompressImpl_zstd},
|
{"zlib", l2ComressInitImpl_zlib, l2CompressImpl_zlib, l2DecompressImpl_zlib},
|
||||||
{l2ComressInitImpl_tsz, l2CompressImpl_tsz, l2DecompressImpl_tsz},
|
{"zstd", l2ComressInitImpl_zstd, l2CompressImpl_zstd, l2DecompressImpl_zstd},
|
||||||
{l2ComressInitImpl_xz, l2CompressImpl_xz, l2DecompressImpl_xz}};
|
{"tsz", l2ComressInitImpl_tsz, l2CompressImpl_tsz, l2DecompressImpl_tsz},
|
||||||
|
{"xz", l2ComressInitImpl_xz, l2CompressImpl_xz, l2DecompressImpl_xz}};
|
||||||
|
|
||||||
static const int32_t TEST_NUMBER = 1;
|
static const int32_t TEST_NUMBER = 1;
|
||||||
#define is_bigendian() ((*(char *)&TEST_NUMBER) == 0)
|
#define is_bigendian() ((*(char *)&TEST_NUMBER) == 0)
|
||||||
|
|
Loading…
Reference in New Issue