diff --git a/.gitmodules b/.gitmodules index 346f5c0069..a2266c46af 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "deps/jemalloc"] path = deps/jemalloc url = https://github.com/jemalloc/jemalloc +[submodule "deps/TSZ"] + path = deps/TSZ + url = https://github.com/taosdata/TSZ.git diff --git a/cmake/input.inc b/cmake/input.inc index 06a23ecb14..9d716e1e73 100755 --- a/cmake/input.inc +++ b/cmake/input.inc @@ -91,3 +91,12 @@ SET(TD_MEMORY_SANITIZER FALSE) IF (${MEMORY_SANITIZER} MATCHES "true") SET(TD_MEMORY_SANITIZER TRUE) ENDIF () + +IF (${TSZ_ENABLED} MATCHES "true") + # define add + MESSAGE(STATUS "build with TSZ enabled") + ADD_DEFINITIONS(-DTD_TSZ) + set(VAR_TSZ "TSZ" CACHE INTERNAL "global variant tsz" ) +ELSE() + set(VAR_TSZ "" CACHE INTERNAL "global variant empty" ) +ENDIF() diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index eb22459d34..516c752bd1 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -15,7 +15,6 @@ ADD_SUBDIRECTORY(cJson) ADD_SUBDIRECTORY(wepoll) ADD_SUBDIRECTORY(MsvcLibX) ADD_SUBDIRECTORY(rmonotonic) - ADD_SUBDIRECTORY(lua) IF (TD_LINUX AND TD_MQTT) @@ -38,3 +37,7 @@ IF (TD_LINUX_64 AND JEMALLOC_ENABLED) BUILD_COMMAND ${MAKE} ) ENDIF () + +IF (${TSZ_ENABLED} MATCHES "true") + ADD_SUBDIRECTORY(TSZ) +ENDIF() \ No newline at end of file diff --git a/deps/TSZ b/deps/TSZ new file mode 160000 index 0000000000..0ca5b15a8e --- /dev/null +++ b/deps/TSZ @@ -0,0 +1 @@ +Subproject commit 0ca5b15a8eac40327dd737be52c926fa5675712c diff --git a/src/balance/src/bnThread.c b/src/balance/src/bnThread.c index 44cb24effa..c5dca2da85 100644 --- a/src/balance/src/bnThread.c +++ b/src/balance/src/bnThread.c @@ -23,6 +23,8 @@ static SBnThread tsBnThread; static void *bnThreadFunc(void *arg) { + setThreadName("bnThreadd"); + while (1) { pthread_mutex_lock(&tsBnThread.mutex); if (tsBnThread.stop) { diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index b84525dedb..2f83557d63 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -11,7 +11,7 @@ IF (TD_LINUX) # set the static lib name ADD_LIBRARY(taos_static STATIC ${SRC}) - TARGET_LINK_LIBRARIES(taos_static common query trpc tutil pthread m rt) + TARGET_LINK_LIBRARIES(taos_static common query trpc tutil pthread m rt ${VAR_TSZ}) SET_TARGET_PROPERTIES(taos_static PROPERTIES OUTPUT_NAME "taos_static") SET_TARGET_PROPERTIES(taos_static PROPERTIES CLEAN_DIRECT_OUTPUT 1) diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index abc3d47e0b..264070d70f 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -108,7 +108,9 @@ int32_t converToStr(char *str, int type, void *buf, int32_t bufSize, int32_t *le int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOffset, SName* name, STableMeta* pTableMeta, STableDataBlocks** dataBlocks); void tscDestroyDataBlock(STableDataBlocks* pDataBlock, bool removeMeta); +void tscSortRemoveDataBlockDupRowsRaw(STableDataBlocks* dataBuf); int tscSortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKeyInfo); +int32_t tsSetBlockInfo(SSubmitBlk *pBlocks, const STableMeta *pTableMeta, int32_t numOfRows); void tscDestroyBoundColumnInfo(SParsedDataColInfo* pColInfo); void doRetrieveSubqueryData(SSchedMsg *pMsg); diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 7da7e17374..83ec28898c 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -138,7 +138,8 @@ typedef struct STableDataBlocks { uint32_t size; STableMeta *pTableMeta; // the tableMeta of current table, the table meta will be used during submit, keep a ref to avoid to be removed from cache char *pData; - + bool cloned; + SParsedDataColInfo boundColumnInfo; // for parameter ('?') binding @@ -159,6 +160,7 @@ typedef struct SInsertStatementParam { SHashObj *pTableBlockHashList; // data block for each table SArray *pDataBlocks; // SArray. Merged submit block for each vgroup int8_t schemaAttached; // denote if submit block is built with table schema or not + uint8_t payloadType; // EPayloadType. 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert STagData tagData; // NOTE: pTagData->data is used as a variant length array int32_t batchSize; // for parameter ('?') binding and batch processing @@ -170,6 +172,14 @@ typedef struct SInsertStatementParam { char *sql; // current sql statement position } SInsertStatementParam; +typedef enum { + PAYLOAD_TYPE_KV = 0, + PAYLOAD_TYPE_RAW = 1, +} EPayloadType; + +#define IS_RAW_PAYLOAD(t) \ + (((int)(t)) == PAYLOAD_TYPE_RAW) // 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert + // TODO extract sql parser supporter typedef struct { int command; @@ -428,4 +438,4 @@ int32_t getExtendedRowSize(STableComInfo *tinfo); } #endif -#endif \ No newline at end of file +#endif diff --git a/src/client/src/taos.def b/src/client/src/taos.def index 43cd819061..7d3b8e80c2 100644 --- a/src/client/src/taos.def +++ b/src/client/src/taos.def @@ -7,11 +7,16 @@ taos_connect_auth taos_close taos_stmt_init taos_stmt_prepare +taos_stmt_set_tbname_tags +taos_stmt_set_tbname +taos_stmt_is_insert +taos_stmt_num_params taos_stmt_bind_param taos_stmt_add_batch taos_stmt_execute taos_stmt_use_result taos_stmt_close +taos_stmt_errstr taos_query taos_fetch_row taos_result_precision @@ -37,6 +42,4 @@ taos_consume taos_unsubscribe taos_open_stream taos_close_stream -taos_fetch_block taos_load_table_info - diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 87ef82bd0e..d26cbebc34 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -425,7 +425,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay case TSDB_DATA_TYPE_BOOL: { // bool if (isNullStr(pToken)) { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_BOOL), TYPE_BYTES[TSDB_DATA_TYPE_BOOL], tOffset); + getNullValue(TSDB_DATA_TYPE_BOOL), TYPE_BYTES[TSDB_DATA_TYPE_BOOL], tOffset); } else { if ((pToken->type == TK_BOOL || pToken->type == TK_STRING) && (pToken->n != 0)) { if (strncmp(pToken->z, "true", pToken->n) == 0) { @@ -459,7 +459,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay case TSDB_DATA_TYPE_TINYINT: if (isNullStr(pToken)) { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_TINYINT), TYPE_BYTES[TSDB_DATA_TYPE_TINYINT], tOffset); + getNullValue(TSDB_DATA_TYPE_TINYINT), TYPE_BYTES[TSDB_DATA_TYPE_TINYINT], tOffset); } else { ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true); if (ret != TSDB_CODE_SUCCESS) { @@ -479,7 +479,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay case TSDB_DATA_TYPE_UTINYINT: if (isNullStr(pToken)) { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_UTINYINT), TYPE_BYTES[TSDB_DATA_TYPE_UTINYINT], tOffset); + getNullValue(TSDB_DATA_TYPE_UTINYINT), TYPE_BYTES[TSDB_DATA_TYPE_UTINYINT], tOffset); } else { ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false); if (ret != TSDB_CODE_SUCCESS) { @@ -499,7 +499,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay case TSDB_DATA_TYPE_SMALLINT: if (isNullStr(pToken)) { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_SMALLINT), TYPE_BYTES[TSDB_DATA_TYPE_SMALLINT], tOffset); + getNullValue(TSDB_DATA_TYPE_SMALLINT), TYPE_BYTES[TSDB_DATA_TYPE_SMALLINT], tOffset); } else { ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true); if (ret != TSDB_CODE_SUCCESS) { @@ -520,7 +520,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay if (isNullStr(pToken)) { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_USMALLINT), TYPE_BYTES[TSDB_DATA_TYPE_USMALLINT], tOffset); + getNullValue(TSDB_DATA_TYPE_USMALLINT), TYPE_BYTES[TSDB_DATA_TYPE_USMALLINT], tOffset); } else { ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false); if (ret != TSDB_CODE_SUCCESS) { @@ -540,7 +540,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay case TSDB_DATA_TYPE_INT: if (isNullStr(pToken)) { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_INT), TYPE_BYTES[TSDB_DATA_TYPE_INT], tOffset); + getNullValue(TSDB_DATA_TYPE_INT), TYPE_BYTES[TSDB_DATA_TYPE_INT], tOffset); } else { ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true); if (ret != TSDB_CODE_SUCCESS) { @@ -560,7 +560,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay case TSDB_DATA_TYPE_UINT: if (isNullStr(pToken)) { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_UINT), TYPE_BYTES[TSDB_DATA_TYPE_UINT], tOffset); + getNullValue(TSDB_DATA_TYPE_UINT), TYPE_BYTES[TSDB_DATA_TYPE_UINT], tOffset); } else { ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false); if (ret != TSDB_CODE_SUCCESS) { @@ -580,7 +580,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay case TSDB_DATA_TYPE_BIGINT: if (isNullStr(pToken)) { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_BIGINT), TYPE_BYTES[TSDB_DATA_TYPE_BIGINT], tOffset); + getNullValue(TSDB_DATA_TYPE_BIGINT), TYPE_BYTES[TSDB_DATA_TYPE_BIGINT], tOffset); } else { ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true); if (ret != TSDB_CODE_SUCCESS) { @@ -598,7 +598,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay case TSDB_DATA_TYPE_UBIGINT: if (isNullStr(pToken)) { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_UBIGINT), TYPE_BYTES[TSDB_DATA_TYPE_UBIGINT], tOffset); + getNullValue(TSDB_DATA_TYPE_UBIGINT), TYPE_BYTES[TSDB_DATA_TYPE_UBIGINT], tOffset); } else { ret = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false); if (ret != TSDB_CODE_SUCCESS) { @@ -639,7 +639,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay case TSDB_DATA_TYPE_DOUBLE: if (isNullStr(pToken)) { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_DOUBLE), TYPE_BYTES[TSDB_DATA_TYPE_DOUBLE], tOffset); + getNullValue(TSDB_DATA_TYPE_DOUBLE), TYPE_BYTES[TSDB_DATA_TYPE_DOUBLE], tOffset); } else { double dv; if (TK_ILLEGAL == tscToDouble(pToken, &dv, &endptr)) { @@ -661,7 +661,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay if (pToken->type == TK_NULL) { payloadColSetId(payload, pSchema->colId); payloadColSetType(payload, pSchema->type); - memcpy(POINTER_SHIFT(payloadStart, tOffset), tdGetNullVal(TSDB_DATA_TYPE_BINARY), VARSTR_HEADER_SIZE + CHAR_BYTES); + memcpy(POINTER_SHIFT(payloadStart, tOffset), getNullValue(TSDB_DATA_TYPE_BINARY), VARSTR_HEADER_SIZE + CHAR_BYTES); *sizeAppend = (TDRowLenT)(VARSTR_HEADER_SIZE + CHAR_BYTES); } else { // too long values will return invalid sql, not be truncated automatically if (pToken->n + VARSTR_HEADER_SIZE > pSchema->bytes) { // todo refactor @@ -684,7 +684,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay if (pToken->type == TK_NULL) { payloadColSetId(payload, pSchema->colId); payloadColSetType(payload, pSchema->type); - memcpy(POINTER_SHIFT(payloadStart,tOffset), tdGetNullVal(TSDB_DATA_TYPE_NCHAR), VARSTR_HEADER_SIZE + TSDB_NCHAR_SIZE); + memcpy(POINTER_SHIFT(payloadStart,tOffset), getNullValue(TSDB_DATA_TYPE_NCHAR), VARSTR_HEADER_SIZE + TSDB_NCHAR_SIZE); *sizeAppend = (TDRowLenT)(VARSTR_HEADER_SIZE + TSDB_NCHAR_SIZE); } else { // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' @@ -716,7 +716,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay *kvRowColLen += (TDRowLenT)(sizeof(SColIdx) + TYPE_BYTES[TSDB_DATA_TYPE_TIMESTAMP]); } else { *sizeAppend = tsSetPayloadColValue(payloadStart, payload, pSchema->colId, pSchema->type, - tdGetNullVal(TSDB_DATA_TYPE_TIMESTAMP), + getNullValue(TSDB_DATA_TYPE_TIMESTAMP), TYPE_BYTES[TSDB_DATA_TYPE_TIMESTAMP], tOffset); } } else { @@ -1056,7 +1056,7 @@ int32_t tscAllocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize, int3 return TSDB_CODE_SUCCESS; } -int32_t tsSetBlockInfo(SSubmitBlk *pBlocks, const STableMeta *pTableMeta, int32_t numOfRows) { +int32_t FORCE_INLINE tsSetBlockInfo(SSubmitBlk *pBlocks, const STableMeta *pTableMeta, int32_t numOfRows) { pBlocks->tid = pTableMeta->id.tid; pBlocks->uid = pTableMeta->id.uid; pBlocks->sversion = pTableMeta->sversion; @@ -1069,9 +1069,8 @@ int32_t tsSetBlockInfo(SSubmitBlk *pBlocks, const STableMeta *pTableMeta, int32_ } } -#if 0 // data block is disordered, sort it in ascending order -static void tscSortRemoveDataBlockDupRowsOld(STableDataBlocks *dataBuf) { +void tscSortRemoveDataBlockDupRowsRaw(STableDataBlocks *dataBuf) { SSubmitBlk *pBlocks = (SSubmitBlk *)dataBuf->pData; // size is less than the total size, since duplicated rows may be removed yet. @@ -1114,7 +1113,6 @@ static void tscSortRemoveDataBlockDupRowsOld(STableDataBlocks *dataBuf) { dataBuf->prevTS = INT64_MIN; } -#endif // data block is disordered, sort it in ascending order int tscSortRemoveDataBlockDupRows(STableDataBlocks *dataBuf, SBlockKeyInfo *pBlkKeyInfo) { diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index f68fc60270..7370528851 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -47,6 +47,7 @@ typedef struct SNormalStmt { typedef struct SMultiTbStmt { bool nameSet; bool tagSet; + bool subSet; uint64_t currentUid; char *sqlstr; uint32_t tbNum; @@ -54,6 +55,7 @@ typedef struct SMultiTbStmt { SStrToken stbname; SStrToken values; SArray *tags; + STableDataBlocks *lastBlock; SHashObj *pTableHash; SHashObj *pTableBlockHashList; // data block for each table } SMultiTbStmt; @@ -291,7 +293,6 @@ static char* normalStmtBuildSql(STscStmt* stmt) { return taosStringBuilderGetResult(&sb, NULL); } -#if 0 static int fillColumnsNull(STableDataBlocks* pBlock, int32_t rowNum) { SParsedDataColInfo* spd = &pBlock->boundColumnInfo; int32_t offset = 0; @@ -319,129 +320,8 @@ static int fillColumnsNull(STableDataBlocks* pBlock, int32_t rowNum) { return TSDB_CODE_SUCCESS; } -#endif - -/** - * input: - * - schema: - * - payload: - * - spd: - * output: - * - pBlock with data block replaced by K-V format - */ -static int refactorPayload(STableDataBlocks* pBlock, int32_t rowNum) { - SParsedDataColInfo* spd = &pBlock->boundColumnInfo; - SSchema* schema = (SSchema*)pBlock->pTableMeta->schema; - SMemRowHelper* pHelper = &pBlock->rowHelper; - STableMeta* pTableMeta = pBlock->pTableMeta; - STableComInfo tinfo = tscGetTableInfo(pTableMeta); - int code = TSDB_CODE_SUCCESS; - int32_t extendedRowSize = getExtendedRowSize(&tinfo); - TDRowTLenT destPayloadSize = sizeof(SSubmitBlk); - - ASSERT(pHelper->allNullLen >= 8); - - TDRowTLenT destAllocSize = sizeof(SSubmitBlk) + rowNum * extendedRowSize; - SSubmitBlk* pDestBlock = tcalloc(destAllocSize, 1); - if (pDestBlock == NULL) { - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - memcpy(pDestBlock, pBlock->pData, sizeof(SSubmitBlk)); - char* destPayload = (char*)pDestBlock + sizeof(SSubmitBlk); - - char* srcPayload = (char*)pBlock->pData + sizeof(SSubmitBlk); - - for (int n = 0; n < rowNum; ++n) { - payloadSetNCols(destPayload, spd->numOfBound); - - TDRowTLenT dataRowLen = pHelper->allNullLen; - TDRowTLenT kvRowLen = TD_MEM_ROW_KV_VER_SIZE + sizeof(SColIdx) * spd->numOfBound; - TDRowTLenT payloadValOffset = payloadValuesOffset(destPayload); // rely on payloadNCols - TDRowLenT colValOffset = 0; - - char* kvPrimaryKeyStart = destPayload + PAYLOAD_HEADER_LEN; // primaryKey in 1st column tuple - char* kvStart = kvPrimaryKeyStart + PAYLOAD_COL_HEAD_LEN; // the column tuple behind the primaryKey - - for (int32_t i = 0; i < spd->numOfBound; ++i) { - int32_t colIndex = spd->boundedColumns[i]; - ASSERT(spd->cols[colIndex].hasVal); - char* start = srcPayload + spd->cols[colIndex].offset; - SSchema* pSchema = &schema[colIndex]; // get colId here - bool isPrimaryKey = (colIndex == PRIMARYKEY_TIMESTAMP_COL_INDEX); - - // the primary key locates in 1st column - if (!IS_DATA_COL_ORDERED(spd->orderStatus)) { - ASSERT(spd->colIdxInfo != NULL); - if (!isPrimaryKey) { - kvStart = POINTER_SHIFT(kvPrimaryKeyStart, spd->colIdxInfo[i].finalIdx * PAYLOAD_COL_HEAD_LEN); - } else { - ASSERT(spd->colIdxInfo[i].finalIdx == 0); - } - } - if (isPrimaryKey) { - payloadColSetId(kvPrimaryKeyStart, pSchema->colId); - payloadColSetType(kvPrimaryKeyStart, pSchema->type); - payloadColSetOffset(kvPrimaryKeyStart, colValOffset); - memcpy(POINTER_SHIFT(destPayload, payloadValOffset + colValOffset), start, TYPE_BYTES[pSchema->type]); - colValOffset += TYPE_BYTES[pSchema->type]; - kvRowLen += TYPE_BYTES[pSchema->type]; - } else { - payloadColSetId(kvStart, pSchema->colId); - payloadColSetType(kvStart, pSchema->type); - payloadColSetOffset(kvStart, colValOffset); - if (IS_VAR_DATA_TYPE(pSchema->type)) { - varDataCopy(POINTER_SHIFT(destPayload, payloadValOffset + colValOffset), start); - colValOffset += varDataTLen(start); - kvRowLen += varDataTLen(start); - if (pSchema->type == TSDB_DATA_TYPE_BINARY) { - dataRowLen += (varDataLen(start) - CHAR_BYTES); - } else if (pSchema->type == TSDB_DATA_TYPE_NCHAR) { - dataRowLen += (varDataLen(start) - TSDB_NCHAR_SIZE); - } else { - ASSERT(0); - } - } else { - memcpy(POINTER_SHIFT(destPayload, payloadValOffset + colValOffset), start, TYPE_BYTES[pSchema->type]); - colValOffset += TYPE_BYTES[pSchema->type]; - kvRowLen += TYPE_BYTES[pSchema->type]; - } - - if (IS_DATA_COL_ORDERED(spd->orderStatus)) { - kvStart += PAYLOAD_COL_HEAD_LEN; // move to next column - } - } - } // end of column - - if (kvRowLen < dataRowLen) { - payloadSetType(destPayload, SMEM_ROW_KV); - } else { - payloadSetType(destPayload, SMEM_ROW_DATA); - } - - ASSERT(colValOffset <= TSDB_MAX_BYTES_PER_ROW); - - TDRowTLenT len = payloadValOffset + colValOffset; - payloadSetTLen(destPayload, len); - - // next loop - srcPayload += pBlock->rowSize; - destPayload += len; - - destPayloadSize += len; - } // end of row - - ASSERT(destPayloadSize <= destAllocSize); - - tfree(pBlock->pData); - pBlock->pData = (char*)pDestBlock; - pBlock->nAllocSize = destAllocSize; - pBlock->size = destPayloadSize; - - return code; -} -#if 0 int32_t fillTablesColumnsNull(SSqlObj* pSql) { SSqlCmd* pCmd = &pSql->cmd; @@ -464,93 +344,12 @@ int32_t fillTablesColumnsNull(SSqlObj* pSql) { return TSDB_CODE_SUCCESS; } -#endif -/** - * check and sort - */ -static int initPayloadEnv(STableDataBlocks* pBlock, int32_t rowNum) { - SParsedDataColInfo* spd = &pBlock->boundColumnInfo; - if (spd->orderStatus != ORDER_STATUS_UNKNOWN) { - return TSDB_CODE_SUCCESS; - } - bool isOrdered = true; - int32_t lastColIdx = -1; - for (int32_t i = 0; i < spd->numOfBound; ++i) { - ASSERT(spd->cols[i].hasVal); - int32_t colIdx = spd->boundedColumns[i]; - if (isOrdered) { - if (lastColIdx > colIdx) { - isOrdered = false; - break; - } else { - lastColIdx = colIdx; - } - } - } - spd->orderStatus = isOrdered ? ORDER_STATUS_ORDERED : ORDER_STATUS_DISORDERED; - - if (isOrdered) { - spd->colIdxInfo = NULL; - } else { - spd->colIdxInfo = calloc(spd->numOfBound, sizeof(SBoundIdxInfo)); - if (spd->colIdxInfo == NULL) { - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - SBoundIdxInfo* pColIdx = spd->colIdxInfo; - for (uint16_t i = 0; i < spd->numOfBound; ++i) { - pColIdx[i].schemaColIdx = (uint16_t)spd->boundedColumns[i]; - pColIdx[i].boundIdx = i; - } - qsort(pColIdx, spd->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); - for (uint16_t i = 0; i < spd->numOfBound; ++i) { - pColIdx[i].finalIdx = i; - } - qsort(pColIdx, spd->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); - } - - return TSDB_CODE_SUCCESS; -} - -/** - * Refactor the raw payload structure to K-V format as the in tsParseOneRow() - */ -int32_t fillTablesPayload(SSqlObj* pSql) { - SSqlCmd* pCmd = &pSql->cmd; - int code = TSDB_CODE_SUCCESS; - - STableDataBlocks** p = taosHashIterate(pCmd->insertParam.pTableBlockHashList, NULL); - - STableDataBlocks* pOneTableBlock = *p; - while (pOneTableBlock) { - SSubmitBlk* pBlocks = (SSubmitBlk*)pOneTableBlock->pData; - - if (pBlocks->numOfRows > 0) { - initSMemRowHelper(&pOneTableBlock->rowHelper, tscGetTableSchema(pOneTableBlock->pTableMeta), - tscGetNumOfColumns(pOneTableBlock->pTableMeta), 0); - if ((code = initPayloadEnv(pOneTableBlock, pBlocks->numOfRows)) != TSDB_CODE_SUCCESS) { - return code; - } - if ((code = refactorPayload(pOneTableBlock, pBlocks->numOfRows)) != TSDB_CODE_SUCCESS) { - return code; - }; - } - - p = taosHashIterate(pCmd->insertParam.pTableBlockHashList, p); - if (p == NULL) { - break; - } - - pOneTableBlock = *p; - } - - return code; -} - //////////////////////////////////////////////////////////////////////////////// - // functions for insertion statement preparation - static int doBindParam(STableDataBlocks* pBlock, char* data, SParamInfo* param, TAOS_BIND* bind, int32_t colNum) { +//////////////////////////////////////////////////////////////////////////////// +// functions for insertion statement preparation +static FORCE_INLINE int doBindParam(STableDataBlocks* pBlock, char* data, SParamInfo* param, TAOS_BIND* bind, int32_t colNum) { if (bind->is_null != NULL && *(bind->is_null)) { setNull(data + param->offset, param->type, param->bytes); return TSDB_CODE_SUCCESS; @@ -949,25 +748,25 @@ int32_t fillTablesPayload(SSqlObj* pSql) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_UTINYINT: - size = 1; + *(uint8_t *)(data + param->offset) = *(uint8_t *)bind->buffer; break; case TSDB_DATA_TYPE_SMALLINT: case TSDB_DATA_TYPE_USMALLINT: - size = 2; + *(uint16_t *)(data + param->offset) = *(uint16_t *)bind->buffer; break; case TSDB_DATA_TYPE_INT: case TSDB_DATA_TYPE_UINT: case TSDB_DATA_TYPE_FLOAT: - size = 4; + *(uint32_t *)(data + param->offset) = *(uint32_t *)bind->buffer; break; case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_UBIGINT: case TSDB_DATA_TYPE_DOUBLE: case TSDB_DATA_TYPE_TIMESTAMP: - size = 8; + *(uint64_t *)(data + param->offset) = *(uint64_t *)bind->buffer; break; case TSDB_DATA_TYPE_BINARY: @@ -993,7 +792,6 @@ int32_t fillTablesPayload(SSqlObj* pSql) { return TSDB_CODE_TSC_INVALID_VALUE; } - memcpy(data + param->offset, bind->buffer, size); if (param->offset == 0) { if (tsCheckTimestamp(pBlock, data + param->offset) != TSDB_CODE_SUCCESS) { tscError("invalid timestamp"); @@ -1004,6 +802,58 @@ int32_t fillTablesPayload(SSqlObj* pSql) { return TSDB_CODE_SUCCESS; } +static int32_t insertStmtGenLastBlock(STableDataBlocks** lastBlock, STableDataBlocks* pBlock) { + *lastBlock = (STableDataBlocks*)malloc(sizeof(STableDataBlocks)); + memcpy(*lastBlock, pBlock, sizeof(STableDataBlocks)); + (*lastBlock)->cloned = true; + + (*lastBlock)->pData = NULL; + (*lastBlock)->ordered = true; + (*lastBlock)->prevTS = INT64_MIN; + (*lastBlock)->size = sizeof(SSubmitBlk); + (*lastBlock)->tsSource = -1; + + return TSDB_CODE_SUCCESS; +} + + +static int32_t insertStmtGenBlock(STscStmt* pStmt, STableDataBlocks** pBlock, STableMeta* pTableMeta, SName* name) { + int32_t code = 0; + + if (pStmt->mtb.lastBlock == NULL) { + tscError("no previous data block"); + return TSDB_CODE_TSC_APP_ERROR; + } + + int32_t msize = tscGetTableMetaSize(pTableMeta); + int32_t tsize = sizeof(STableDataBlocks) + msize; + + void *t = malloc(tsize); + *pBlock = t; + + memcpy(*pBlock, pStmt->mtb.lastBlock, sizeof(STableDataBlocks)); + + t = (char *)t + sizeof(STableDataBlocks); + (*pBlock)->pTableMeta = t; + memcpy((*pBlock)->pTableMeta, pTableMeta, msize); + + (*pBlock)->pData = malloc((*pBlock)->nAllocSize); + + (*pBlock)->vgId = (*pBlock)->pTableMeta->vgId; + + tNameAssign(&(*pBlock)->tableName, name); + + SSubmitBlk* blk = (SSubmitBlk*)(*pBlock)->pData; + memset(blk, 0, sizeof(*blk)); + + code = tsSetBlockInfo(blk, pTableMeta, 0); + if (code != TSDB_CODE_SUCCESS) { + STMT_RET(code); + } + + return TSDB_CODE_SUCCESS; +} + static int doBindBatchParam(STableDataBlocks* pBlock, SParamInfo* param, TAOS_MULTI_BIND* bind, int32_t rowNum) { if (bind->buffer_type != param->type || !isValidDataType(param->type)) { @@ -1309,12 +1159,9 @@ static int insertStmtExecute(STscStmt* stmt) { pBlk->uid = pTableMeta->id.uid; pBlk->tid = pTableMeta->id.tid; - int code = fillTablesPayload(stmt->pSql); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + fillTablesColumnsNull(stmt->pSql); - code = tscMergeTableDataBlocks(&stmt->pSql->cmd.insertParam, false); + int code = tscMergeTableDataBlocks(&stmt->pSql->cmd.insertParam, false); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -1378,7 +1225,7 @@ static void insertBatchClean(STscStmt* pStmt) { static int insertBatchStmtExecute(STscStmt* pStmt) { int32_t code = 0; - + if(pStmt->mtb.nameSet == false) { tscError("0x%"PRIx64" no table name set", pStmt->pSql->self); return invalidOperationMsg(tscGetErrorMsgPayload(&pStmt->pSql->cmd), "no table name set"); @@ -1391,7 +1238,7 @@ static int insertBatchStmtExecute(STscStmt* pStmt) { return TSDB_CODE_TSC_APP_ERROR; } - fillTablesPayload(pStmt->pSql); + fillTablesColumnsNull(pStmt->pSql); if ((code = tscMergeTableDataBlocks(&pStmt->pSql->cmd.insertParam, false)) != TSDB_CODE_SUCCESS) { return code; @@ -1433,11 +1280,11 @@ int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) { pStmt->mtb.tbname = sToken; pStmt->mtb.nameSet = false; if (pStmt->mtb.pTableHash == NULL) { - pStmt->mtb.pTableHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false); + pStmt->mtb.pTableHash = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false); } if (pStmt->mtb.pTableBlockHashList == NULL) { - pStmt->mtb.pTableBlockHashList = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false); + pStmt->mtb.pTableBlockHashList = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false); } pStmt->mtb.tagSet = true; @@ -1728,6 +1575,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) { int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags) { STscStmt* pStmt = (STscStmt*)stmt; + int32_t code = 0; if (stmt == NULL || pStmt->pSql == NULL || pStmt->taos == NULL) { STMT_RET(TSDB_CODE_TSC_DISCONNECTED); @@ -1765,6 +1613,9 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags SSubmitBlk* pBlk = (SSubmitBlk*) (*t1)->pData; pCmd->batchSize = pBlk->numOfRows; + if (pBlk->numOfRows == 0) { + (*t1)->prevTS = INT64_MIN; + } tsSetBlockInfo(pBlk, (*t1)->pTableMeta, pBlk->numOfRows); @@ -1774,6 +1625,51 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags STMT_RET(TSDB_CODE_SUCCESS); } + if (pStmt->mtb.subSet && taosHashGetSize(pStmt->mtb.pTableHash) > 0) { + STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, 0); + STableMeta* pTableMeta = pTableMetaInfo->pTableMeta; + char sTableName[TSDB_TABLE_FNAME_LEN]; + strncpy(sTableName, pTableMeta->sTableName, sizeof(sTableName)); + + SStrToken tname = {0}; + tname.type = TK_STRING; + tname.z = (char *)name; + tname.n = (uint32_t)strlen(name); + SName fullname = {0}; + tscSetTableFullName(&fullname, &tname, pSql); + + memcpy(&pTableMetaInfo->name, &fullname, sizeof(fullname)); + + code = tscGetTableMeta(pSql, pTableMetaInfo); + if (code != TSDB_CODE_SUCCESS) { + STMT_RET(code); + } + + pTableMeta = pTableMetaInfo->pTableMeta; + + if (strcmp(sTableName, pTableMeta->sTableName)) { + tscError("0x%"PRIx64" only tables belongs to one stable is allowed", pSql->self); + STMT_RET(TSDB_CODE_TSC_APP_ERROR); + } + + STableDataBlocks* pBlock = NULL; + + insertStmtGenBlock(pStmt, &pBlock, pTableMeta, &pTableMetaInfo->name); + + pCmd->batchSize = 0; + + pStmt->mtb.currentUid = pTableMeta->id.uid; + pStmt->mtb.tbNum++; + + taosHashPut(pCmd->insertParam.pTableBlockHashList, (void *)&pStmt->mtb.currentUid, sizeof(pStmt->mtb.currentUid), (void*)&pBlock, POINTER_BYTES); + taosHashPut(pStmt->mtb.pTableBlockHashList, (void *)&pStmt->mtb.currentUid, sizeof(pStmt->mtb.currentUid), (void*)&pBlock, POINTER_BYTES); + taosHashPut(pStmt->mtb.pTableHash, name, strlen(name), (char*) &pTableMeta->id.uid, sizeof(pTableMeta->id.uid)); + + tscDebug("0x%"PRIx64" table:%s is prepared, uid:%" PRIx64, pSql->self, name, pStmt->mtb.currentUid); + + STMT_RET(TSDB_CODE_SUCCESS); + } + if (pStmt->mtb.tagSet) { pStmt->mtb.tbname = tscReplaceStrToken(&pSql->sqlstr, &pStmt->mtb.tbname, name); } else { @@ -1802,7 +1698,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags pCmd->insertParam.pTableBlockHashList = hashList; } - int32_t code = tsParseSql(pStmt->pSql, true); + code = tsParseSql(pStmt->pSql, true); if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) { // wait for the callback function to post the semaphore tsem_wait(&pStmt->pSql->rspSem); @@ -1830,6 +1726,10 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags taosHashPut(pStmt->mtb.pTableBlockHashList, (void *)&pStmt->mtb.currentUid, sizeof(pStmt->mtb.currentUid), (void*)&pBlock, POINTER_BYTES); taosHashPut(pStmt->mtb.pTableHash, name, strlen(name), (char*) &pTableMeta->id.uid, sizeof(pTableMeta->id.uid)); + if (pStmt->mtb.lastBlock == NULL) { + insertStmtGenLastBlock(&pStmt->mtb.lastBlock, pBlock); + } + tscDebug("0x%"PRIx64" table:%s is prepared, uid:%" PRIx64, pSql->self, name, pStmt->mtb.currentUid); } @@ -1837,7 +1737,17 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags } +int taos_stmt_set_sub_tbname(TAOS_STMT* stmt, const char* name) { + STscStmt* pStmt = (STscStmt*)stmt; + pStmt->mtb.subSet = true; + return taos_stmt_set_tbname_tags(stmt, name, NULL); +} + + + int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name) { + STscStmt* pStmt = (STscStmt*)stmt; + pStmt->mtb.subSet = false; return taos_stmt_set_tbname_tags(stmt, name, NULL); } @@ -1861,6 +1771,7 @@ int taos_stmt_close(TAOS_STMT* stmt) { if (pStmt->pSql && pStmt->pSql->res.code != 0) { rmMeta = true; } + tscDestroyDataBlock(pStmt->mtb.lastBlock, rmMeta); pStmt->mtb.pTableBlockHashList = tscDestroyBlockHashTable(pStmt->mtb.pTableBlockHashList, rmMeta); taosHashCleanup(pStmt->pSql->cmd.insertParam.pTableBlockHashList); pStmt->pSql->cmd.insertParam.pTableBlockHashList = NULL; @@ -1895,6 +1806,8 @@ int taos_stmt_bind_param(TAOS_STMT* stmt, TAOS_BIND* bind) { pStmt->last = STMT_BIND; + tscDebug("tableId:%" PRIu64 ", try to bind one row", pStmt->mtb.currentUid); + STMT_RET(insertStmtBindParam(pStmt, bind)); } else { STMT_RET(normalStmtBindParam(pStmt, bind)); @@ -2014,6 +1927,7 @@ int taos_stmt_execute(TAOS_STMT* stmt) { pStmt->last = STMT_EXECUTE; + pStmt->pSql->cmd.insertParam.payloadType = PAYLOAD_TYPE_RAW; if (pStmt->multiTbInsert) { ret = insertBatchStmtExecute(pStmt); } else { diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index af57719ccf..adea1cc453 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -8037,6 +8037,28 @@ static void freeElem(void* p) { tfree(*(char**)p); } +int32_t tnameComparFn(const void* p1, const void* p2) { + SName* pn1 = (SName*)p1; + SName* pn2 = (SName*)p2; + + int32_t ret = strncmp(pn1->acctId, pn2->acctId, tListLen(pn1->acctId)); + if (ret != 0) { + return ret > 0? 1:-1; + } else { + ret = strncmp(pn1->dbname, pn2->dbname, tListLen(pn1->dbname)); + if (ret != 0) { + return ret > 0? 1:-1; + } else { + ret = strncmp(pn1->tname, pn2->tname, tListLen(pn1->tname)); + if (ret != 0) { + return ret > 0? 1:-1; + } else { + return 0; + } + } + } +} + int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) { SSqlCmd* pCmd = &pSql->cmd; @@ -8091,6 +8113,9 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) { plist = taosArrayInit(4, POINTER_BYTES); pVgroupList = taosArrayInit(4, POINTER_BYTES); + taosArraySort(tableNameList, tnameComparFn); + taosArrayRemoveDuplicate(tableNameList, tnameComparFn, NULL); + size_t numOfTables = taosArrayGetSize(tableNameList); for (int32_t i = 0; i < numOfTables; ++i) { SName* pname = taosArrayGet(tableNameList, i); @@ -8111,8 +8136,7 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) { continue; } } else if (pTableMeta->tableType == TSDB_SUPER_TABLE) { - // the vgroup list of a super table is not kept in local buffer, so here need retrieve it - // from the mnode each time + // the vgroup list of super table is not kept in local buffer, so here need retrieve it from the mnode each time char* t = strdup(name); taosArrayPush(pVgroupList, &t); } @@ -8139,6 +8163,7 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) { if (pInfo->funcs) { funcSize = taosArrayGetSize(pInfo->funcs); } + if (funcSize > 0) { for (size_t i = 0; i < funcSize; ++i) { SStrToken* t = taosArrayGet(pInfo->funcs, i); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 6cb8e9a0de..5809218e6a 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1315,8 +1315,7 @@ void tscFreeQueryInfo(SSqlCmd* pCmd, bool removeMeta) { return; } - SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd); - + SQueryInfo* pQueryInfo = pCmd->pQueryInfo; while(pQueryInfo != NULL) { SQueryInfo* p = pQueryInfo->sibling; @@ -1518,12 +1517,6 @@ void tscDestroyDataBlock(STableDataBlocks* pDataBlock, bool removeMeta) { } tfree(pDataBlock->pData); - tfree(pDataBlock->params); - - // free the refcount for metermeta - if (pDataBlock->pTableMeta != NULL) { - tfree(pDataBlock->pTableMeta); - } if (removeMeta) { char name[TSDB_TABLE_FNAME_LEN] = {0}; @@ -1532,7 +1525,17 @@ void tscDestroyDataBlock(STableDataBlocks* pDataBlock, bool removeMeta) { taosHashRemove(tscTableMetaInfo, name, strnlen(name, TSDB_TABLE_FNAME_LEN)); } - tscDestroyBoundColumnInfo(&pDataBlock->boundColumnInfo); + if (!pDataBlock->cloned) { + tfree(pDataBlock->params); + + // free the refcount for metermeta + if (pDataBlock->pTableMeta != NULL) { + tfree(pDataBlock->pTableMeta); + } + + tscDestroyBoundColumnInfo(&pDataBlock->boundColumnInfo); + } + tfree(pDataBlock); } @@ -1598,7 +1601,7 @@ void freeUdfInfo(SUdfInfo* pUdfInfo) { taosCloseDll(pUdfInfo->handle); } - +// todo refactor void* tscDestroyUdfArrayList(SArray* pUdfList) { if (pUdfList == NULL) { return NULL; @@ -1711,12 +1714,14 @@ int32_t tscCreateDataBlock(size_t defaultSize, int32_t rowSize, int32_t startOff dataBuf->nAllocSize = dataBuf->headerSize * 2; } - dataBuf->pData = calloc(1, dataBuf->nAllocSize); + //dataBuf->pData = calloc(1, dataBuf->nAllocSize); + dataBuf->pData = malloc(dataBuf->nAllocSize); if (dataBuf->pData == NULL) { tscError("failed to allocated memory, reason:%s", strerror(errno)); tfree(dataBuf); return TSDB_CODE_TSC_OUT_OF_MEMORY; } + memset(dataBuf->pData, 0, sizeof(SSubmitBlk)); //Here we keep the tableMeta to avoid it to be remove by other threads. dataBuf->pTableMeta = tscTableMetaDup(pTableMeta); @@ -1813,14 +1818,14 @@ static SMemRow tdGenMemRowFromBuilder(SMemRowBuilder* pBuilder) { p = payloadNextCol(p); ++i; } else { - tdAppendColVal(trow, tdGetNullVal(pSchema[j].type), pSchema[j].type, toffset); + tdAppendColVal(trow, getNullValue(pSchema[j].type), pSchema[j].type, toffset); toffset += TYPE_BYTES[pSchema[j].type]; ++j; } } while (j < nCols) { - tdAppendColVal(trow, tdGetNullVal(pSchema[j].type), pSchema[j].type, toffset); + tdAppendColVal(trow, getNullValue(pSchema[j].type), pSchema[j].type, toffset); toffset += TYPE_BYTES[pSchema[j].type]; ++j; } @@ -1860,7 +1865,8 @@ static SMemRow tdGenMemRowFromBuilder(SMemRowBuilder* pBuilder) { } // Erase the empty space reserved for binary data -static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, bool includeSchema, SBlockKeyTuple *blkKeyTuple) { +static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, SInsertStatementParam* insertParam, + SBlockKeyTuple* blkKeyTuple) { // TODO: optimize this function, handle the case while binary is not presented STableMeta* pTableMeta = pTableDataBlock->pTableMeta; STableComInfo tinfo = tscGetTableInfo(pTableMeta); @@ -1873,7 +1879,7 @@ static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, bo int32_t flen = 0; // original total length of row // schema needs to be included into the submit data block - if (includeSchema) { + if (insertParam->schemaAttached) { int32_t numOfCols = tscGetNumOfColumns(pTableDataBlock->pTableMeta); for(int32_t j = 0; j < numOfCols; ++j) { STColumn* pCol = (STColumn*) pDataBlock; @@ -1900,18 +1906,38 @@ static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, bo pBlock->dataLen = 0; int32_t numOfRows = htons(pBlock->numOfRows); - SMemRowBuilder rowBuilder; - rowBuilder.pSchema = pSchema; - rowBuilder.sversion = pTableMeta->sversion; - rowBuilder.flen = flen; - rowBuilder.nCols = tinfo.numOfColumns; - rowBuilder.pDataBlock = pDataBlock; - rowBuilder.pSubmitBlk = pBlock; - rowBuilder.buf = p; + if (IS_RAW_PAYLOAD(insertParam->payloadType)) { + for (int32_t i = 0; i < numOfRows; ++i) { + SMemRow memRow = (SMemRow)pDataBlock; + memRowSetType(memRow, SMEM_ROW_DATA); + SDataRow trow = memRowDataBody(memRow); + dataRowSetLen(trow, (uint16_t)(TD_DATA_ROW_HEAD_SIZE + flen)); + dataRowSetVersion(trow, pTableMeta->sversion); - for (int32_t i = 0; i < numOfRows; ++i) { - rowBuilder.buf = (blkKeyTuple + i)->payloadAddr; - tdGenMemRowFromBuilder(&rowBuilder); + int toffset = 0; + for (int32_t j = 0; j < tinfo.numOfColumns; j++) { + tdAppendColVal(trow, p, pSchema[j].type, toffset); + toffset += TYPE_BYTES[pSchema[j].type]; + p += pSchema[j].bytes; + } + + pDataBlock = (char*)pDataBlock + memRowTLen(memRow); + pBlock->dataLen += memRowTLen(memRow); + } + } else { + SMemRowBuilder rowBuilder; + rowBuilder.pSchema = pSchema; + rowBuilder.sversion = pTableMeta->sversion; + rowBuilder.flen = flen; + rowBuilder.nCols = tinfo.numOfColumns; + rowBuilder.pDataBlock = pDataBlock; + rowBuilder.pSubmitBlk = pBlock; + rowBuilder.buf = p; + + for (int32_t i = 0; i < numOfRows; ++i) { + rowBuilder.buf = (blkKeyTuple + i)->payloadAddr; + tdGenMemRowFromBuilder(&rowBuilder); + } } int32_t len = pBlock->dataLen + pBlock->schemaLen; @@ -1936,16 +1962,14 @@ static int32_t getRowExpandSize(STableMeta* pTableMeta) { static void extractTableNameList(SInsertStatementParam *pInsertParam, bool freeBlockMap) { pInsertParam->numOfTables = (int32_t) taosHashGetSize(pInsertParam->pTableBlockHashList); if (pInsertParam->pTableNameList == NULL) { - pInsertParam->pTableNameList = calloc(pInsertParam->numOfTables, POINTER_BYTES); - } else { - memset(pInsertParam->pTableNameList, 0, pInsertParam->numOfTables * POINTER_BYTES); + pInsertParam->pTableNameList = malloc(pInsertParam->numOfTables * POINTER_BYTES); } STableDataBlocks **p1 = taosHashIterate(pInsertParam->pTableBlockHashList, NULL); int32_t i = 0; while(p1) { STableDataBlocks* pBlocks = *p1; - tfree(pInsertParam->pTableNameList[i]); + //tfree(pInsertParam->pTableNameList[i]); pInsertParam->pTableNameList[i++] = tNameDup(&pBlocks->tableName); p1 = taosHashIterate(pInsertParam->pTableBlockHashList, p1); @@ -1959,6 +1983,7 @@ static void extractTableNameList(SInsertStatementParam *pInsertParam, bool freeB int32_t tscMergeTableDataBlocks(SInsertStatementParam *pInsertParam, bool freeBlockMap) { const int INSERT_HEAD_SIZE = sizeof(SMsgDesc) + sizeof(SSubmitMsg); int code = 0; + bool isRawPayload = IS_RAW_PAYLOAD(pInsertParam->payloadType); void* pVnodeDataBlockHashList = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false); SArray* pVnodeDataBlockList = taosArrayInit(8, POINTER_BYTES); @@ -1967,7 +1992,7 @@ int32_t tscMergeTableDataBlocks(SInsertStatementParam *pInsertParam, bool freeBl STableDataBlocks* pOneTableBlock = *p; SBlockKeyInfo blkKeyInfo = {0}; // share by pOneTableBlock - + while(pOneTableBlock) { SSubmitBlk* pBlocks = (SSubmitBlk*) pOneTableBlock->pData; if (pBlocks->numOfRows > 0) { @@ -1988,14 +2013,12 @@ int32_t tscMergeTableDataBlocks(SInsertStatementParam *pInsertParam, bool freeBl int64_t destSize = dataBuf->size + pOneTableBlock->size + pBlocks->numOfRows * expandSize + sizeof(STColumn) * tscGetNumOfColumns(pOneTableBlock->pTableMeta); if (dataBuf->nAllocSize < destSize) { - while (dataBuf->nAllocSize < destSize) { - dataBuf->nAllocSize = (uint32_t)(dataBuf->nAllocSize * 1.5); - } + dataBuf->nAllocSize = (uint32_t)(destSize * 1.5); char* tmp = realloc(dataBuf->pData, dataBuf->nAllocSize); if (tmp != NULL) { dataBuf->pData = tmp; - memset(dataBuf->pData + dataBuf->size, 0, dataBuf->nAllocSize - dataBuf->size); + //memset(dataBuf->pData + dataBuf->size, 0, dataBuf->nAllocSize - dataBuf->size); } else { // failed to allocate memory, free already allocated memory and return error code tscError("0x%"PRIx64" failed to allocate memory for merging submit block, size:%d", pInsertParam->objectId, dataBuf->nAllocSize); @@ -2008,21 +2031,29 @@ int32_t tscMergeTableDataBlocks(SInsertStatementParam *pInsertParam, bool freeBl } } - if ((code = tscSortRemoveDataBlockDupRows(pOneTableBlock, &blkKeyInfo)) != 0) { - taosHashCleanup(pVnodeDataBlockHashList); - tscDestroyBlockArrayList(pVnodeDataBlockList); - tfree(dataBuf->pData); - tfree(blkKeyInfo.pKeyTuple); - return code; + if (isRawPayload) { + tscSortRemoveDataBlockDupRowsRaw(pOneTableBlock); + char* ekey = (char*)pBlocks->data + pOneTableBlock->rowSize * (pBlocks->numOfRows - 1); + + tscDebug("0x%" PRIx64 " name:%s, tid:%d rows:%d sversion:%d skey:%" PRId64 ", ekey:%" PRId64, + pInsertParam->objectId, tNameGetTableName(&pOneTableBlock->tableName), pBlocks->tid, + pBlocks->numOfRows, pBlocks->sversion, GET_INT64_VAL(pBlocks->data), GET_INT64_VAL(ekey)); + } else { + if ((code = tscSortRemoveDataBlockDupRows(pOneTableBlock, &blkKeyInfo)) != 0) { + taosHashCleanup(pVnodeDataBlockHashList); + tscDestroyBlockArrayList(pVnodeDataBlockList); + tfree(dataBuf->pData); + tfree(blkKeyInfo.pKeyTuple); + return code; + } + ASSERT(blkKeyInfo.pKeyTuple != NULL && pBlocks->numOfRows > 0); + + SBlockKeyTuple* pLastKeyTuple = blkKeyInfo.pKeyTuple + pBlocks->numOfRows - 1; + tscDebug("0x%" PRIx64 " name:%s, tid:%d rows:%d sversion:%d skey:%" PRId64 ", ekey:%" PRId64, + pInsertParam->objectId, tNameGetTableName(&pOneTableBlock->tableName), pBlocks->tid, + pBlocks->numOfRows, pBlocks->sversion, blkKeyInfo.pKeyTuple->skey, pLastKeyTuple->skey); } - - ASSERT(blkKeyInfo.pKeyTuple != NULL && pBlocks->numOfRows > 0); - - SBlockKeyTuple* pLastKeyTuple = blkKeyInfo.pKeyTuple + pBlocks->numOfRows - 1; - tscDebug("0x%" PRIx64 " name:%s, tid:%d rows:%d sversion:%d skey:%" PRId64 ", ekey:%" PRId64, - pInsertParam->objectId, tNameGetTableName(&pOneTableBlock->tableName), pBlocks->tid, pBlocks->numOfRows, - pBlocks->sversion, blkKeyInfo.pKeyTuple->skey, pLastKeyTuple->skey); - + int32_t len = pBlocks->numOfRows * (pOneTableBlock->rowSize + expandSize) + sizeof(STColumn) * tscGetNumOfColumns(pOneTableBlock->pTableMeta); pBlocks->tid = htonl(pBlocks->tid); @@ -2032,7 +2063,7 @@ int32_t tscMergeTableDataBlocks(SInsertStatementParam *pInsertParam, bool freeBl pBlocks->schemaLen = 0; // erase the empty space reserved for binary data - int32_t finalLen = trimDataBlock(dataBuf->pData + dataBuf->size, pOneTableBlock, pInsertParam->schemaAttached, blkKeyInfo.pKeyTuple); + int32_t finalLen = trimDataBlock(dataBuf->pData + dataBuf->size, pOneTableBlock, pInsertParam, blkKeyInfo.pKeyTuple); assert(finalLen <= len); dataBuf->size += (finalLen + sizeof(SSubmitBlk)); @@ -3097,6 +3128,7 @@ void tscInitQueryInfo(SQueryInfo* pQueryInfo) { int32_t tscAddQueryInfo(SSqlCmd* pCmd) { assert(pCmd != NULL); SQueryInfo* pQueryInfo = calloc(1, sizeof(SQueryInfo)); + if (pQueryInfo == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } @@ -3889,7 +3921,7 @@ bool tscIsUpdateQuery(SSqlObj* pSql) { } SSqlCmd* pCmd = &pSql->cmd; - return ((pCmd->command >= TSDB_SQL_INSERT && pCmd->command <= TSDB_SQL_DROP_DNODE) || TSDB_SQL_USE_DB == pCmd->command); + return ((pCmd->command >= TSDB_SQL_INSERT && pCmd->command <= TSDB_SQL_DROP_DNODE) || TSDB_SQL_RESET_CACHE == pCmd->command || TSDB_SQL_USE_DB == pCmd->command); } char* tscGetSqlStr(SSqlObj* pSql) { @@ -4079,17 +4111,21 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) { //backup the total number of result first int64_t num = pRes->numOfTotal + pRes->numOfClauseTotal; - // DON't free final since it may be recoreded and used later in APP TAOS_FIELD* finalBk = pRes->final; pRes->final = NULL; tscFreeSqlResult(pSql); + pRes->final = finalBk; - pRes->numOfTotal = num; - + + for(int32_t i = 0; i < pSql->subState.numOfSub; ++i) { + taos_free_result(pSql->pSubs[i]); + } + tfree(pSql->pSubs); pSql->subState.numOfSub = 0; + pSql->fp = fp; tscDebug("0x%"PRIx64" try data in the next subclause", pSql->self); @@ -4350,7 +4386,7 @@ STableMeta* tscTableMetaDup(STableMeta* pTableMeta) { assert(pTableMeta != NULL); size_t size = tscGetTableMetaSize(pTableMeta); - STableMeta* p = calloc(1, size); + STableMeta* p = malloc(size); memcpy(p, pTableMeta, size); return p; } @@ -4729,6 +4765,20 @@ int32_t nameComparFn(const void* n1, const void* n2) { } } +static void freeContent(void* p) { + char* ptr = *(char**)p; + tfree(ptr); +} + +static int32_t contCompare(const void* p1, const void* p2) { + int32_t ret = strcmp(p1, p2); + if (ret == 0) { + return 0; + } else { + return ret > 0 ? 1:-1; + } +} + int tscTransferTableNameList(SSqlObj *pSql, const char *pNameList, int32_t length, SArray* pNameArray) { SSqlCmd *pCmd = &pSql->cmd; @@ -4776,32 +4826,7 @@ int tscTransferTableNameList(SSqlObj *pSql, const char *pNameList, int32_t lengt } taosArraySort(pNameArray, nameComparFn); - - int32_t pos = 0; - for(int32_t i = 1; i < len; ++i) { - char** p1 = taosArrayGet(pNameArray, pos); - char** p2 = taosArrayGet(pNameArray, i); - - if (strcmp(*p1, *p2) == 0) { - // do nothing - } else { - if (pos + 1 != i) { - char* p = taosArrayGetP(pNameArray, pos + 1); - tfree(p); - taosArraySet(pNameArray, pos + 1, p2); - pos += 1; - } else { - pos += 1; - } - } - } - - for(int32_t i = pos + 1; i < pNameArray->size; ++i) { - char* p = taosArrayGetP(pNameArray, i); - tfree(p); - } - - pNameArray->size = pos + 1; + taosArrayRemoveDuplicate(pNameArray, contCompare, freeContent); return TSDB_CODE_SUCCESS; } diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h index 22f721d9e0..829e771c70 100644 --- a/src/common/inc/tdataformat.h +++ b/src/common/inc/tdataformat.h @@ -24,35 +24,6 @@ extern "C" { #endif -#pragma pack(push, 1) -typedef struct { - VarDataLenT len; - uint8_t data; -} SBinaryNullT; - -typedef struct { - VarDataLenT len; - uint32_t data; -} SNCharNullT; -#pragma pack(pop) - -extern const uint8_t BoolNull; -extern const uint8_t TinyintNull; -extern const uint16_t SmallintNull; -extern const uint32_t IntNull; -extern const uint64_t BigintNull; -extern const uint64_t TimestampNull; -extern const uint8_t UTinyintNull; -extern const uint16_t USmallintNull; -extern const uint32_t UIntNull; -extern const uint64_t UBigintNull; -extern const uint32_t FloatNull; -extern const uint64_t DoubleNull; -extern const SBinaryNullT BinaryNull; -extern const SNCharNullT NcharNull; - -const void *tdGetNullVal(int8_t type); - #define STR_TO_VARSTR(x, str) \ do { \ VarDataLenT __len = (VarDataLenT)strlen(str); \ @@ -287,7 +258,7 @@ void dataColSetNEleNull(SDataCol *pCol, int nEle, int maxPoints); // Get the data pointer from a column-wised data static FORCE_INLINE const void *tdGetColDataOfRow(SDataCol *pCol, int row) { if (isAllRowsNull(pCol)) { - return tdGetNullVal(pCol->type); + return getNullValue(pCol->type); } if (IS_VAR_DATA_TYPE(pCol->type)) { return POINTER_SHIFT(pCol->pData, pCol->dataOff[row]); diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index e35e805efe..30bbaaae73 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -205,6 +205,16 @@ extern int32_t wDebugFlag; extern int32_t cqDebugFlag; extern int32_t debugFlag; +#ifdef TD_TSZ +// lossy +extern char lossyColumns[]; +extern double fPrecision; +extern double dPrecision; +extern uint32_t maxIntervals; +extern uint32_t intervals; +extern char Compressor[]; +#endif + typedef struct { char dir[TSDB_FILENAME_LEN]; int level; diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index 04d70e7aa0..9f7432c90d 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -18,21 +18,6 @@ #include "tcoding.h" #include "wchar.h" -const uint8_t BoolNull = TSDB_DATA_BOOL_NULL; -const uint8_t TinyintNull = TSDB_DATA_TINYINT_NULL; -const uint16_t SmallintNull = TSDB_DATA_SMALLINT_NULL; -const uint32_t IntNull = TSDB_DATA_INT_NULL; -const uint64_t BigintNull = TSDB_DATA_BIGINT_NULL; -const uint64_t TimestampNull = TSDB_DATA_BIGINT_NULL; -const uint8_t UTinyintNull = TSDB_DATA_UTINYINT_NULL; -const uint16_t USmallintNull = TSDB_DATA_USMALLINT_NULL; -const uint32_t UIntNull = TSDB_DATA_UINT_NULL; -const uint64_t UBigintNull = TSDB_DATA_UBIGINT_NULL; -const uint32_t FloatNull = TSDB_DATA_FLOAT_NULL; -const uint64_t DoubleNull = TSDB_DATA_DOUBLE_NULL; -const SBinaryNullT BinaryNull = {1, TSDB_DATA_BINARY_NULL}; -const SNCharNullT NcharNull = {4, TSDB_DATA_NCHAR_NULL}; - static void tdMergeTwoDataCols(SDataCols *target, SDataCols *src1, int *iter1, int limit1, SDataCols *src2, int *iter2, int limit2, int tRows); @@ -453,7 +438,7 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols SDataCol *pDataCol = &(pCols->cols[dcol]); if (rcol >= schemaNCols(pSchema)) { // dataColSetNullAt(pDataCol, pCols->numOfRows); - dataColAppendVal(pDataCol, tdGetNullVal(pDataCol->type), pCols->numOfRows, pCols->maxPoints); + dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints); dcol++; continue; } @@ -468,7 +453,7 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols rcol++; } else { // dataColSetNullAt(pDataCol, pCols->numOfRows); - dataColAppendVal(pDataCol, tdGetNullVal(pDataCol->type), pCols->numOfRows, pCols->maxPoints); + dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints); dcol++; } } @@ -498,7 +483,7 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo SDataCol *pDataCol = &(pCols->cols[dcol]); if (rcol >= nRowCols || rcol >= schemaNCols(pSchema)) { // dataColSetNullAt(pDataCol, pCols->numOfRows); - dataColAppendVal(pDataCol, tdGetNullVal(pDataCol->type), pCols->numOfRows, pCols->maxPoints); + dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints); ++dcol; continue; } @@ -514,7 +499,7 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo ++rcol; } else { // dataColSetNullAt(pDataCol, pCols->numOfRows); - dataColAppendVal(pDataCol, tdGetNullVal(pDataCol->type), pCols->numOfRows, pCols->maxPoints); + dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints); ++dcol; } } @@ -799,40 +784,4 @@ SKVRow tdGetKVRowFromBuilder(SKVRowBuilder *pBuilder) { memcpy(kvRowValues(row), pBuilder->buf, pBuilder->size); return row; -} - -const void *tdGetNullVal(int8_t type) { - switch (type) { - case TSDB_DATA_TYPE_BOOL: - return &BoolNull; - case TSDB_DATA_TYPE_TINYINT: - return &TinyintNull; - case TSDB_DATA_TYPE_SMALLINT: - return &SmallintNull; - case TSDB_DATA_TYPE_INT: - return &IntNull; - case TSDB_DATA_TYPE_BIGINT: - return &BigintNull; - case TSDB_DATA_TYPE_FLOAT: - return &FloatNull; - case TSDB_DATA_TYPE_DOUBLE: - return &DoubleNull; - case TSDB_DATA_TYPE_BINARY: - return &BinaryNull; - case TSDB_DATA_TYPE_TIMESTAMP: - return &TimestampNull; - case TSDB_DATA_TYPE_NCHAR: - return &NcharNull; - case TSDB_DATA_TYPE_UTINYINT: - return &UTinyintNull; - case TSDB_DATA_TYPE_USMALLINT: - return &USmallintNull; - case TSDB_DATA_TYPE_UINT: - return &UIntNull; - case TSDB_DATA_TYPE_UBIGINT: - return &UBigintNull; - default: - ASSERT(0); - return NULL; - } } \ No newline at end of file diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 913b0936db..d4c52c9d1f 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -244,6 +244,19 @@ int32_t tsdbDebugFlag = 131; int32_t cqDebugFlag = 131; int32_t fsDebugFlag = 135; +#ifdef TD_TSZ +// +// lossy compress 6 +// +char lossyColumns[32] = ""; // "float|double" means all float and double columns can be lossy compressed. set empty can close lossy compress. +// below option can take effect when tsLossyColumns not empty +double fPrecision = 1E-8; // float column precision +double dPrecision = 1E-16; // double column precision +uint32_t maxIntervals = 500; // max intervals +uint32_t intervals = 100; // intervals +char Compressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPRESSOR +#endif + int32_t (*monStartSystemFp)() = NULL; void (*monStopSystemFp)() = NULL; void (*monExecuteSQLFp)(char *sql) = NULL; @@ -1517,6 +1530,62 @@ static void doInitGlobalConfig(void) { cfg.ptrLength = tListLen(tsTempDir); cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + +#ifdef TD_TSZ + // lossy compress + cfg.option = "lossyColumns"; + cfg.ptr = lossyColumns; + cfg.valType = TAOS_CFG_VTYPE_STRING; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = 0; + cfg.maxValue = 0; + cfg.ptrLength = tListLen(lossyColumns); + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + + cfg.option = "fPrecision"; + cfg.ptr = &fPrecision; + cfg.valType = TAOS_CFG_VTYPE_DOUBLE; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = MIN_FLOAT; + cfg.maxValue = MAX_FLOAT; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + + + taosInitConfigOption(cfg); + + cfg.option = "dPrecision"; + cfg.ptr = &dPrecision; + cfg.valType = TAOS_CFG_VTYPE_DOUBLE; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = MIN_FLOAT; + cfg.maxValue = MAX_FLOAT; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + + cfg.option = "maxIntervals"; + cfg.ptr = &maxIntervals; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = 0; + cfg.maxValue = 65536; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + + cfg.option = "intervals"; + cfg.ptr = &intervals; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = 0; + cfg.maxValue = 65536; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); +#endif + } void taosInitGlobalCfg() { diff --git a/src/common/src/tname.c b/src/common/src/tname.c index 72e2d42ff9..26502c5d9c 100644 --- a/src/common/src/tname.c +++ b/src/common/src/tname.c @@ -306,7 +306,7 @@ bool tIsValidName(const SName* name) { SName* tNameDup(const SName* name) { assert(name != NULL); - SName* p = calloc(1, sizeof(SName)); + SName* p = malloc(sizeof(SName)); memcpy(p, name, sizeof(SName)); return p; } diff --git a/src/common/src/ttypes.c b/src/common/src/ttypes.c index 34dda32401..6021a8f579 100644 --- a/src/common/src/ttypes.c +++ b/src/common/src/ttypes.c @@ -492,30 +492,32 @@ void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems) { } } -static uint8_t nullBool = TSDB_DATA_BOOL_NULL; -static uint8_t nullTinyInt = TSDB_DATA_TINYINT_NULL; -static uint16_t nullSmallInt = TSDB_DATA_SMALLINT_NULL; -static uint32_t nullInt = TSDB_DATA_INT_NULL; -static uint64_t nullBigInt = TSDB_DATA_BIGINT_NULL; -static uint32_t nullFloat = TSDB_DATA_FLOAT_NULL; -static uint64_t nullDouble = TSDB_DATA_DOUBLE_NULL; -static uint8_t nullTinyIntu = TSDB_DATA_UTINYINT_NULL; -static uint16_t nullSmallIntu = TSDB_DATA_USMALLINT_NULL; -static uint32_t nullIntu = TSDB_DATA_UINT_NULL; -static uint64_t nullBigIntu = TSDB_DATA_UBIGINT_NULL; +static uint8_t nullBool = TSDB_DATA_BOOL_NULL; +static uint8_t nullTinyInt = TSDB_DATA_TINYINT_NULL; +static uint16_t nullSmallInt = TSDB_DATA_SMALLINT_NULL; +static uint32_t nullInt = TSDB_DATA_INT_NULL; +static uint64_t nullBigInt = TSDB_DATA_BIGINT_NULL; +static uint32_t nullFloat = TSDB_DATA_FLOAT_NULL; +static uint64_t nullDouble = TSDB_DATA_DOUBLE_NULL; +static uint8_t nullTinyIntu = TSDB_DATA_UTINYINT_NULL; +static uint16_t nullSmallIntu = TSDB_DATA_USMALLINT_NULL; +static uint32_t nullIntu = TSDB_DATA_UINT_NULL; +static uint64_t nullBigIntu = TSDB_DATA_UBIGINT_NULL; +static SBinaryNullT nullBinary = {1, TSDB_DATA_BINARY_NULL}; +static SNCharNullT nullNchar = {4, TSDB_DATA_NCHAR_NULL}; -static union { - tstr str; - char pad[sizeof(tstr) + 4]; -} nullBinary = {.str = {.len = 1}}, nullNchar = {.str = {.len = 4}}; +// static union { +// tstr str; +// char pad[sizeof(tstr) + 4]; +// } nullBinary = {.str = {.len = 1}}, nullNchar = {.str = {.len = 4}}; -static void *nullValues[] = { +static const void *nullValues[] = { &nullBool, &nullTinyInt, &nullSmallInt, &nullInt, &nullBigInt, &nullFloat, &nullDouble, &nullBinary, &nullBigInt, &nullNchar, &nullTinyIntu, &nullSmallIntu, &nullIntu, &nullBigIntu, }; -void *getNullValue(int32_t type) { +const void *getNullValue(int32_t type) { assert(type >= TSDB_DATA_TYPE_BOOL && type <= TSDB_DATA_TYPE_UBIGINT); return nullValues[type - 1]; } diff --git a/src/connector/jdbc/pom.xml b/src/connector/jdbc/pom.xml index a1aa41b351..0043536daf 100644 --- a/src/connector/jdbc/pom.xml +++ b/src/connector/jdbc/pom.xml @@ -37,13 +37,6 @@ - - junit - junit - 4.13.1 - test - - org.apache.httpcomponents httpclient @@ -52,12 +45,18 @@ com.alibaba fastjson - 1.2.58 + 1.2.76 com.google.guava guava - 30.0-jre + 30.1.1-jre + + + junit + junit + 4.13.1 + test diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractConnection.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractConnection.java index b3887d436b..9950dbeb64 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractConnection.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractConnection.java @@ -171,11 +171,7 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti // do nothing } - @Override - public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - if (isClosed()) - throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED); - + private void checkResultSetTypeAndResultSetConcurrency(int resultSetType, int resultSetConcurrency) throws SQLException { switch (resultSetType) { case ResultSet.TYPE_FORWARD_ONLY: break; @@ -194,7 +190,14 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti default: throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_VARIABLE); } + } + @Override + public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { + if (isClosed()) + throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED); + + checkResultSetTypeAndResultSetConcurrency(resultSetType, resultSetConcurrency); return createStatement(); } @@ -203,24 +206,7 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti if (isClosed()) throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED); - switch (resultSetType) { - case ResultSet.TYPE_FORWARD_ONLY: - break; - case ResultSet.TYPE_SCROLL_INSENSITIVE: - case ResultSet.TYPE_SCROLL_SENSITIVE: - throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNSUPPORTED_METHOD); - default: - throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_VARIABLE); - } - - switch (resultSetConcurrency) { - case ResultSet.CONCUR_READ_ONLY: - break; - case ResultSet.CONCUR_UPDATABLE: - throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNSUPPORTED_METHOD); - default: - throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_VARIABLE); - } + checkResultSetTypeAndResultSetConcurrency(resultSetType, resultSetConcurrency); return prepareStatement(sql); } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/EmptyResultSet.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/EmptyResultSet.java index 64b4276e93..fa8bf9e7e9 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/EmptyResultSet.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/EmptyResultSet.java @@ -326,7 +326,7 @@ public class EmptyResultSet implements ResultSet { @Override public int getFetchDirection() throws SQLException { - return 0; + return ResultSet.FETCH_FORWARD; } @Override @@ -341,12 +341,12 @@ public class EmptyResultSet implements ResultSet { @Override public int getType() throws SQLException { - return 0; + return ResultSet.TYPE_FORWARD_ONLY; } @Override public int getConcurrency() throws SQLException { - return 0; + return ResultSet.CONCUR_READ_ONLY; } @Override @@ -746,7 +746,7 @@ public class EmptyResultSet implements ResultSet { @Override public int getHoldability() throws SQLException { - return 0; + return ResultSet.CLOSE_CURSORS_AT_COMMIT; } @Override diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java index 714162b563..a796e6d86f 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java @@ -40,7 +40,7 @@ public class TSDBErrorNumbers { public static final int ERROR_JNI_FETCH_END = 0x2358; // fetch to the end of resultSet public static final int ERROR_JNI_OUT_OF_MEMORY = 0x2359; // JNI alloc memory failed - private static final Set errorNumbers = new HashSet(); + private static final Set errorNumbers = new HashSet<>(); static { errorNumbers.add(ERROR_CONNECTION_CLOSED); diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java index d435062ef6..f0ea03638f 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java @@ -61,7 +61,7 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet { return; // parse row data for (int rowIndex = 0; rowIndex < data.size(); rowIndex++) { - List row = new ArrayList(); + List row = new ArrayList<>(); JSONArray jsonRow = data.getJSONArray(rowIndex); for (int colIndex = 0; colIndex < this.metaData.getColumnCount(); colIndex++) { row.add(parseColumnData(jsonRow, colIndex, columns.get(colIndex).taos_type)); diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java index 715b051b74..e10bdb5aa9 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java @@ -9,6 +9,7 @@ import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.conn.ConnectionKeepAliveStrategy; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.message.BasicHeaderElementIterator; @@ -34,7 +35,11 @@ public class HttpClientPoolUtil { PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); connectionManager.setDefaultMaxPerRoute(DEFAULT_MAX_PER_ROUTE); connectionManager.setMaxTotal(DEFAULT_MAX_TOTAL); - httpClient = HttpClients.custom().setKeepAliveStrategy(DEFAULT_KEEP_ALIVE_STRATEGY).setConnectionManager(connectionManager).build(); + httpClient = HttpClients.custom() + .setKeepAliveStrategy(DEFAULT_KEEP_ALIVE_STRATEGY) + .setConnectionManager(connectionManager) + .setRetryHandler(new DefaultHttpRequestRetryHandler(3, true)) + .build(); } } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/OSUtils.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/OSUtils.java index a67b4763f9..1af3e9666c 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/OSUtils.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/OSUtils.java @@ -4,14 +4,14 @@ public class OSUtils { private static final String OS = System.getProperty("os.name").toLowerCase(); public static boolean isWindows() { - return OS.indexOf("win") >= 0; + return OS.contains("win"); } public static boolean isMac() { - return OS.indexOf("mac") >= 0; + return OS.contains("mac"); } public static boolean isLinux() { - return OS.indexOf("nux") >= 0; + return OS.contains("nux"); } } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java index 15faa41a27..0f99ff4f66 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java @@ -16,7 +16,7 @@ package com.taosdata.jdbc.utils; public class SqlSyntaxValidator { - private static final String[] SQL = {"select", "insert", "import", "create", "use", "alter", "drop", "set", "show", "describe"}; + private static final String[] SQL = {"select", "insert", "import", "create", "use", "alter", "drop", "set", "show", "describe", "reset"}; private static final String[] updateSQL = {"insert", "import", "create", "use", "alter", "drop", "set"}; private static final String[] querySQL = {"select", "show", "describe"}; @@ -61,29 +61,11 @@ public class SqlSyntaxValidator { public static boolean isUseSql(String sql) { return sql.trim().toLowerCase().startsWith("use"); -// || sql.trim().toLowerCase().matches("create\\s*database.*") || sql.toLowerCase().toLowerCase().matches("drop\\s*database.*"); - } - - public static boolean isShowSql(String sql) { - return sql.trim().toLowerCase().startsWith("show"); - } - - public static boolean isDescribeSql(String sql) { - return sql.trim().toLowerCase().startsWith("describe"); - } - - - public static boolean isInsertSql(String sql) { - return sql.trim().toLowerCase().startsWith("insert") || sql.trim().toLowerCase().startsWith("import"); } public static boolean isSelectSql(String sql) { return sql.trim().toLowerCase().startsWith("select"); } - public static boolean isShowDatabaseSql(String sql) { - return sql.trim().toLowerCase().matches("show\\s*databases"); - } - } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TaosInfo.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TaosInfo.java index ee1364ce21..a427103770 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TaosInfo.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TaosInfo.java @@ -7,9 +7,9 @@ import java.util.concurrent.atomic.AtomicLong; public class TaosInfo implements TaosInfoMBean { private static volatile TaosInfo instance; - private AtomicLong connect_open = new AtomicLong(); - private AtomicLong connect_close = new AtomicLong(); - private AtomicLong statement_count = new AtomicLong(); + private final AtomicLong connect_open = new AtomicLong(); + private final AtomicLong connect_close = new AtomicLong(); + private final AtomicLong statement_count = new AtomicLong(); static { try { diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java index c91bacbfdc..9cf61903f0 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/Utils.java @@ -22,8 +22,7 @@ import java.util.stream.IntStream; public class Utils { - private static Pattern ptn = Pattern.compile(".*?'"); - + private static final Pattern ptn = Pattern.compile(".*?'"); private static final DateTimeFormatter milliSecFormatter = new DateTimeFormatterBuilder().appendPattern("yyyy-MM-dd HH:mm:ss.SSS").toFormatter(); private static final DateTimeFormatter microSecFormatter = new DateTimeFormatterBuilder().appendPattern("yyyy-MM-dd HH:mm:ss.SSSSSS").toFormatter(); private static final DateTimeFormatter nanoSecFormatter = new DateTimeFormatterBuilder().appendPattern("yyyy-MM-dd HH:mm:ss.SSSSSSSSS").toFormatter(); @@ -74,7 +73,7 @@ public class Utils { public static String escapeSingleQuota(String origin) { Matcher m = ptn.matcher(origin); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); int end = 0; while (m.find()) { end = m.end(); @@ -87,7 +86,7 @@ public class Utils { sb.append(seg); } } else { // len > 1 - sb.append(seg.substring(0, seg.length() - 2)); + sb.append(seg, 0, seg.length() - 2); char lastcSec = seg.charAt(seg.length() - 2); if (lastcSec == '\\') { sb.append("\\'"); @@ -195,7 +194,7 @@ public class Utils { public static String formatTimestamp(Timestamp timestamp) { int nanos = timestamp.getNanos(); - if (nanos % 1000000l != 0) + if (nanos % 1000000L != 0) return timestamp.toLocalDateTime().format(microSecFormatter); return timestamp.toLocalDateTime().format(milliSecFormatter); } diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java index 30c6d99a40..7cdda572a7 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import javax.management.OperationsException; import java.sql.*; import java.util.Properties; diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java index bbcbd33ebd..88ff5d3a81 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java @@ -1,16 +1,16 @@ package com.taosdata.jdbc; import org.junit.Test; -import static org.junit.Assert.*; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; import java.sql.SQLException; import java.sql.SQLWarning; import java.util.ArrayList; import java.util.List; -import java.lang.management.ManagementFactory; -import java.lang.management.RuntimeMXBean; -import java.lang.management.ThreadMXBean; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class TSDBJNIConnectorTest { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java index 83caf1bebb..dc41d85cf3 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java @@ -1,6 +1,5 @@ package com.taosdata.jdbc; -import com.taosdata.jdbc.rs.RestfulParameterMetaData; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java index e48237755f..6bddd3f428 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java @@ -2,7 +2,6 @@ package com.taosdata.jdbc; import org.junit.*; -import java.io.IOException; import java.math.BigDecimal; import java.sql.*; import java.util.ArrayList; @@ -26,7 +25,7 @@ public class TSDBPreparedStatementTest { long ts = System.currentTimeMillis(); pstmt_insert.setTimestamp(1, new Timestamp(ts)); pstmt_insert.setInt(2, 2); - pstmt_insert.setLong(3, 3l); + pstmt_insert.setLong(3, 3L); pstmt_insert.setFloat(4, 3.14f); pstmt_insert.setDouble(5, 3.1415); pstmt_insert.setShort(6, (short) 6); @@ -53,8 +52,8 @@ public class TSDBPreparedStatementTest { Assert.assertEquals(ts, rs.getTimestamp(1).getTime()); Assert.assertEquals(2, rs.getInt(2)); Assert.assertEquals(2, rs.getInt("f1")); - Assert.assertEquals(3l, rs.getLong(3)); - Assert.assertEquals(3l, rs.getLong("f2")); + Assert.assertEquals(3L, rs.getLong(3)); + Assert.assertEquals(3L, rs.getLong("f2")); Assert.assertEquals(3.14f, rs.getFloat(4), 0.0); Assert.assertEquals(3.14f, rs.getFloat("f3"), 0.0); Assert.assertEquals(3.1415, rs.getDouble(5), 0.0); @@ -312,14 +311,14 @@ public class TSDBPreparedStatementTest { Random r = new Random(); s.setTableName("weather_test"); - ArrayList ts = new ArrayList(); + ArrayList ts = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { ts.add(System.currentTimeMillis() + i); } s.setTimestamp(0, ts); int random = 10 + r.nextInt(5); - ArrayList s2 = new ArrayList(); + ArrayList s2 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s2.add(null); @@ -330,7 +329,7 @@ public class TSDBPreparedStatementTest { s.setNString(1, s2, 4); random = 10 + r.nextInt(5); - ArrayList s3 = new ArrayList(); + ArrayList s3 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s3.add(null); @@ -341,7 +340,7 @@ public class TSDBPreparedStatementTest { s.setFloat(2, s3); random = 10 + r.nextInt(5); - ArrayList s4 = new ArrayList(); + ArrayList s4 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s4.add(null); @@ -352,7 +351,7 @@ public class TSDBPreparedStatementTest { s.setDouble(3, s4); random = 10 + r.nextInt(5); - ArrayList ts2 = new ArrayList(); + ArrayList ts2 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { ts2.add(null); @@ -379,13 +378,13 @@ public class TSDBPreparedStatementTest { if (i % random == 0) { sb.add(null); } else { - sb.add(i % 2 == 0 ? true : false); + sb.add(i % 2 == 0); } } s.setBoolean(6, sb); random = 10 + r.nextInt(5); - ArrayList s5 = new ArrayList(); + ArrayList s5 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s5.add(null); @@ -424,14 +423,14 @@ public class TSDBPreparedStatementTest { Random r = new Random(); s.setTableName("weather_test"); - ArrayList ts = new ArrayList(); + ArrayList ts = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { ts.add(System.currentTimeMillis() + i); } s.setTimestamp(0, ts); int random = 10 + r.nextInt(5); - ArrayList s2 = new ArrayList(); + ArrayList s2 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s2.add(null); @@ -442,7 +441,7 @@ public class TSDBPreparedStatementTest { s.setNString(1, s2, 4); random = 10 + r.nextInt(5); - ArrayList s3 = new ArrayList(); + ArrayList s3 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { if (i % random == 0) { s3.add(null); @@ -471,7 +470,7 @@ public class TSDBPreparedStatementTest { public void bindDataWithSingleTagTest() throws SQLException { Statement stmt = conn.createStatement(); - String types[] = new String[]{"tinyint", "smallint", "int", "bigint", "bool", "float", "double", "binary(10)", "nchar(10)"}; + String[] types = new String[]{"tinyint", "smallint", "int", "bigint", "bool", "float", "double", "binary(10)", "nchar(10)"}; for (String type : types) { stmt.execute("drop table if exists weather_test"); @@ -510,21 +509,21 @@ public class TSDBPreparedStatementTest { } - ArrayList ts = new ArrayList(); + ArrayList ts = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { ts.add(System.currentTimeMillis() + i); } s.setTimestamp(0, ts); int random = 10 + r.nextInt(5); - ArrayList s2 = new ArrayList(); + ArrayList s2 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { s2.add("分支" + i % 4); } s.setNString(1, s2, 10); random = 10 + r.nextInt(5); - ArrayList s3 = new ArrayList(); + ArrayList s3 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { s3.add("test" + i % 4); } @@ -561,13 +560,13 @@ public class TSDBPreparedStatementTest { s.setTagString(1, "test"); - ArrayList ts = new ArrayList(); + ArrayList ts = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { ts.add(System.currentTimeMillis() + i); } s.setTimestamp(0, ts); - ArrayList s2 = new ArrayList(); + ArrayList s2 = new ArrayList<>(); for (int i = 0; i < numOfRows; i++) { s2.add("test" + i % 4); } @@ -788,7 +787,7 @@ public class TSDBPreparedStatementTest { public void setBigDecimal() throws SQLException { // given long ts = System.currentTimeMillis(); - BigDecimal bigDecimal = new BigDecimal(3.14444); + BigDecimal bigDecimal = new BigDecimal("3.14444"); // when pstmt_insert.setTimestamp(1, new Timestamp(ts)); @@ -999,7 +998,7 @@ public class TSDBPreparedStatementTest { long ts = System.currentTimeMillis(); pstmt_insert.setTimestamp(1, new Timestamp(ts)); pstmt_insert.setInt(2, 2); - pstmt_insert.setLong(3, 3l); + pstmt_insert.setLong(3, 3L); pstmt_insert.setFloat(4, 3.14f); pstmt_insert.setDouble(5, 3.1415); pstmt_insert.setShort(6, (short) 6); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java index ec54a44b7c..f72cbbec8c 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java @@ -95,13 +95,13 @@ public class TSDBResultSetTest { @Test public void getBigDecimal() throws SQLException { BigDecimal f1 = rs.getBigDecimal("f1"); - Assert.assertEquals(1609430400000l, f1.longValue()); + Assert.assertEquals(1609430400000L, f1.longValue()); BigDecimal f2 = rs.getBigDecimal("f2"); Assert.assertEquals(1, f2.intValue()); BigDecimal f3 = rs.getBigDecimal("f3"); - Assert.assertEquals(100l, f3.longValue()); + Assert.assertEquals(100L, f3.longValue()); BigDecimal f4 = rs.getBigDecimal("f4"); Assert.assertEquals(3.1415f, f4.floatValue(), 0.00000f); @@ -125,13 +125,13 @@ public class TSDBResultSetTest { Assert.assertEquals(1, Ints.fromByteArray(f2)); byte[] f3 = rs.getBytes("f3"); - Assert.assertEquals(100l, Longs.fromByteArray(f3)); + Assert.assertEquals(100L, Longs.fromByteArray(f3)); byte[] f4 = rs.getBytes("f4"); - Assert.assertEquals(3.1415f, Float.valueOf(new String(f4)), 0.000000f); + Assert.assertEquals(3.1415f, Float.parseFloat(new String(f4)), 0.000000f); byte[] f5 = rs.getBytes("f5"); - Assert.assertEquals(3.1415926, Double.valueOf(new String(f5)), 0.000000f); + Assert.assertEquals(3.1415926, Double.parseDouble(new String(f5)), 0.000000f); byte[] f6 = rs.getBytes("f6"); Assert.assertTrue(Arrays.equals("abc".getBytes(), f6)); @@ -223,7 +223,7 @@ public class TSDBResultSetTest { Object f3 = rs.getObject("f3"); Assert.assertEquals(Long.class, f3.getClass()); - Assert.assertEquals(100l, f3); + Assert.assertEquals(100L, f3); Object f4 = rs.getObject("f4"); Assert.assertEquals(Float.class, f4.getClass()); @@ -421,7 +421,7 @@ public class TSDBResultSetTest { @Test(expected = SQLFeatureNotSupportedException.class) public void updateLong() throws SQLException { - rs.updateLong(1, 1l); + rs.updateLong(1, 1L); } @Test(expected = SQLFeatureNotSupportedException.class) diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/BadLocaleSettingTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/BadLocaleSettingTest.java index b351ee94bb..2211e0fa17 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/BadLocaleSettingTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/BadLocaleSettingTest.java @@ -3,12 +3,13 @@ package com.taosdata.jdbc.cases; import com.taosdata.jdbc.TSDBDriver; import org.junit.AfterClass; -import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import java.io.IOException; -import java.sql.*; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; import java.util.Properties; public class BadLocaleSettingTest { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java index 31893527af..fcb6ab7aaf 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java @@ -1,6 +1,7 @@ package com.taosdata.jdbc.cases; import com.taosdata.jdbc.TSDBDriver; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -9,13 +10,13 @@ import java.util.Properties; public class ConnectMultiTaosdByRestfulWithDifferentTokenTest { - private static String host1 = "192.168.17.156"; - private static String user1 = "root"; - private static String password1 = "tqueue"; + private static final String host1 = "192.168.17.156"; + private static final String user1 = "root"; + private static final String password1 = "tqueue"; private Connection conn1; - private static String host2 = "192.168.17.82"; - private static String user2 = "root"; - private static String password2 = "taosdata"; + private static final String host2 = "192.168.17.82"; + private static final String user2 = "root"; + private static final String password2 = "taosdata"; private Connection conn2; @Test @@ -30,6 +31,7 @@ public class ConnectMultiTaosdByRestfulWithDifferentTokenTest { try (Statement stmt = connection.createStatement()) { ResultSet rs = stmt.executeQuery("select server_status()"); ResultSetMetaData meta = rs.getMetaData(); + Assert.assertNotNull(meta); while (rs.next()) { } } catch (SQLException e) { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/DriverAutoloadTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/DriverAutoloadTest.java index 6c8aed1b06..a00c8f4f97 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/DriverAutoloadTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/DriverAutoloadTest.java @@ -13,7 +13,7 @@ import java.util.Properties; public class DriverAutoloadTest { private Properties properties; - private String host = "127.0.0.1"; + private final String host = "127.0.0.1"; @Test public void testRestful() throws SQLException { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java index 84149775c3..beea990456 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java @@ -13,9 +13,9 @@ import java.util.Random; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class InsertDbwithoutUseDbTest { - private static String host = "127.0.0.1"; + private static final String host = "127.0.0.1"; private static Properties properties; - private static Random random = new Random(System.currentTimeMillis()); + private static final Random random = new Random(System.currentTimeMillis()); @Test public void case001() throws ClassNotFoundException, SQLException { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java index 4b4e83719f..9f8243542f 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java @@ -8,14 +8,14 @@ public class InsertSpecialCharacterJniTest { private static final String host = "127.0.0.1"; private static Connection conn; - private static String dbName = "spec_char_test"; - private static String tbname1 = "test"; - private static String tbname2 = "weather"; - private static String special_character_str_1 = "$asd$$fsfsf$"; - private static String special_character_str_2 = "\\\\asdfsfsf\\\\"; - private static String special_character_str_3 = "\\\\asdfsfsf\\"; - private static String special_character_str_4 = "?asd??fsf?sf?"; - private static String special_character_str_5 = "?#sd@$f(('<(s[P)>\"){]}f?s[]{}%vaew|\"fsfs^a&d*jhg)(j))(f@~!?$"; + private static final String dbName = "spec_char_test"; + private static final String tbname1 = "test"; + private static final String tbname2 = "weather"; + private static final String special_character_str_1 = "$asd$$fsfsf$"; + private static final String special_character_str_2 = "\\\\asdfsfsf\\\\"; + private static final String special_character_str_3 = "\\\\asdfsfsf\\"; + private static final String special_character_str_4 = "?asd??fsf?sf?"; + private static final String special_character_str_5 = "?#sd@$f(('<(s[P)>\"){]}f?s[]{}%vaew|\"fsfs^a&d*jhg)(j))(f@~!?$"; @Test public void testCase01() throws SQLException { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java index fa6cbd22b5..2e981e7f41 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java @@ -8,14 +8,14 @@ public class InsertSpecialCharacterRestfulTest { private static final String host = "127.0.0.1"; private static Connection conn; - private static String dbName = "spec_char_test"; - private static String tbname1 = "test"; - private static String tbname2 = "weather"; - private static String special_character_str_1 = "$asd$$fsfsf$"; - private static String special_character_str_2 = "\\\\asdfsfsf\\\\"; - private static String special_character_str_3 = "\\\\asdfsfsf\\"; - private static String special_character_str_4 = "?asd??fsf?sf?"; - private static String special_character_str_5 = "?#sd@$f(('<(s[P)>\"){]}f?s[]{}%vaew|\"fsfs^a&d*jhg)(j))(f@~!?$"; + private static final String dbName = "spec_char_test"; + private static final String tbname1 = "test"; + private static final String tbname2 = "weather"; + private static final String special_character_str_1 = "$asd$$fsfsf$"; + private static final String special_character_str_2 = "\\\\asdfsfsf\\\\"; + private static final String special_character_str_3 = "\\\\asdfsfsf\\"; + private static final String special_character_str_4 = "?asd??fsf?sf?"; + private static final String special_character_str_5 = "?#sd@$f(('<(s[P)>\"){]}f?s[]{}%vaew|\"fsfs^a&d*jhg)(j))(f@~!?$"; @Test public void testCase01() throws SQLException { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java index f3d79b1df1..6febdd8497 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java @@ -8,13 +8,13 @@ import java.util.Properties; public class InvalidResultSetPointerTest { - private static String host = "127.0.0.1"; + private static final String host = "127.0.0.1"; private static final String dbName = "test"; private static final String stbName = "stb"; private static final String tbName = "tb"; private static Connection connection; - private static int numOfSTb = 30000; - private static int numOfTb = 3; + private static final int numOfSTb = 30000; + private static final int numOfTb = 3; private static int numOfThreads = 100; @Test @@ -74,7 +74,7 @@ public class InvalidResultSetPointerTest { b = numOfSTb % numOfThreads; } - multiThreadingClass instance[] = new multiThreadingClass[numOfThreads]; + multiThreadingClass[] instance = new multiThreadingClass[numOfThreads]; int last = 0; for (int i = 0; i < numOfThreads; i++) { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatementTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatementTest.java index da6853d2fa..73da79f357 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatementTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatementTest.java @@ -9,8 +9,7 @@ import java.util.concurrent.TimeUnit; public class MultiThreadsWithSameStatementTest { - - private class Service { + private static class Service { public Connection conn; public Statement stmt; diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ResetQueryCacheTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ResetQueryCacheTest.java new file mode 100644 index 0000000000..4eebbd08e8 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ResetQueryCacheTest.java @@ -0,0 +1,51 @@ +package com.taosdata.jdbc.cases; + +import com.taosdata.jdbc.TSDBDriver; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.sql.*; +import java.util.Properties; + +import static org.junit.Assert.assertEquals; + +public class ResetQueryCacheTest { + + static Connection connection; + static Statement statement; + static String host = "127.0.0.1"; + + @Before + public void init() { + try { + Properties properties = new Properties(); + properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8"); + properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8"); + properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); + connection = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/", properties); + statement = connection.createStatement(); + } catch (SQLException e) { + return; + } + } + + @Test + public void testResetQueryCache() throws SQLException { + String resetSql = "reset query cache"; + statement.execute(resetSql); + } + + @After + public void close() { + try { + if (statement != null) + statement.close(); + if (connection != null) + connection.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + +} \ No newline at end of file diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java index 332c171c38..1600fec13d 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java @@ -16,9 +16,9 @@ import static org.junit.Assert.assertEquals; public class StableTest { private static Connection connection; - private static String dbName = "test"; - private static String stbName = "st"; - private static String host = "127.0.0.1"; + private static final String dbName = "test"; + private static final String stbName = "st"; + private static final String host = "127.0.0.1"; @BeforeClass public static void createDatabase() { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TaosInfoMonitorTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TaosInfoMonitorTest.java index e9e36e20c4..7df9f73807 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TaosInfoMonitorTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TaosInfoMonitorTest.java @@ -25,7 +25,7 @@ public class TaosInfoMonitorTest { return null; }).collect(Collectors.toList()); - connectionList.stream().forEach(conn -> { + connectionList.forEach(conn -> { try (Statement stmt = conn.createStatement()) { ResultSet rs = stmt.executeQuery("show databases"); while (rs.next()) { @@ -37,7 +37,7 @@ public class TaosInfoMonitorTest { } }); - connectionList.stream().forEach(conn -> { + connectionList.forEach(conn -> { try { conn.close(); TimeUnit.MILLISECONDS.sleep(100); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java index 042d76d576..72734cb0ec 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java @@ -22,7 +22,7 @@ public class TimestampPrecisionInNanoInJniTest { private static final long timestamp3 = (timestamp1 + 10) * 1000_000 + 123456; private static final Format format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); private static final String date1 = format.format(new Date(timestamp1)); - private static final String date4 = format.format(new Date(timestamp1 + 10l)); + private static final String date4 = format.format(new Date(timestamp1 + 10L)); private static final String date2 = date1 + "123455"; private static final String date3 = date4 + "123456"; diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java index fb23c0e64a..e4149793ac 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java @@ -44,7 +44,7 @@ public class UnsignedNumberJniTest { Assert.assertEquals(127, rs.getByte(2)); Assert.assertEquals(32767, rs.getShort(3)); Assert.assertEquals(2147483647, rs.getInt(4)); - Assert.assertEquals(9223372036854775807l, rs.getLong(5)); + Assert.assertEquals(9223372036854775807L, rs.getLong(5)); } } catch (SQLException e) { e.printStackTrace(); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java index a659a490cb..3bdf5ae4f2 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java @@ -45,7 +45,7 @@ public class UnsignedNumberRestfulTest { Assert.assertEquals(127, rs.getByte(2)); Assert.assertEquals(32767, rs.getShort(3)); Assert.assertEquals(2147483647, rs.getInt(4)); - Assert.assertEquals(9223372036854775807l, rs.getLong(5)); + Assert.assertEquals(9223372036854775807L, rs.getLong(5)); } } catch (SQLException e) { e.printStackTrace(); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java index 81e762c5ca..21a91669b2 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetTest.java @@ -95,13 +95,13 @@ public class RestfulResultSetTest { public void getBigDecimal() throws SQLException { BigDecimal f1 = rs.getBigDecimal("f1"); long actual = (f1 == null) ? 0 : f1.longValue(); - Assert.assertEquals(1609430400000l, actual); + Assert.assertEquals(1609430400000L, actual); BigDecimal f2 = rs.getBigDecimal("f2"); Assert.assertEquals(1, f2.intValue()); BigDecimal f3 = rs.getBigDecimal("f3"); - Assert.assertEquals(100l, f3.longValue()); + Assert.assertEquals(100L, f3.longValue()); BigDecimal f4 = rs.getBigDecimal("f4"); Assert.assertEquals(3.1415f, f4.floatValue(), 0.00000f); @@ -125,13 +125,13 @@ public class RestfulResultSetTest { Assert.assertEquals(1, Ints.fromByteArray(f2)); byte[] f3 = rs.getBytes("f3"); - Assert.assertEquals(100l, Longs.fromByteArray(f3)); + Assert.assertEquals(100L, Longs.fromByteArray(f3)); byte[] f4 = rs.getBytes("f4"); - Assert.assertEquals(3.1415f, Float.valueOf(new String(f4)), 0.000000f); + Assert.assertEquals(3.1415f, Float.parseFloat(new String(f4)), 0.000000f); byte[] f5 = rs.getBytes("f5"); - Assert.assertEquals(3.1415926, Double.valueOf(new String(f5)), 0.000000f); + Assert.assertEquals(3.1415926, Double.parseDouble(new String(f5)), 0.000000f); byte[] f6 = rs.getBytes("f6"); Assert.assertEquals("abc", new String(f6)); @@ -222,7 +222,7 @@ public class RestfulResultSetTest { Object f3 = rs.getObject("f3"); Assert.assertEquals(Long.class, f3.getClass()); - Assert.assertEquals(100l, f3); + Assert.assertEquals(100L, f3); Object f4 = rs.getObject("f4"); Assert.assertEquals(Float.class, f4.getClass()); @@ -434,7 +434,7 @@ public class RestfulResultSetTest { @Test(expected = SQLFeatureNotSupportedException.class) public void updateLong() throws SQLException { - rs.updateLong(1, 1l); + rs.updateLong(1, 1L); } @Test(expected = SQLFeatureNotSupportedException.class) diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/OSUtilsTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/OSUtilsTest.java index fd6c83ad1c..269a19e7a0 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/OSUtilsTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/OSUtilsTest.java @@ -10,17 +10,17 @@ public class OSUtilsTest { @Test public void inWindows() { - Assert.assertEquals(OS.indexOf("win") >= 0, OSUtils.isWindows()); + Assert.assertEquals(OS.contains("win"), OSUtils.isWindows()); } @Test public void isMac() { - Assert.assertEquals(OS.indexOf("mac") >= 0, OSUtils.isMac()); + Assert.assertEquals(OS.contains("mac"), OSUtils.isMac()); } @Test public void isLinux() { - Assert.assertEquals(OS.indexOf("nux") >= 0, OSUtils.isLinux()); + Assert.assertEquals(OS.contains("nux"), OSUtils.isLinux()); } @Before diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/TimestampUtil.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/TimestampUtil.java index 16f8269d24..eaebd92d8e 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/TimestampUtil.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/TimestampUtil.java @@ -21,47 +21,4 @@ public class TimestampUtil { SimpleDateFormat sdf = new SimpleDateFormat(datetimeFormat); return sdf.format(new Date(time)); } - - public static class TimeTuple { - public Long start; - public Long end; - public Long timeGap; - - TimeTuple(long start, long end, long timeGap) { - this.start = start; - this.end = end; - this.timeGap = timeGap; - } - } - - public static TimeTuple range(long start, long timeGap, long size) { - long now = System.currentTimeMillis(); - if (timeGap < 1) - timeGap = 1; - if (start == 0) - start = now - size * timeGap; - - // 如果size小于1异常 - if (size < 1) - throw new IllegalArgumentException("size less than 1."); - // 如果timeGap为1,已经超长,需要前移start - if (start + size > now) { - start = now - size; - return new TimeTuple(start, now, 1); - } - long end = start + (long) (timeGap * size); - if (end > now) { - //压缩timeGap - end = now; - double gap = (end - start) / (size * 1.0f); - if (gap < 1.0f) { - timeGap = 1; - start = end - size; - } else { - timeGap = (long) gap; - end = start + (long) (timeGap * size); - } - } - return new TimeTuple(start, end, timeGap); - } } diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/UtilsTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/UtilsTest.java index 4b8ec61078..1cbd95b249 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/UtilsTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/UtilsTest.java @@ -3,8 +3,6 @@ package com.taosdata.jdbc.utils; import org.junit.Assert; import org.junit.Test; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Stream; public class UtilsTest { @@ -19,14 +17,14 @@ public class UtilsTest { Assert.assertEquals("\\'\\'\\'\\'\\'a\\'", news); // given - s = "\'''''a\\'"; + s = "'''''a\\'"; // when news = Utils.escapeSingleQuota(s); // then Assert.assertEquals("\\'\\'\\'\\'\\'a\\'", news); // given - s = "\'\'\'\''a\\'"; + s = "'''''a\\'"; // when news = Utils.escapeSingleQuota(s); // then diff --git a/src/cq/src/cqMain.c b/src/cq/src/cqMain.c index cd762f3110..aac5a1c665 100644 --- a/src/cq/src/cqMain.c +++ b/src/cq/src/cqMain.c @@ -490,9 +490,9 @@ static void cqProcessStreamRes(void *param, TAOS_RES *tres, TAOS_ROW row) { for (int32_t i = 0; i < pSchema->numOfCols; i++) { STColumn *c = pSchema->columns + i; - void* val = row[i]; + void *val = row[i]; if (val == NULL) { - val = getNullValue(c->type); + val = (void *)getNullValue(c->type); } else if (c->type == TSDB_DATA_TYPE_BINARY) { val = ((char*)val) - sizeof(VarDataLenT); } else if (c->type == TSDB_DATA_TYPE_NCHAR) { diff --git a/src/dnode/src/dnodeMPeer.c b/src/dnode/src/dnodeMPeer.c index e4942c49aa..8aa28d1618 100644 --- a/src/dnode/src/dnodeMPeer.c +++ b/src/dnode/src/dnodeMPeer.c @@ -150,6 +150,8 @@ static void *dnodeProcessMPeerQueue(void *param) { SMnodeMsg *pPeerMsg; int32_t type; void * unUsed; + + setThreadName("dnodeMPeerQ"); while (1) { if (taosReadQitemFromQset(tsMPeerQset, &type, (void **)&pPeerMsg, &unUsed) == 0) { diff --git a/src/dnode/src/dnodeMRead.c b/src/dnode/src/dnodeMRead.c index 90332e6783..184a6b743a 100644 --- a/src/dnode/src/dnodeMRead.c +++ b/src/dnode/src/dnodeMRead.c @@ -155,6 +155,8 @@ static void *dnodeProcessMReadQueue(void *param) { int32_t type; void * unUsed; + setThreadName("dnodeMReadQ"); + while (1) { if (taosReadQitemFromQset(tsMReadQset, &type, (void **)&pRead, &unUsed) == 0) { dDebug("qset:%p, mnode read got no message from qset, exiting", tsMReadQset); diff --git a/src/dnode/src/dnodeMWrite.c b/src/dnode/src/dnodeMWrite.c index a409d537fa..904ddc21d0 100644 --- a/src/dnode/src/dnodeMWrite.c +++ b/src/dnode/src/dnodeMWrite.c @@ -168,7 +168,9 @@ static void *dnodeProcessMWriteQueue(void *param) { SMnodeMsg *pWrite; int32_t type; void * unUsed; - + + setThreadName("dnodeMWriteQ"); + while (1) { if (taosReadQitemFromQset(tsMWriteQset, &type, (void **)&pWrite, &unUsed) == 0) { dDebug("qset:%p, mnode write got no message from qset, exiting", tsMWriteQset); diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 7723b6221b..61244ac0fb 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -42,6 +42,7 @@ #include "module.h" #include "qScript.h" #include "mnode.h" +#include "tscompression.h" #if !defined(_MODULE) || !defined(_TD_LINUX) int32_t moduleStart() { return 0; } @@ -236,6 +237,12 @@ static void dnodeCheckDataDirOpenned(char *dir) { } static int32_t dnodeInitStorage() { +#ifdef TD_TSZ + // compress module init + tsCompressInit(); +#endif + + // storage module init if (tsDiskCfgNum == 1 && dnodeCreateDir(tsDataDir) < 0) { dError("failed to create dir: %s, reason: %s", tsDataDir, strerror(errno)); return -1; @@ -311,7 +318,15 @@ static int32_t dnodeInitStorage() { return 0; } -static void dnodeCleanupStorage() { tfsDestroy(); } +static void dnodeCleanupStorage() { + // storage destroy + tfsDestroy(); + + #ifdef TD_TSZ + // compress destroy + tsCompressExit(); + #endif +} bool dnodeIsFirstDeploy() { return strcmp(tsFirst, tsLocalEp) == 0; diff --git a/src/dnode/src/dnodeTelemetry.c b/src/dnode/src/dnodeTelemetry.c index 4caece1661..59b66879d4 100644 --- a/src/dnode/src/dnodeTelemetry.c +++ b/src/dnode/src/dnodeTelemetry.c @@ -245,6 +245,8 @@ static void* telemetryThread(void* param) { clock_gettime(CLOCK_REALTIME, &end); end.tv_sec += 300; // wait 5 minutes before send first report + setThreadName("telemetryThrd"); + while (!tsExit) { int r = 0; struct timespec ts = end; diff --git a/src/dnode/src/dnodeVMgmt.c b/src/dnode/src/dnodeVMgmt.c index daf62aac94..c1bfb1460b 100644 --- a/src/dnode/src/dnodeVMgmt.c +++ b/src/dnode/src/dnodeVMgmt.c @@ -103,6 +103,8 @@ static void *dnodeProcessMgmtQueue(void *wparam) { int32_t qtype; void * handle; + setThreadName("dnodeMgmtQ"); + while (1) { if (taosReadQitemFromQset(pPool->qset, &qtype, (void **)&pMgmt, &handle) == 0) { dDebug("qdnode mgmt got no message from qset:%p, , exit", pPool->qset); diff --git a/src/dnode/src/dnodeVRead.c b/src/dnode/src/dnodeVRead.c index 41016d7b99..e8003a8fe7 100644 --- a/src/dnode/src/dnodeVRead.c +++ b/src/dnode/src/dnodeVRead.c @@ -118,6 +118,11 @@ static void *dnodeProcessReadQueue(void *wparam) { SVReadMsg * pRead; int32_t qtype; void * pVnode; + char name[16]; + + memset(name, 0, 16); + snprintf(name, 16, "%s-dnReadQ", pPool->name); + setThreadName(name); while (1) { if (taosReadQitemFromQset(pPool->qset, &qtype, (void **)&pRead, &pVnode) == 0) { diff --git a/src/dnode/src/dnodeVWrite.c b/src/dnode/src/dnodeVWrite.c index ff2d12f001..ed2a6e2109 100644 --- a/src/dnode/src/dnodeVWrite.c +++ b/src/dnode/src/dnodeVWrite.c @@ -191,6 +191,8 @@ static void *dnodeProcessVWriteQueue(void *wparam) { taosBlockSIGPIPE(); dDebug("dnode vwrite worker:%d is running", pWorker->workerId); + setThreadName("dnodeWriteQ"); + while (1) { numOfMsgs = taosReadAllQitemsFromQset(pWorker->qset, pWorker->qall, &pVnode); if (numOfMsgs == 0) { diff --git a/src/dnode/src/dnodeVnodes.c b/src/dnode/src/dnodeVnodes.c index f01a510370..8ea8e280de 100644 --- a/src/dnode/src/dnodeVnodes.c +++ b/src/dnode/src/dnodeVnodes.c @@ -91,6 +91,8 @@ static void *dnodeOpenVnode(void *param) { dDebug("thread:%d, start to open %d vnodes", pThread->threadIndex, pThread->vnodeNum); + setThreadName("dnodeOpenVnode"); + for (int32_t v = 0; v < pThread->vnodeNum; ++v) { int32_t vgId = pThread->vnodeList[v]; snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to restore, %d of %d have been opened", vgId, tsOpenVnodes, tsTotalVnodes); diff --git a/src/inc/taos.h b/src/inc/taos.h index a62f387924..ba53c1ca8f 100644 --- a/src/inc/taos.h +++ b/src/inc/taos.h @@ -72,6 +72,7 @@ DLL_EXPORT int taos_init(); DLL_EXPORT void taos_cleanup(void); DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...); 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_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); @@ -110,21 +111,23 @@ typedef struct TAOS_MULTI_BIND { } TAOS_MULTI_BIND; -TAOS_STMT *taos_stmt_init(TAOS *taos); -int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length); -int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags); -int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name); -int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert); -int taos_stmt_num_params(TAOS_STMT *stmt, int *nums); + +DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos); +DLL_EXPORT int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length); +DLL_EXPORT int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags); +DLL_EXPORT int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name); +DLL_EXPORT int taos_stmt_set_sub_tbname(TAOS_STMT* stmt, const char* name); +DLL_EXPORT int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert); +DLL_EXPORT int taos_stmt_num_params(TAOS_STMT *stmt, int *nums); int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes); -int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind); +DLL_EXPORT int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind); int taos_stmt_bind_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind); int taos_stmt_bind_single_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int colIdx); -int taos_stmt_add_batch(TAOS_STMT *stmt); -int taos_stmt_execute(TAOS_STMT *stmt); -TAOS_RES * taos_stmt_use_result(TAOS_STMT *stmt); -int taos_stmt_close(TAOS_STMT *stmt); -char * taos_stmt_errstr(TAOS_STMT *stmt); +DLL_EXPORT int taos_stmt_add_batch(TAOS_STMT *stmt); +DLL_EXPORT int taos_stmt_execute(TAOS_STMT *stmt); +DLL_EXPORT TAOS_RES * taos_stmt_use_result(TAOS_STMT *stmt); +DLL_EXPORT int taos_stmt_close(TAOS_STMT *stmt); +DLL_EXPORT char * taos_stmt_errstr(TAOS_STMT *stmt); DLL_EXPORT TAOS_RES *taos_query(TAOS *taos, const char *sql); DLL_EXPORT TAOS_ROW taos_fetch_row(TAOS_RES *res); @@ -139,10 +142,10 @@ DLL_EXPORT int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int n DLL_EXPORT void taos_stop_query(TAOS_RES *res); DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col); -int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); -int taos_validate_sql(TAOS *taos, const char *sql); +DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); +DLL_EXPORT int taos_validate_sql(TAOS *taos, const char *sql); -int* taos_fetch_lengths(TAOS_RES *res); +DLL_EXPORT int* taos_fetch_lengths(TAOS_RES *res); // TAOS_RES *taos_list_tables(TAOS *mysql, const char *wild); // TAOS_RES *taos_list_dbs(TAOS *mysql, const char *wild); diff --git a/src/inc/ttype.h b/src/inc/ttype.h index 8def1cefe2..6e436bd23d 100644 --- a/src/inc/ttype.h +++ b/src/inc/ttype.h @@ -20,6 +20,18 @@ typedef struct tstr { char data[]; } tstr; +#pragma pack(push, 1) +typedef struct { + VarDataLenT len; + uint8_t data; +} SBinaryNullT; + +typedef struct { + VarDataLenT len; + uint32_t data; +} SNCharNullT; +#pragma pack(pop) + #define VARSTR_HEADER_SIZE sizeof(VarDataLenT) #define varDataLen(v) ((VarDataLenT *)(v))[0] @@ -182,7 +194,7 @@ bool isValidDataType(int32_t type); void setVardataNull(char* val, int32_t type); void setNull(char *val, int32_t type, int32_t bytes); void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems); -void *getNullValue(int32_t type); +const void *getNullValue(int32_t type); void assignVal(char *val, const char *src, int32_t len, int32_t type); void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf); diff --git a/src/kit/CMakeLists.txt b/src/kit/CMakeLists.txt index 7053052007..fdf58d5ae1 100644 --- a/src/kit/CMakeLists.txt +++ b/src/kit/CMakeLists.txt @@ -4,3 +4,4 @@ PROJECT(TDengine) ADD_SUBDIRECTORY(shell) ADD_SUBDIRECTORY(taosdemo) ADD_SUBDIRECTORY(taosdump) +ADD_SUBDIRECTORY(taospack) diff --git a/src/kit/shell/src/shellCheck.c b/src/kit/shell/src/shellCheck.c index 4ff5dc36fc..d78f1a6b99 100644 --- a/src/kit/shell/src/shellCheck.c +++ b/src/kit/shell/src/shellCheck.c @@ -104,6 +104,8 @@ static void shellFreeTbnames() { static void *shellCheckThreadFp(void *arg) { ShellThreadObj *pThread = (ShellThreadObj *)arg; + setThreadName("shellCheckThrd"); + int32_t interval = tbNum / pThread->totalThreads + 1; int32_t start = pThread->threadIndex * interval; int32_t end = (pThread->threadIndex + 1) * interval; diff --git a/src/kit/shell/src/shellDarwin.c b/src/kit/shell/src/shellDarwin.c index 31ad7046e9..86c0fea573 100644 --- a/src/kit/shell/src/shellDarwin.c +++ b/src/kit/shell/src/shellDarwin.c @@ -336,6 +336,8 @@ void *shellLoopQuery(void *arg) { TAOS *con = (TAOS *)arg; + setThreadName("shellLoopQuery"); + pthread_cleanup_push(cleanup_handler, NULL); char *command = malloc(MAX_COMMAND_SIZE); diff --git a/src/kit/shell/src/shellImport.c b/src/kit/shell/src/shellImport.c index 5de50a3aaf..222d69e854 100644 --- a/src/kit/shell/src/shellImport.c +++ b/src/kit/shell/src/shellImport.c @@ -223,6 +223,8 @@ static void shellSourceFile(TAOS *con, char *fptr) { void* shellImportThreadFp(void *arg) { ShellThreadObj *pThread = (ShellThreadObj*)arg; + setThreadName("shellImportThrd"); + for (int f = 0; f < shellSQLFileNum; ++f) { if (f % pThread->totalThreads == pThread->threadIndex) { char *SQLFileName = shellSQLFiles[f]; diff --git a/src/kit/shell/src/shellLinux.c b/src/kit/shell/src/shellLinux.c index 4eead252fd..2a32a8d82e 100644 --- a/src/kit/shell/src/shellLinux.c +++ b/src/kit/shell/src/shellLinux.c @@ -336,6 +336,8 @@ void *shellLoopQuery(void *arg) { TAOS *con = (TAOS *)arg; + setThreadName("shellLoopQuery"); + pthread_cleanup_push(cleanup_handler, NULL); char *command = malloc(MAX_COMMAND_SIZE); diff --git a/src/kit/shell/src/shellMain.c b/src/kit/shell/src/shellMain.c index 4c7e550760..0c70386061 100644 --- a/src/kit/shell/src/shellMain.c +++ b/src/kit/shell/src/shellMain.c @@ -26,6 +26,8 @@ void shellQueryInterruptHandler(int32_t signum, void *sigInfo, void *context) { } void *cancelHandler(void *arg) { + setThreadName("cancelHandler"); + while(1) { if (tsem_wait(&cancelSem) != 0) { taosMsleep(10); diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 2beb0c8e7e..1630d6f895 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -55,6 +55,11 @@ #define STMT_IFACE_ENABLED 1 #define NANO_SECOND_ENABLED 1 +#define SET_THREADNAME_ENABLED 1 + +#if SET_THREADNAME_ENABLED == 0 +#define setThreadName(name) +#endif #define REQ_EXTRA_BUF_LEN 1024 #define RESP_BUF_LEN 4096 @@ -71,9 +76,9 @@ extern char configDir[]; #define HEAD_BUFF_LEN TSDB_MAX_COLUMNS*24 // 16*MAX_COLUMNS + (192+32)*2 + insert into .. -#define COL_BUFFER_LEN (TSDB_MAX_BYTES_PER_ROW - 50) -#define BUFFER_SIZE (50 + TSDB_DB_NAME_LEN + TSDB_TABLE_NAME_LEN + TSDB_MAX_BYTES_PER_ROW + TSDB_MAX_TAGS_LEN) +#define BUFFER_SIZE TSDB_MAX_ALLOWED_SQL_LEN #define COND_BUF_LEN (BUFFER_SIZE - 30) +#define COL_BUFFER_LEN ((TSDB_COL_NAME_LEN + 15) * TSDB_MAX_COLUMNS) #define MAX_USERNAME_SIZE 64 #define MAX_PASSWORD_SIZE 64 #define MAX_HOSTNAME_SIZE 64 @@ -90,7 +95,7 @@ extern char configDir[]; #define MAX_SUPER_TABLE_COUNT 200 #define MAX_QUERY_SQL_COUNT 100 -#define MAX_QUERY_SQL_LENGTH 1024 +#define MAX_QUERY_SQL_LENGTH BUFFER_SIZE #define MAX_DATABASE_COUNT 256 #define INPUT_BUF_LEN 256 @@ -2367,7 +2372,25 @@ static char* getTagValueFromTagSample(SSuperTable* stbInfo, int tagUsePos) { return dataBuf; } -static char* generateTagVaulesForStb(SSuperTable* stbInfo, int32_t tableSeq) { +static char *generateBinaryNCharTagValues(int64_t tableSeq, uint32_t len) +{ + char* buf = (char*)calloc(len, 1); + if (NULL == buf) { + printf("calloc failed! size:%d\n", len); + return NULL; + } + + if (tableSeq % 2) { + tstrncpy(buf, "beijing", len); + } else { + tstrncpy(buf, "shanghai", len); + } + //rand_string(buf, stbInfo->tags[i].dataLen); + + return buf; +} + +static char* generateTagValuesForStb(SSuperTable* stbInfo, int64_t tableSeq) { char* dataBuf = (char*)calloc(TSDB_MAX_SQL_LEN+1, 1); if (NULL == dataBuf) { printf("calloc failed! size:%d\n", TSDB_MAX_SQL_LEN+1); @@ -2388,70 +2411,62 @@ static char* generateTagVaulesForStb(SSuperTable* stbInfo, int32_t tableSeq) { return NULL; } - int tagBufLen = stbInfo->tags[i].dataLen + 1; - char* buf = (char*)calloc(tagBufLen, 1); + int32_t tagBufLen = stbInfo->tags[i].dataLen + 1; + char *buf = generateBinaryNCharTagValues(tableSeq, tagBufLen); if (NULL == buf) { - printf("calloc failed! size:%d\n", stbInfo->tags[i].dataLen); tmfree(dataBuf); return NULL; } - - if (tableSeq % 2) { - tstrncpy(buf, "beijing", tagBufLen); - } else { - tstrncpy(buf, "shanghai", tagBufLen); - } - //rand_string(buf, stbInfo->tags[i].dataLen); dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "\'%s\', ", buf); + "\'%s\',", buf); tmfree(buf); } else if (0 == strncasecmp(stbInfo->tags[i].dataType, "int", strlen("int"))) { if ((g_args.demo_mode) && (i == 0)) { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%d, ", tableSeq % 10); + "%"PRId64",", tableSeq % 10); } else { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%d, ", tableSeq); + "%"PRId64",", tableSeq); } } else if (0 == strncasecmp(stbInfo->tags[i].dataType, "bigint", strlen("bigint"))) { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%"PRId64", ", rand_bigint()); + "%"PRId64",", rand_bigint()); } else if (0 == strncasecmp(stbInfo->tags[i].dataType, "float", strlen("float"))) { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%f, ", rand_float()); + "%f,", rand_float()); } else if (0 == strncasecmp(stbInfo->tags[i].dataType, "double", strlen("double"))) { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%f, ", rand_double()); + "%f,", rand_double()); } else if (0 == strncasecmp(stbInfo->tags[i].dataType, "smallint", strlen("smallint"))) { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%d, ", rand_smallint()); + "%d,", rand_smallint()); } else if (0 == strncasecmp(stbInfo->tags[i].dataType, "tinyint", strlen("tinyint"))) { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%d, ", rand_tinyint()); + "%d,", rand_tinyint()); } else if (0 == strncasecmp(stbInfo->tags[i].dataType, "bool", strlen("bool"))) { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%d, ", rand_bool()); + "%d,", rand_bool()); } else if (0 == strncasecmp(stbInfo->tags[i].dataType, "timestamp", strlen("timestamp"))) { dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, - "%"PRId64", ", rand_bigint()); + "%"PRId64",", rand_bigint()); } else { - printf("No support data type: %s\n", stbInfo->tags[i].dataType); + errorPrint("No support data type: %s\n", stbInfo->tags[i].dataType); tmfree(dataBuf); return NULL; } } - dataLen -= 2; + dataLen -= 1; dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, ")"); return dataBuf; } @@ -2723,12 +2738,12 @@ static int createSuperTable( if (strcasecmp(dataType, "BINARY") == 0) { len += snprintf(cols + len, COL_BUFFER_LEN - len, - ", C%d %s(%d)", colIndex, "BINARY", + ",C%d %s(%d)", colIndex, "BINARY", superTbl->columns[colIndex].dataLen); lenOfOneRow += superTbl->columns[colIndex].dataLen + 3; } else if (strcasecmp(dataType, "NCHAR") == 0) { len += snprintf(cols + len, COL_BUFFER_LEN - len, - ", C%d %s(%d)", colIndex, "NCHAR", + ",C%d %s(%d)", colIndex, "NCHAR", superTbl->columns[colIndex].dataLen); lenOfOneRow += superTbl->columns[colIndex].dataLen + 3; } else if (strcasecmp(dataType, "INT") == 0) { @@ -2736,22 +2751,22 @@ static int createSuperTable( len += snprintf(cols + len, COL_BUFFER_LEN - len, ", VOLTAGE INT"); } else { - len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", colIndex, "INT"); + len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s", colIndex, "INT"); } lenOfOneRow += 11; } else if (strcasecmp(dataType, "BIGINT") == 0) { - len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", + len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s", colIndex, "BIGINT"); lenOfOneRow += 21; } else if (strcasecmp(dataType, "SMALLINT") == 0) { - len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", + len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s", colIndex, "SMALLINT"); lenOfOneRow += 6; } else if (strcasecmp(dataType, "TINYINT") == 0) { - len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", colIndex, "TINYINT"); + len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s", colIndex, "TINYINT"); lenOfOneRow += 4; } else if (strcasecmp(dataType, "BOOL") == 0) { - len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", colIndex, "BOOL"); + len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s", colIndex, "BOOL"); lenOfOneRow += 6; } else if (strcasecmp(dataType, "FLOAT") == 0) { if (g_args.demo_mode) { @@ -2761,16 +2776,16 @@ static int createSuperTable( len += snprintf(cols + len, COL_BUFFER_LEN - len, ", PHASE FLOAT"); } } else { - len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", colIndex, "FLOAT"); + len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s", colIndex, "FLOAT"); } lenOfOneRow += 22; } else if (strcasecmp(dataType, "DOUBLE") == 0) { - len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", + len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s", colIndex, "DOUBLE"); lenOfOneRow += 42; } else if (strcasecmp(dataType, "TIMESTAMP") == 0) { - len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", + len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s", colIndex, "TIMESTAMP"); lenOfOneRow += 21; } else { @@ -2814,17 +2829,17 @@ static int createSuperTable( if (strcasecmp(dataType, "BINARY") == 0) { if ((g_args.demo_mode) && (tagIndex == 1)) { len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, - "location BINARY(%d), ", + "location BINARY(%d),", superTbl->tags[tagIndex].dataLen); } else { len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, - "t%d %s(%d), ", tagIndex, "BINARY", + "T%d %s(%d),", tagIndex, "BINARY", superTbl->tags[tagIndex].dataLen); } lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3; } else if (strcasecmp(dataType, "NCHAR") == 0) { len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, - "t%d %s(%d), ", tagIndex, + "T%d %s(%d),", tagIndex, "NCHAR", superTbl->tags[tagIndex].dataLen); lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3; } else if (strcasecmp(dataType, "INT") == 0) { @@ -2833,32 +2848,32 @@ static int createSuperTable( "groupId INT, "); } else { len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, - "t%d %s, ", tagIndex, "INT"); + "T%d %s,", tagIndex, "INT"); } lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 11; } else if (strcasecmp(dataType, "BIGINT") == 0) { len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, - "t%d %s, ", tagIndex, "BIGINT"); + "T%d %s,", tagIndex, "BIGINT"); lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 21; } else if (strcasecmp(dataType, "SMALLINT") == 0) { len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, - "t%d %s, ", tagIndex, "SMALLINT"); + "T%d %s,", tagIndex, "SMALLINT"); lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6; } else if (strcasecmp(dataType, "TINYINT") == 0) { len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, - "t%d %s, ", tagIndex, "TINYINT"); + "T%d %s,", tagIndex, "TINYINT"); lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 4; } else if (strcasecmp(dataType, "BOOL") == 0) { len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, - "t%d %s, ", tagIndex, "BOOL"); + "T%d %s,", tagIndex, "BOOL"); lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6; } else if (strcasecmp(dataType, "FLOAT") == 0) { len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, - "t%d %s, ", tagIndex, "FLOAT"); + "T%d %s,", tagIndex, "FLOAT"); lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 22; } else if (strcasecmp(dataType, "DOUBLE") == 0) { len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, - "t%d %s, ", tagIndex, "DOUBLE"); + "T%d %s,", tagIndex, "DOUBLE"); lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 42; } else { taos_close(taos); @@ -2868,7 +2883,7 @@ static int createSuperTable( } } - len -= 2; + len -= 1; len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, ")"); superTbl->lenOfTagOfOneRow = lenOfTagOfOneRow; @@ -3025,10 +3040,11 @@ static void* createTable(void *sarg) threadInfo *pThreadInfo = (threadInfo *)sarg; SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + setThreadName("createTable"); + uint64_t lastPrintTime = taosGetTimestampMs(); - int buff_len; - buff_len = BUFFER_SIZE; + int buff_len = BUFFER_SIZE; pThreadInfo->buffer = calloc(buff_len, 1); if (pThreadInfo->buffer == NULL) { @@ -3066,7 +3082,7 @@ static void* createTable(void *sarg) } char* tagsValBuf = NULL; if (0 == superTblInfo->tagSource) { - tagsValBuf = generateTagVaulesForStb(superTblInfo, i); + tagsValBuf = generateTagValuesForStb(superTblInfo, i); } else { tagsValBuf = getTagValueFromTagSample( superTblInfo, @@ -4275,577 +4291,577 @@ PARSE_OVER: } static bool getMetaFromQueryJsonFile(cJSON* root) { - bool ret = false; + bool ret = false; - cJSON* cfgdir = cJSON_GetObjectItem(root, "cfgdir"); - if (cfgdir && cfgdir->type == cJSON_String && cfgdir->valuestring != NULL) { - tstrncpy(g_queryInfo.cfgDir, cfgdir->valuestring, MAX_FILE_NAME_LEN); - } + cJSON* cfgdir = cJSON_GetObjectItem(root, "cfgdir"); + if (cfgdir && cfgdir->type == cJSON_String && cfgdir->valuestring != NULL) { + tstrncpy(g_queryInfo.cfgDir, cfgdir->valuestring, MAX_FILE_NAME_LEN); + } - cJSON* host = cJSON_GetObjectItem(root, "host"); - if (host && host->type == cJSON_String && host->valuestring != NULL) { - tstrncpy(g_queryInfo.host, host->valuestring, MAX_HOSTNAME_SIZE); - } else if (!host) { - tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_HOSTNAME_SIZE); - } else { - printf("ERROR: failed to read json, host not found\n"); - goto PARSE_OVER; - } - - cJSON* port = cJSON_GetObjectItem(root, "port"); - if (port && port->type == cJSON_Number) { - g_queryInfo.port = port->valueint; - } else if (!port) { - g_queryInfo.port = 6030; - } - - cJSON* user = cJSON_GetObjectItem(root, "user"); - if (user && user->type == cJSON_String && user->valuestring != NULL) { - tstrncpy(g_queryInfo.user, user->valuestring, MAX_USERNAME_SIZE); - } else if (!user) { - tstrncpy(g_queryInfo.user, "root", MAX_USERNAME_SIZE); ; - } - - cJSON* password = cJSON_GetObjectItem(root, "password"); - if (password && password->type == cJSON_String && password->valuestring != NULL) { - tstrncpy(g_queryInfo.password, password->valuestring, MAX_PASSWORD_SIZE); - } else if (!password) { - tstrncpy(g_queryInfo.password, "taosdata", MAX_PASSWORD_SIZE);; - } - - cJSON *answerPrompt = cJSON_GetObjectItem(root, "confirm_parameter_prompt"); // yes, no, - if (answerPrompt && answerPrompt->type == cJSON_String - && answerPrompt->valuestring != NULL) { - if (0 == strncasecmp(answerPrompt->valuestring, "yes", 3)) { - g_args.answer_yes = false; - } else if (0 == strncasecmp(answerPrompt->valuestring, "no", 2)) { - g_args.answer_yes = true; + cJSON* host = cJSON_GetObjectItem(root, "host"); + if (host && host->type == cJSON_String && host->valuestring != NULL) { + tstrncpy(g_queryInfo.host, host->valuestring, MAX_HOSTNAME_SIZE); + } else if (!host) { + tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_HOSTNAME_SIZE); } else { - g_args.answer_yes = false; - } - } else if (!answerPrompt) { - g_args.answer_yes = false; - } else { - printf("ERROR: failed to read json, confirm_parameter_prompt not found\n"); - goto PARSE_OVER; - } - - cJSON* gQueryTimes = cJSON_GetObjectItem(root, "query_times"); - if (gQueryTimes && gQueryTimes->type == cJSON_Number) { - if (gQueryTimes->valueint <= 0) { - errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", - __func__, __LINE__); - goto PARSE_OVER; - } - g_args.query_times = gQueryTimes->valueint; - } else if (!gQueryTimes) { - g_args.query_times = 1; - } else { - errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", - __func__, __LINE__); - goto PARSE_OVER; - } - - cJSON* dbs = cJSON_GetObjectItem(root, "databases"); - if (dbs && dbs->type == cJSON_String && dbs->valuestring != NULL) { - tstrncpy(g_queryInfo.dbName, dbs->valuestring, TSDB_DB_NAME_LEN); - } else if (!dbs) { - printf("ERROR: failed to read json, databases not found\n"); - goto PARSE_OVER; - } - - cJSON* queryMode = cJSON_GetObjectItem(root, "query_mode"); - if (queryMode && queryMode->type == cJSON_String && queryMode->valuestring != NULL) { - tstrncpy(g_queryInfo.queryMode, queryMode->valuestring, MAX_TB_NAME_SIZE); - } else if (!queryMode) { - tstrncpy(g_queryInfo.queryMode, "taosc", MAX_TB_NAME_SIZE); - } else { - printf("ERROR: failed to read json, query_mode not found\n"); - goto PARSE_OVER; - } - - // specified_table_query - cJSON *specifiedQuery = cJSON_GetObjectItem(root, "specified_table_query"); - if (!specifiedQuery) { - g_queryInfo.specifiedQueryInfo.concurrent = 1; - g_queryInfo.specifiedQueryInfo.sqlCount = 0; - } else if (specifiedQuery->type != cJSON_Object) { - printf("ERROR: failed to read json, super_table_query not found\n"); - goto PARSE_OVER; - } else { - cJSON* queryInterval = cJSON_GetObjectItem(specifiedQuery, "query_interval"); - if (queryInterval && queryInterval->type == cJSON_Number) { - g_queryInfo.specifiedQueryInfo.queryInterval = queryInterval->valueint; - } else if (!queryInterval) { - g_queryInfo.specifiedQueryInfo.queryInterval = 0; - } - - cJSON* specifiedQueryTimes = cJSON_GetObjectItem(specifiedQuery, - "query_times"); - if (specifiedQueryTimes && specifiedQueryTimes->type == cJSON_Number) { - if (specifiedQueryTimes->valueint <= 0) { - errorPrint( - "%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n", - __func__, __LINE__, specifiedQueryTimes->valueint); + printf("ERROR: failed to read json, host not found\n"); goto PARSE_OVER; - - } - g_queryInfo.specifiedQueryInfo.queryTimes = specifiedQueryTimes->valueint; - } else if (!specifiedQueryTimes) { - g_queryInfo.specifiedQueryInfo.queryTimes = g_args.query_times; - } else { - errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", - __func__, __LINE__); - goto PARSE_OVER; } - cJSON* concurrent = cJSON_GetObjectItem(specifiedQuery, "concurrent"); - if (concurrent && concurrent->type == cJSON_Number) { - if (concurrent->valueint <= 0) { - errorPrint( - "%s() LN%d, query sqlCount %d or concurrent %d is not correct.\n", - __func__, __LINE__, - g_queryInfo.specifiedQueryInfo.sqlCount, - g_queryInfo.specifiedQueryInfo.concurrent); - goto PARSE_OVER; - } - g_queryInfo.specifiedQueryInfo.concurrent = concurrent->valueint; - } else if (!concurrent) { - g_queryInfo.specifiedQueryInfo.concurrent = 1; + cJSON* port = cJSON_GetObjectItem(root, "port"); + if (port && port->type == cJSON_Number) { + g_queryInfo.port = port->valueint; + } else if (!port) { + g_queryInfo.port = 6030; } - cJSON* specifiedAsyncMode = cJSON_GetObjectItem(specifiedQuery, "mode"); - if (specifiedAsyncMode && specifiedAsyncMode->type == cJSON_String - && specifiedAsyncMode->valuestring != NULL) { - if (0 == strcmp("sync", specifiedAsyncMode->valuestring)) { - g_queryInfo.specifiedQueryInfo.asyncMode = SYNC_MODE; - } else if (0 == strcmp("async", specifiedAsyncMode->valuestring)) { - g_queryInfo.specifiedQueryInfo.asyncMode = ASYNC_MODE; - } else { - errorPrint("%s() LN%d, failed to read json, async mode input error\n", - __func__, __LINE__); - goto PARSE_OVER; - } - } else { - g_queryInfo.specifiedQueryInfo.asyncMode = SYNC_MODE; + cJSON* user = cJSON_GetObjectItem(root, "user"); + if (user && user->type == cJSON_String && user->valuestring != NULL) { + tstrncpy(g_queryInfo.user, user->valuestring, MAX_USERNAME_SIZE); + } else if (!user) { + tstrncpy(g_queryInfo.user, "root", MAX_USERNAME_SIZE); ; } - cJSON* interval = cJSON_GetObjectItem(specifiedQuery, "interval"); - if (interval && interval->type == cJSON_Number) { - g_queryInfo.specifiedQueryInfo.subscribeInterval = interval->valueint; - } else if (!interval) { - //printf("failed to read json, subscribe interval no found\n"); - //goto PARSE_OVER; - g_queryInfo.specifiedQueryInfo.subscribeInterval = 10000; + cJSON* password = cJSON_GetObjectItem(root, "password"); + if (password && password->type == cJSON_String && password->valuestring != NULL) { + tstrncpy(g_queryInfo.password, password->valuestring, MAX_PASSWORD_SIZE); + } else if (!password) { + tstrncpy(g_queryInfo.password, "taosdata", MAX_PASSWORD_SIZE);; } - cJSON* restart = cJSON_GetObjectItem(specifiedQuery, "restart"); - if (restart && restart->type == cJSON_String && restart->valuestring != NULL) { - if (0 == strcmp("yes", restart->valuestring)) { - g_queryInfo.specifiedQueryInfo.subscribeRestart = true; - } else if (0 == strcmp("no", restart->valuestring)) { - g_queryInfo.specifiedQueryInfo.subscribeRestart = false; - } else { - printf("ERROR: failed to read json, subscribe restart error\n"); - goto PARSE_OVER; - } - } else { - g_queryInfo.specifiedQueryInfo.subscribeRestart = true; - } - - cJSON* keepProgress = cJSON_GetObjectItem(specifiedQuery, "keepProgress"); - if (keepProgress - && keepProgress->type == cJSON_String - && keepProgress->valuestring != NULL) { - if (0 == strcmp("yes", keepProgress->valuestring)) { - g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 1; - } else if (0 == strcmp("no", keepProgress->valuestring)) { - g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 0; - } else { - printf("ERROR: failed to read json, subscribe keepProgress error\n"); - goto PARSE_OVER; - } - } else { - g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 0; - } - - // sqls - cJSON* specifiedSqls = cJSON_GetObjectItem(specifiedQuery, "sqls"); - if (!specifiedSqls) { - g_queryInfo.specifiedQueryInfo.sqlCount = 0; - } else if (specifiedSqls->type != cJSON_Array) { - errorPrint("%s() LN%d, failed to read json, super sqls not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } else { - int superSqlSize = cJSON_GetArraySize(specifiedSqls); - if (superSqlSize * g_queryInfo.specifiedQueryInfo.concurrent - > MAX_QUERY_SQL_COUNT) { - errorPrint("%s() LN%d, failed to read json, query sql(%d) * concurrent(%d) overflow, max is %d\n", - __func__, __LINE__, - superSqlSize, - g_queryInfo.specifiedQueryInfo.concurrent, - MAX_QUERY_SQL_COUNT); - goto PARSE_OVER; - } - - g_queryInfo.specifiedQueryInfo.sqlCount = superSqlSize; - for (int j = 0; j < superSqlSize; ++j) { - cJSON* sql = cJSON_GetArrayItem(specifiedSqls, j); - if (sql == NULL) continue; - - cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql"); - if (!sqlStr || sqlStr->type != cJSON_String || sqlStr->valuestring == NULL) { - printf("ERROR: failed to read json, sql not found\n"); - goto PARSE_OVER; - } - tstrncpy(g_queryInfo.specifiedQueryInfo.sql[j], - sqlStr->valuestring, MAX_QUERY_SQL_LENGTH); - - // default value is -1, which mean infinite loop - g_queryInfo.specifiedQueryInfo.endAfterConsume[j] = -1; - cJSON* endAfterConsume = - cJSON_GetObjectItem(specifiedQuery, "endAfterConsume"); - if (endAfterConsume - && endAfterConsume->type == cJSON_Number) { - g_queryInfo.specifiedQueryInfo.endAfterConsume[j] - = endAfterConsume->valueint; - } - if (g_queryInfo.specifiedQueryInfo.endAfterConsume[j] < -1) - g_queryInfo.specifiedQueryInfo.endAfterConsume[j] = -1; - - g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] = -1; - cJSON* resubAfterConsume = - cJSON_GetObjectItem(specifiedQuery, "resubAfterConsume"); - if ((resubAfterConsume) - && (resubAfterConsume->type == cJSON_Number) - && (resubAfterConsume->valueint >= 0)) { - g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] - = resubAfterConsume->valueint; - } - - if (g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] < -1) - g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] = -1; - - cJSON *result = cJSON_GetObjectItem(sql, "result"); - if ((NULL != result) && (result->type == cJSON_String) - && (result->valuestring != NULL)) { - tstrncpy(g_queryInfo.specifiedQueryInfo.result[j], - result->valuestring, MAX_FILE_NAME_LEN); - } else if (NULL == result) { - memset(g_queryInfo.specifiedQueryInfo.result[j], - 0, MAX_FILE_NAME_LEN); + cJSON *answerPrompt = cJSON_GetObjectItem(root, "confirm_parameter_prompt"); // yes, no, + if (answerPrompt && answerPrompt->type == cJSON_String + && answerPrompt->valuestring != NULL) { + if (0 == strncasecmp(answerPrompt->valuestring, "yes", 3)) { + g_args.answer_yes = false; + } else if (0 == strncasecmp(answerPrompt->valuestring, "no", 2)) { + g_args.answer_yes = true; } else { - printf("ERROR: failed to read json, super query result file not found\n"); - goto PARSE_OVER; + g_args.answer_yes = false; } - } - } - } - - // super_table_query - cJSON *superQuery = cJSON_GetObjectItem(root, "super_table_query"); - if (!superQuery) { - g_queryInfo.superQueryInfo.threadCnt = 1; - g_queryInfo.superQueryInfo.sqlCount = 0; - } else if (superQuery->type != cJSON_Object) { - printf("ERROR: failed to read json, sub_table_query not found\n"); - ret = true; - goto PARSE_OVER; - } else { - cJSON* subrate = cJSON_GetObjectItem(superQuery, "query_interval"); - if (subrate && subrate->type == cJSON_Number) { - g_queryInfo.superQueryInfo.queryInterval = subrate->valueint; - } else if (!subrate) { - g_queryInfo.superQueryInfo.queryInterval = 0; - } - - cJSON* superQueryTimes = cJSON_GetObjectItem(superQuery, "query_times"); - if (superQueryTimes && superQueryTimes->type == cJSON_Number) { - if (superQueryTimes->valueint <= 0) { - errorPrint("%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n", - __func__, __LINE__, superQueryTimes->valueint); - goto PARSE_OVER; - } - g_queryInfo.superQueryInfo.queryTimes = superQueryTimes->valueint; - } else if (!superQueryTimes) { - g_queryInfo.superQueryInfo.queryTimes = g_args.query_times; + } else if (!answerPrompt) { + g_args.answer_yes = false; } else { - errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", - __func__, __LINE__); - goto PARSE_OVER; - } - - cJSON* threads = cJSON_GetObjectItem(superQuery, "threads"); - if (threads && threads->type == cJSON_Number) { - if (threads->valueint <= 0) { - errorPrint("%s() LN%d, failed to read json, threads input mistake\n", - __func__, __LINE__); + printf("ERROR: failed to read json, confirm_parameter_prompt not found\n"); goto PARSE_OVER; - - } - g_queryInfo.superQueryInfo.threadCnt = threads->valueint; - } else if (!threads) { - g_queryInfo.superQueryInfo.threadCnt = 1; } - //cJSON* subTblCnt = cJSON_GetObjectItem(superQuery, "childtable_count"); - //if (subTblCnt && subTblCnt->type == cJSON_Number) { - // g_queryInfo.superQueryInfo.childTblCount = subTblCnt->valueint; - //} else if (!subTblCnt) { - // g_queryInfo.superQueryInfo.childTblCount = 0; - //} - - cJSON* stblname = cJSON_GetObjectItem(superQuery, "stblname"); - if (stblname && stblname->type == cJSON_String - && stblname->valuestring != NULL) { - tstrncpy(g_queryInfo.superQueryInfo.sTblName, stblname->valuestring, - TSDB_TABLE_NAME_LEN); + cJSON* gQueryTimes = cJSON_GetObjectItem(root, "query_times"); + if (gQueryTimes && gQueryTimes->type == cJSON_Number) { + if (gQueryTimes->valueint <= 0) { + errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; + } + g_args.query_times = gQueryTimes->valueint; + } else if (!gQueryTimes) { + g_args.query_times = 1; } else { - errorPrint("%s() LN%d, failed to read json, super table name input error\n", - __func__, __LINE__); - goto PARSE_OVER; + errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; } - cJSON* superAsyncMode = cJSON_GetObjectItem(superQuery, "mode"); - if (superAsyncMode && superAsyncMode->type == cJSON_String - && superAsyncMode->valuestring != NULL) { - if (0 == strcmp("sync", superAsyncMode->valuestring)) { - g_queryInfo.superQueryInfo.asyncMode = SYNC_MODE; - } else if (0 == strcmp("async", superAsyncMode->valuestring)) { - g_queryInfo.superQueryInfo.asyncMode = ASYNC_MODE; - } else { - errorPrint("%s() LN%d, failed to read json, async mode input error\n", - __func__, __LINE__); + cJSON* dbs = cJSON_GetObjectItem(root, "databases"); + if (dbs && dbs->type == cJSON_String && dbs->valuestring != NULL) { + tstrncpy(g_queryInfo.dbName, dbs->valuestring, TSDB_DB_NAME_LEN); + } else if (!dbs) { + printf("ERROR: failed to read json, databases not found\n"); goto PARSE_OVER; - } + } + + cJSON* queryMode = cJSON_GetObjectItem(root, "query_mode"); + if (queryMode && queryMode->type == cJSON_String && queryMode->valuestring != NULL) { + tstrncpy(g_queryInfo.queryMode, queryMode->valuestring, MAX_TB_NAME_SIZE); + } else if (!queryMode) { + tstrncpy(g_queryInfo.queryMode, "taosc", MAX_TB_NAME_SIZE); } else { - g_queryInfo.superQueryInfo.asyncMode = SYNC_MODE; + printf("ERROR: failed to read json, query_mode not found\n"); + goto PARSE_OVER; } - cJSON* superInterval = cJSON_GetObjectItem(superQuery, "interval"); - if (superInterval && superInterval->type == cJSON_Number) { - if (superInterval->valueint < 0) { - errorPrint("%s() LN%d, failed to read json, interval input mistake\n", - __func__, __LINE__); + // specified_table_query + cJSON *specifiedQuery = cJSON_GetObjectItem(root, "specified_table_query"); + if (!specifiedQuery) { + g_queryInfo.specifiedQueryInfo.concurrent = 1; + g_queryInfo.specifiedQueryInfo.sqlCount = 0; + } else if (specifiedQuery->type != cJSON_Object) { + printf("ERROR: failed to read json, super_table_query not found\n"); goto PARSE_OVER; - } - g_queryInfo.superQueryInfo.subscribeInterval = superInterval->valueint; - } else if (!superInterval) { - //printf("failed to read json, subscribe interval no found\n"); - //goto PARSE_OVER; - g_queryInfo.superQueryInfo.subscribeInterval = 10000; - } - - cJSON* subrestart = cJSON_GetObjectItem(superQuery, "restart"); - if (subrestart && subrestart->type == cJSON_String - && subrestart->valuestring != NULL) { - if (0 == strcmp("yes", subrestart->valuestring)) { - g_queryInfo.superQueryInfo.subscribeRestart = true; - } else if (0 == strcmp("no", subrestart->valuestring)) { - g_queryInfo.superQueryInfo.subscribeRestart = false; - } else { - printf("ERROR: failed to read json, subscribe restart error\n"); - goto PARSE_OVER; - } } else { - g_queryInfo.superQueryInfo.subscribeRestart = true; + cJSON* queryInterval = cJSON_GetObjectItem(specifiedQuery, "query_interval"); + if (queryInterval && queryInterval->type == cJSON_Number) { + g_queryInfo.specifiedQueryInfo.queryInterval = queryInterval->valueint; + } else if (!queryInterval) { + g_queryInfo.specifiedQueryInfo.queryInterval = 0; + } + + cJSON* specifiedQueryTimes = cJSON_GetObjectItem(specifiedQuery, + "query_times"); + if (specifiedQueryTimes && specifiedQueryTimes->type == cJSON_Number) { + if (specifiedQueryTimes->valueint <= 0) { + errorPrint( + "%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n", + __func__, __LINE__, specifiedQueryTimes->valueint); + goto PARSE_OVER; + + } + g_queryInfo.specifiedQueryInfo.queryTimes = specifiedQueryTimes->valueint; + } else if (!specifiedQueryTimes) { + g_queryInfo.specifiedQueryInfo.queryTimes = g_args.query_times; + } else { + errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; + } + + cJSON* concurrent = cJSON_GetObjectItem(specifiedQuery, "concurrent"); + if (concurrent && concurrent->type == cJSON_Number) { + if (concurrent->valueint <= 0) { + errorPrint( + "%s() LN%d, query sqlCount %d or concurrent %d is not correct.\n", + __func__, __LINE__, + g_queryInfo.specifiedQueryInfo.sqlCount, + g_queryInfo.specifiedQueryInfo.concurrent); + goto PARSE_OVER; + } + g_queryInfo.specifiedQueryInfo.concurrent = concurrent->valueint; + } else if (!concurrent) { + g_queryInfo.specifiedQueryInfo.concurrent = 1; + } + + cJSON* specifiedAsyncMode = cJSON_GetObjectItem(specifiedQuery, "mode"); + if (specifiedAsyncMode && specifiedAsyncMode->type == cJSON_String + && specifiedAsyncMode->valuestring != NULL) { + if (0 == strcmp("sync", specifiedAsyncMode->valuestring)) { + g_queryInfo.specifiedQueryInfo.asyncMode = SYNC_MODE; + } else if (0 == strcmp("async", specifiedAsyncMode->valuestring)) { + g_queryInfo.specifiedQueryInfo.asyncMode = ASYNC_MODE; + } else { + errorPrint("%s() LN%d, failed to read json, async mode input error\n", + __func__, __LINE__); + goto PARSE_OVER; + } + } else { + g_queryInfo.specifiedQueryInfo.asyncMode = SYNC_MODE; + } + + cJSON* interval = cJSON_GetObjectItem(specifiedQuery, "interval"); + if (interval && interval->type == cJSON_Number) { + g_queryInfo.specifiedQueryInfo.subscribeInterval = interval->valueint; + } else if (!interval) { + //printf("failed to read json, subscribe interval no found\n"); + //goto PARSE_OVER; + g_queryInfo.specifiedQueryInfo.subscribeInterval = 10000; + } + + cJSON* restart = cJSON_GetObjectItem(specifiedQuery, "restart"); + if (restart && restart->type == cJSON_String && restart->valuestring != NULL) { + if (0 == strcmp("yes", restart->valuestring)) { + g_queryInfo.specifiedQueryInfo.subscribeRestart = true; + } else if (0 == strcmp("no", restart->valuestring)) { + g_queryInfo.specifiedQueryInfo.subscribeRestart = false; + } else { + printf("ERROR: failed to read json, subscribe restart error\n"); + goto PARSE_OVER; + } + } else { + g_queryInfo.specifiedQueryInfo.subscribeRestart = true; + } + + cJSON* keepProgress = cJSON_GetObjectItem(specifiedQuery, "keepProgress"); + if (keepProgress + && keepProgress->type == cJSON_String + && keepProgress->valuestring != NULL) { + if (0 == strcmp("yes", keepProgress->valuestring)) { + g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 1; + } else if (0 == strcmp("no", keepProgress->valuestring)) { + g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 0; + } else { + printf("ERROR: failed to read json, subscribe keepProgress error\n"); + goto PARSE_OVER; + } + } else { + g_queryInfo.specifiedQueryInfo.subscribeKeepProgress = 0; + } + + // sqls + cJSON* specifiedSqls = cJSON_GetObjectItem(specifiedQuery, "sqls"); + if (!specifiedSqls) { + g_queryInfo.specifiedQueryInfo.sqlCount = 0; + } else if (specifiedSqls->type != cJSON_Array) { + errorPrint("%s() LN%d, failed to read json, super sqls not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } else { + int superSqlSize = cJSON_GetArraySize(specifiedSqls); + if (superSqlSize * g_queryInfo.specifiedQueryInfo.concurrent + > MAX_QUERY_SQL_COUNT) { + errorPrint("%s() LN%d, failed to read json, query sql(%d) * concurrent(%d) overflow, max is %d\n", + __func__, __LINE__, + superSqlSize, + g_queryInfo.specifiedQueryInfo.concurrent, + MAX_QUERY_SQL_COUNT); + goto PARSE_OVER; + } + + g_queryInfo.specifiedQueryInfo.sqlCount = superSqlSize; + for (int j = 0; j < superSqlSize; ++j) { + cJSON* sql = cJSON_GetArrayItem(specifiedSqls, j); + if (sql == NULL) continue; + + cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql"); + if (!sqlStr || sqlStr->type != cJSON_String || sqlStr->valuestring == NULL) { + printf("ERROR: failed to read json, sql not found\n"); + goto PARSE_OVER; + } + tstrncpy(g_queryInfo.specifiedQueryInfo.sql[j], + sqlStr->valuestring, MAX_QUERY_SQL_LENGTH); + + // default value is -1, which mean infinite loop + g_queryInfo.specifiedQueryInfo.endAfterConsume[j] = -1; + cJSON* endAfterConsume = + cJSON_GetObjectItem(specifiedQuery, "endAfterConsume"); + if (endAfterConsume + && endAfterConsume->type == cJSON_Number) { + g_queryInfo.specifiedQueryInfo.endAfterConsume[j] + = endAfterConsume->valueint; + } + if (g_queryInfo.specifiedQueryInfo.endAfterConsume[j] < -1) + g_queryInfo.specifiedQueryInfo.endAfterConsume[j] = -1; + + g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] = -1; + cJSON* resubAfterConsume = + cJSON_GetObjectItem(specifiedQuery, "resubAfterConsume"); + if ((resubAfterConsume) + && (resubAfterConsume->type == cJSON_Number) + && (resubAfterConsume->valueint >= 0)) { + g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] + = resubAfterConsume->valueint; + } + + if (g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] < -1) + g_queryInfo.specifiedQueryInfo.resubAfterConsume[j] = -1; + + cJSON *result = cJSON_GetObjectItem(sql, "result"); + if ((NULL != result) && (result->type == cJSON_String) + && (result->valuestring != NULL)) { + tstrncpy(g_queryInfo.specifiedQueryInfo.result[j], + result->valuestring, MAX_FILE_NAME_LEN); + } else if (NULL == result) { + memset(g_queryInfo.specifiedQueryInfo.result[j], + 0, MAX_FILE_NAME_LEN); + } else { + printf("ERROR: failed to read json, super query result file not found\n"); + goto PARSE_OVER; + } + } + } } - cJSON* superkeepProgress = cJSON_GetObjectItem(superQuery, "keepProgress"); - if (superkeepProgress && - superkeepProgress->type == cJSON_String - && superkeepProgress->valuestring != NULL) { - if (0 == strcmp("yes", superkeepProgress->valuestring)) { - g_queryInfo.superQueryInfo.subscribeKeepProgress = 1; - } else if (0 == strcmp("no", superkeepProgress->valuestring)) { - g_queryInfo.superQueryInfo.subscribeKeepProgress = 0; - } else { - printf("ERROR: failed to read json, subscribe super table keepProgress error\n"); + // super_table_query + cJSON *superQuery = cJSON_GetObjectItem(root, "super_table_query"); + if (!superQuery) { + g_queryInfo.superQueryInfo.threadCnt = 1; + g_queryInfo.superQueryInfo.sqlCount = 0; + } else if (superQuery->type != cJSON_Object) { + printf("ERROR: failed to read json, sub_table_query not found\n"); + ret = true; goto PARSE_OVER; - } } else { - g_queryInfo.superQueryInfo.subscribeKeepProgress = 0; - } + cJSON* subrate = cJSON_GetObjectItem(superQuery, "query_interval"); + if (subrate && subrate->type == cJSON_Number) { + g_queryInfo.superQueryInfo.queryInterval = subrate->valueint; + } else if (!subrate) { + g_queryInfo.superQueryInfo.queryInterval = 0; + } - // default value is -1, which mean do not resub - g_queryInfo.superQueryInfo.endAfterConsume = -1; - cJSON* superEndAfterConsume = - cJSON_GetObjectItem(superQuery, "endAfterConsume"); - if (superEndAfterConsume - && superEndAfterConsume->type == cJSON_Number) { - g_queryInfo.superQueryInfo.endAfterConsume = - superEndAfterConsume->valueint; - } - if (g_queryInfo.superQueryInfo.endAfterConsume < -1) + cJSON* superQueryTimes = cJSON_GetObjectItem(superQuery, "query_times"); + if (superQueryTimes && superQueryTimes->type == cJSON_Number) { + if (superQueryTimes->valueint <= 0) { + errorPrint("%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n", + __func__, __LINE__, superQueryTimes->valueint); + goto PARSE_OVER; + } + g_queryInfo.superQueryInfo.queryTimes = superQueryTimes->valueint; + } else if (!superQueryTimes) { + g_queryInfo.superQueryInfo.queryTimes = g_args.query_times; + } else { + errorPrint("%s() LN%d, failed to read json, query_times input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; + } + + cJSON* threads = cJSON_GetObjectItem(superQuery, "threads"); + if (threads && threads->type == cJSON_Number) { + if (threads->valueint <= 0) { + errorPrint("%s() LN%d, failed to read json, threads input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; + + } + g_queryInfo.superQueryInfo.threadCnt = threads->valueint; + } else if (!threads) { + g_queryInfo.superQueryInfo.threadCnt = 1; + } + + //cJSON* subTblCnt = cJSON_GetObjectItem(superQuery, "childtable_count"); + //if (subTblCnt && subTblCnt->type == cJSON_Number) { + // g_queryInfo.superQueryInfo.childTblCount = subTblCnt->valueint; + //} else if (!subTblCnt) { + // g_queryInfo.superQueryInfo.childTblCount = 0; + //} + + cJSON* stblname = cJSON_GetObjectItem(superQuery, "stblname"); + if (stblname && stblname->type == cJSON_String + && stblname->valuestring != NULL) { + tstrncpy(g_queryInfo.superQueryInfo.sTblName, stblname->valuestring, + TSDB_TABLE_NAME_LEN); + } else { + errorPrint("%s() LN%d, failed to read json, super table name input error\n", + __func__, __LINE__); + goto PARSE_OVER; + } + + cJSON* superAsyncMode = cJSON_GetObjectItem(superQuery, "mode"); + if (superAsyncMode && superAsyncMode->type == cJSON_String + && superAsyncMode->valuestring != NULL) { + if (0 == strcmp("sync", superAsyncMode->valuestring)) { + g_queryInfo.superQueryInfo.asyncMode = SYNC_MODE; + } else if (0 == strcmp("async", superAsyncMode->valuestring)) { + g_queryInfo.superQueryInfo.asyncMode = ASYNC_MODE; + } else { + errorPrint("%s() LN%d, failed to read json, async mode input error\n", + __func__, __LINE__); + goto PARSE_OVER; + } + } else { + g_queryInfo.superQueryInfo.asyncMode = SYNC_MODE; + } + + cJSON* superInterval = cJSON_GetObjectItem(superQuery, "interval"); + if (superInterval && superInterval->type == cJSON_Number) { + if (superInterval->valueint < 0) { + errorPrint("%s() LN%d, failed to read json, interval input mistake\n", + __func__, __LINE__); + goto PARSE_OVER; + } + g_queryInfo.superQueryInfo.subscribeInterval = superInterval->valueint; + } else if (!superInterval) { + //printf("failed to read json, subscribe interval no found\n"); + //goto PARSE_OVER; + g_queryInfo.superQueryInfo.subscribeInterval = 10000; + } + + cJSON* subrestart = cJSON_GetObjectItem(superQuery, "restart"); + if (subrestart && subrestart->type == cJSON_String + && subrestart->valuestring != NULL) { + if (0 == strcmp("yes", subrestart->valuestring)) { + g_queryInfo.superQueryInfo.subscribeRestart = true; + } else if (0 == strcmp("no", subrestart->valuestring)) { + g_queryInfo.superQueryInfo.subscribeRestart = false; + } else { + printf("ERROR: failed to read json, subscribe restart error\n"); + goto PARSE_OVER; + } + } else { + g_queryInfo.superQueryInfo.subscribeRestart = true; + } + + cJSON* superkeepProgress = cJSON_GetObjectItem(superQuery, "keepProgress"); + if (superkeepProgress && + superkeepProgress->type == cJSON_String + && superkeepProgress->valuestring != NULL) { + if (0 == strcmp("yes", superkeepProgress->valuestring)) { + g_queryInfo.superQueryInfo.subscribeKeepProgress = 1; + } else if (0 == strcmp("no", superkeepProgress->valuestring)) { + g_queryInfo.superQueryInfo.subscribeKeepProgress = 0; + } else { + printf("ERROR: failed to read json, subscribe super table keepProgress error\n"); + goto PARSE_OVER; + } + } else { + g_queryInfo.superQueryInfo.subscribeKeepProgress = 0; + } + + // default value is -1, which mean do not resub g_queryInfo.superQueryInfo.endAfterConsume = -1; + cJSON* superEndAfterConsume = + cJSON_GetObjectItem(superQuery, "endAfterConsume"); + if (superEndAfterConsume + && superEndAfterConsume->type == cJSON_Number) { + g_queryInfo.superQueryInfo.endAfterConsume = + superEndAfterConsume->valueint; + } + if (g_queryInfo.superQueryInfo.endAfterConsume < -1) + g_queryInfo.superQueryInfo.endAfterConsume = -1; - // default value is -1, which mean do not resub - g_queryInfo.superQueryInfo.resubAfterConsume = -1; - cJSON* superResubAfterConsume = - cJSON_GetObjectItem(superQuery, "resubAfterConsume"); - if ((superResubAfterConsume) - && (superResubAfterConsume->type == cJSON_Number) - && (superResubAfterConsume->valueint >= 0)) { - g_queryInfo.superQueryInfo.resubAfterConsume = - superResubAfterConsume->valueint; - } - if (g_queryInfo.superQueryInfo.resubAfterConsume < -1) + // default value is -1, which mean do not resub g_queryInfo.superQueryInfo.resubAfterConsume = -1; - - // supert table sqls - cJSON* superSqls = cJSON_GetObjectItem(superQuery, "sqls"); - if (!superSqls) { - g_queryInfo.superQueryInfo.sqlCount = 0; - } else if (superSqls->type != cJSON_Array) { - errorPrint("%s() LN%d: failed to read json, super sqls not found\n", - __func__, __LINE__); - goto PARSE_OVER; - } else { - int superSqlSize = cJSON_GetArraySize(superSqls); - if (superSqlSize > MAX_QUERY_SQL_COUNT) { - errorPrint("%s() LN%d, failed to read json, query sql size overflow, max is %d\n", - __func__, __LINE__, MAX_QUERY_SQL_COUNT); - goto PARSE_OVER; - } - - g_queryInfo.superQueryInfo.sqlCount = superSqlSize; - for (int j = 0; j < superSqlSize; ++j) { - cJSON* sql = cJSON_GetArrayItem(superSqls, j); - if (sql == NULL) continue; - - cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql"); - if (!sqlStr || sqlStr->type != cJSON_String - || sqlStr->valuestring == NULL) { - errorPrint("%s() LN%d, failed to read json, sql not found\n", - __func__, __LINE__); - goto PARSE_OVER; + cJSON* superResubAfterConsume = + cJSON_GetObjectItem(superQuery, "resubAfterConsume"); + if ((superResubAfterConsume) + && (superResubAfterConsume->type == cJSON_Number) + && (superResubAfterConsume->valueint >= 0)) { + g_queryInfo.superQueryInfo.resubAfterConsume = + superResubAfterConsume->valueint; } - tstrncpy(g_queryInfo.superQueryInfo.sql[j], sqlStr->valuestring, - MAX_QUERY_SQL_LENGTH); + if (g_queryInfo.superQueryInfo.resubAfterConsume < -1) + g_queryInfo.superQueryInfo.resubAfterConsume = -1; - cJSON *result = cJSON_GetObjectItem(sql, "result"); - if (result != NULL && result->type == cJSON_String - && result->valuestring != NULL){ - tstrncpy(g_queryInfo.superQueryInfo.result[j], - result->valuestring, MAX_FILE_NAME_LEN); - } else if (NULL == result) { - memset(g_queryInfo.superQueryInfo.result[j], 0, MAX_FILE_NAME_LEN); - } else { - errorPrint("%s() LN%d, failed to read json, sub query result file not found\n", - __func__, __LINE__); - goto PARSE_OVER; + // supert table sqls + cJSON* superSqls = cJSON_GetObjectItem(superQuery, "sqls"); + if (!superSqls) { + g_queryInfo.superQueryInfo.sqlCount = 0; + } else if (superSqls->type != cJSON_Array) { + errorPrint("%s() LN%d: failed to read json, super sqls not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } else { + int superSqlSize = cJSON_GetArraySize(superSqls); + if (superSqlSize > MAX_QUERY_SQL_COUNT) { + errorPrint("%s() LN%d, failed to read json, query sql size overflow, max is %d\n", + __func__, __LINE__, MAX_QUERY_SQL_COUNT); + goto PARSE_OVER; + } + + g_queryInfo.superQueryInfo.sqlCount = superSqlSize; + for (int j = 0; j < superSqlSize; ++j) { + cJSON* sql = cJSON_GetArrayItem(superSqls, j); + if (sql == NULL) continue; + + cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql"); + if (!sqlStr || sqlStr->type != cJSON_String + || sqlStr->valuestring == NULL) { + errorPrint("%s() LN%d, failed to read json, sql not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } + tstrncpy(g_queryInfo.superQueryInfo.sql[j], sqlStr->valuestring, + MAX_QUERY_SQL_LENGTH); + + cJSON *result = cJSON_GetObjectItem(sql, "result"); + if (result != NULL && result->type == cJSON_String + && result->valuestring != NULL){ + tstrncpy(g_queryInfo.superQueryInfo.result[j], + result->valuestring, MAX_FILE_NAME_LEN); + } else if (NULL == result) { + memset(g_queryInfo.superQueryInfo.result[j], 0, MAX_FILE_NAME_LEN); + } else { + errorPrint("%s() LN%d, failed to read json, sub query result file not found\n", + __func__, __LINE__); + goto PARSE_OVER; + } + } } - } } - } - ret = true; + ret = true; PARSE_OVER: - return ret; + return ret; } static bool getInfoFromJsonFile(char* file) { debugPrint("%s %d %s\n", __func__, __LINE__, file); - FILE *fp = fopen(file, "r"); - if (!fp) { - printf("failed to read %s, reason:%s\n", file, strerror(errno)); - return false; - } - - bool ret = false; - int maxLen = 6400000; - char *content = calloc(1, maxLen + 1); - int len = fread(content, 1, maxLen, fp); - if (len <= 0) { - free(content); - fclose(fp); - printf("failed to read %s, content is null", file); - return false; - } - - content[len] = 0; - cJSON* root = cJSON_Parse(content); - if (root == NULL) { - printf("ERROR: failed to cjson parse %s, invalid json format\n", file); - goto PARSE_OVER; - } - - cJSON* filetype = cJSON_GetObjectItem(root, "filetype"); - if (filetype && filetype->type == cJSON_String && filetype->valuestring != NULL) { - if (0 == strcasecmp("insert", filetype->valuestring)) { - g_args.test_mode = INSERT_TEST; - } else if (0 == strcasecmp("query", filetype->valuestring)) { - g_args.test_mode = QUERY_TEST; - } else if (0 == strcasecmp("subscribe", filetype->valuestring)) { - g_args.test_mode = SUBSCRIBE_TEST; - } else { - printf("ERROR: failed to read json, filetype not support\n"); - goto PARSE_OVER; + FILE *fp = fopen(file, "r"); + if (!fp) { + printf("failed to read %s, reason:%s\n", file, strerror(errno)); + return false; } - } else if (!filetype) { - g_args.test_mode = INSERT_TEST; - } else { - printf("ERROR: failed to read json, filetype not found\n"); - goto PARSE_OVER; - } - if (INSERT_TEST == g_args.test_mode) { - ret = getMetaFromInsertJsonFile(root); - } else if ((QUERY_TEST == g_args.test_mode) - || (SUBSCRIBE_TEST == g_args.test_mode)) { - ret = getMetaFromQueryJsonFile(root); - } else { - errorPrint("%s() LN%d, input json file type error! please input correct file type: insert or query or subscribe\n", - __func__, __LINE__); - goto PARSE_OVER; - } + bool ret = false; + int maxLen = 6400000; + char *content = calloc(1, maxLen + 1); + int len = fread(content, 1, maxLen, fp); + if (len <= 0) { + free(content); + fclose(fp); + printf("failed to read %s, content is null", file); + return false; + } + + content[len] = 0; + cJSON* root = cJSON_Parse(content); + if (root == NULL) { + printf("ERROR: failed to cjson parse %s, invalid json format\n", file); + goto PARSE_OVER; + } + + cJSON* filetype = cJSON_GetObjectItem(root, "filetype"); + if (filetype && filetype->type == cJSON_String && filetype->valuestring != NULL) { + if (0 == strcasecmp("insert", filetype->valuestring)) { + g_args.test_mode = INSERT_TEST; + } else if (0 == strcasecmp("query", filetype->valuestring)) { + g_args.test_mode = QUERY_TEST; + } else if (0 == strcasecmp("subscribe", filetype->valuestring)) { + g_args.test_mode = SUBSCRIBE_TEST; + } else { + printf("ERROR: failed to read json, filetype not support\n"); + goto PARSE_OVER; + } + } else if (!filetype) { + g_args.test_mode = INSERT_TEST; + } else { + printf("ERROR: failed to read json, filetype not found\n"); + goto PARSE_OVER; + } + + if (INSERT_TEST == g_args.test_mode) { + ret = getMetaFromInsertJsonFile(root); + } else if ((QUERY_TEST == g_args.test_mode) + || (SUBSCRIBE_TEST == g_args.test_mode)) { + ret = getMetaFromQueryJsonFile(root); + } else { + errorPrint("%s() LN%d, input json file type error! please input correct file type: insert or query or subscribe\n", + __func__, __LINE__); + goto PARSE_OVER; + } PARSE_OVER: - free(content); - cJSON_Delete(root); - fclose(fp); - return ret; + free(content); + cJSON_Delete(root); + fclose(fp); + return ret; } static int prepareSampleData() { - for (int i = 0; i < g_Dbs.dbCount; i++) { - for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { - if (g_Dbs.db[i].superTbls[j].tagsFile[0] != 0) { - if (readTagFromCsvFileToMem(&g_Dbs.db[i].superTbls[j]) != 0) { - return -1; + for (int i = 0; i < g_Dbs.dbCount; i++) { + for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { + if (g_Dbs.db[i].superTbls[j].tagsFile[0] != 0) { + if (readTagFromCsvFileToMem(&g_Dbs.db[i].superTbls[j]) != 0) { + return -1; + } + } } - } } - } - return 0; + return 0; } static void postFreeResource() { - tmfclose(g_fpOfInsertResult); - for (int i = 0; i < g_Dbs.dbCount; i++) { - for (uint64_t j = 0; j < g_Dbs.db[i].superTblCount; j++) { - if (0 != g_Dbs.db[i].superTbls[j].colsOfCreateChildTable) { - free(g_Dbs.db[i].superTbls[j].colsOfCreateChildTable); - g_Dbs.db[i].superTbls[j].colsOfCreateChildTable = NULL; - } - if (0 != g_Dbs.db[i].superTbls[j].sampleDataBuf) { - free(g_Dbs.db[i].superTbls[j].sampleDataBuf); - g_Dbs.db[i].superTbls[j].sampleDataBuf = NULL; - } - if (0 != g_Dbs.db[i].superTbls[j].tagDataBuf) { - free(g_Dbs.db[i].superTbls[j].tagDataBuf); - g_Dbs.db[i].superTbls[j].tagDataBuf = NULL; - } - if (0 != g_Dbs.db[i].superTbls[j].childTblName) { - free(g_Dbs.db[i].superTbls[j].childTblName); - g_Dbs.db[i].superTbls[j].childTblName = NULL; - } + tmfclose(g_fpOfInsertResult); + for (int i = 0; i < g_Dbs.dbCount; i++) { + for (uint64_t j = 0; j < g_Dbs.db[i].superTblCount; j++) { + if (0 != g_Dbs.db[i].superTbls[j].colsOfCreateChildTable) { + free(g_Dbs.db[i].superTbls[j].colsOfCreateChildTable); + g_Dbs.db[i].superTbls[j].colsOfCreateChildTable = NULL; + } + if (0 != g_Dbs.db[i].superTbls[j].sampleDataBuf) { + free(g_Dbs.db[i].superTbls[j].sampleDataBuf); + g_Dbs.db[i].superTbls[j].sampleDataBuf = NULL; + } + if (0 != g_Dbs.db[i].superTbls[j].tagDataBuf) { + free(g_Dbs.db[i].superTbls[j].tagDataBuf); + g_Dbs.db[i].superTbls[j].tagDataBuf = NULL; + } + if (0 != g_Dbs.db[i].superTbls[j].childTblName) { + free(g_Dbs.db[i].superTbls[j].childTblName); + g_Dbs.db[i].superTbls[j].childTblName = NULL; + } + } } - } } static int getRowDataFromSample( @@ -5033,30 +5049,30 @@ static int64_t generateData(char *recBuf, char **data_type, } static int prepareSampleDataForSTable(SSuperTable *superTblInfo) { - char* sampleDataBuf = NULL; + char* sampleDataBuf = NULL; - sampleDataBuf = calloc( + sampleDataBuf = calloc( superTblInfo->lenOfOneRow * MAX_SAMPLES_ONCE_FROM_FILE, 1); - if (sampleDataBuf == NULL) { - errorPrint("%s() LN%d, Failed to calloc %"PRIu64" Bytes, reason:%s\n", - __func__, __LINE__, - superTblInfo->lenOfOneRow * MAX_SAMPLES_ONCE_FROM_FILE, - strerror(errno)); - return -1; - } + if (sampleDataBuf == NULL) { + errorPrint("%s() LN%d, Failed to calloc %"PRIu64" Bytes, reason:%s\n", + __func__, __LINE__, + superTblInfo->lenOfOneRow * MAX_SAMPLES_ONCE_FROM_FILE, + strerror(errno)); + return -1; + } - superTblInfo->sampleDataBuf = sampleDataBuf; - int ret = readSampleFromCsvFileToMem(superTblInfo); + superTblInfo->sampleDataBuf = sampleDataBuf; + int ret = readSampleFromCsvFileToMem(superTblInfo); - if (0 != ret) { - errorPrint("%s() LN%d, read sample from csv file failed.\n", - __func__, __LINE__); - tmfree(sampleDataBuf); - superTblInfo->sampleDataBuf = NULL; - return -1; - } + if (0 != ret) { + errorPrint("%s() LN%d, read sample from csv file failed.\n", + __func__, __LINE__); + tmfree(sampleDataBuf); + superTblInfo->sampleDataBuf = NULL; + return -1; + } - return 0; + return 0; } static int32_t execInsert(threadInfo *pThreadInfo, uint32_t k) @@ -5155,54 +5171,54 @@ static int32_t generateDataTailWithoutStb( uint64_t recordFrom, int64_t startTime, /* int64_t *pSamplePos, */int64_t *dataLen) { - uint64_t len = 0; - char *pstr = buffer; + uint64_t len = 0; + char *pstr = buffer; - verbosePrint("%s() LN%d batch=%d\n", __func__, __LINE__, batch); + verbosePrint("%s() LN%d batch=%d\n", __func__, __LINE__, batch); - int32_t k = 0; - for (k = 0; k < batch;) { - char data[MAX_DATA_SIZE]; - memset(data, 0, MAX_DATA_SIZE); + int32_t k = 0; + for (k = 0; k < batch;) { + char data[MAX_DATA_SIZE]; + memset(data, 0, MAX_DATA_SIZE); - int64_t retLen = 0; + int64_t retLen = 0; - char **data_type = g_args.datatype; - int lenOfBinary = g_args.len_of_binary; + char **data_type = g_args.datatype; + int lenOfBinary = g_args.len_of_binary; - if (g_args.disorderRatio) { - retLen = generateData(data, data_type, - startTime + getTSRandTail( - (int64_t) DEFAULT_TIMESTAMP_STEP, k, - g_args.disorderRatio, - g_args.disorderRange), - lenOfBinary); - } else { - retLen = generateData(data, data_type, - startTime + (int64_t) (DEFAULT_TIMESTAMP_STEP* k), - lenOfBinary); + if (g_args.disorderRatio) { + retLen = generateData(data, data_type, + startTime + getTSRandTail( + (int64_t) DEFAULT_TIMESTAMP_STEP, k, + g_args.disorderRatio, + g_args.disorderRange), + lenOfBinary); + } else { + retLen = generateData(data, data_type, + startTime + (int64_t) (DEFAULT_TIMESTAMP_STEP* k), + lenOfBinary); + } + + if (len > remainderBufLen) + break; + + pstr += sprintf(pstr, "%s", data); + k++; + len += retLen; + remainderBufLen -= retLen; + + verbosePrint("%s() LN%d len=%"PRIu64" k=%d \nbuffer=%s\n", + __func__, __LINE__, len, k, buffer); + + recordFrom ++; + + if (recordFrom >= insertRows) { + break; + } } - if (len > remainderBufLen) - break; - - pstr += sprintf(pstr, "%s", data); - k++; - len += retLen; - remainderBufLen -= retLen; - - verbosePrint("%s() LN%d len=%"PRIu64" k=%d \nbuffer=%s\n", - __func__, __LINE__, len, k, buffer); - - recordFrom ++; - - if (recordFrom >= insertRows) { - break; - } - } - - *dataLen = len; - return k; + *dataLen = len; + return k; } static int64_t getTSRandTail(int64_t timeStampStep, int32_t seq, @@ -5297,82 +5313,82 @@ static int generateSQLHeadWithoutStb(char *tableName, char *dbName, char *buffer, int remainderBufLen) { - int len; + int len; - char headBuf[HEAD_BUFF_LEN]; + char headBuf[HEAD_BUFF_LEN]; - len = snprintf( - headBuf, - HEAD_BUFF_LEN, - "%s.%s values", - dbName, - tableName); + len = snprintf( + headBuf, + HEAD_BUFF_LEN, + "%s.%s values", + dbName, + tableName); - if (len > remainderBufLen) - return -1; + if (len > remainderBufLen) + return -1; - tstrncpy(buffer, headBuf, len + 1); + tstrncpy(buffer, headBuf, len + 1); - return len; + return len; } static int generateStbSQLHead( SSuperTable* superTblInfo, - char *tableName, int32_t tableSeq, + char *tableName, int64_t tableSeq, char *dbName, char *buffer, int remainderBufLen) { - int len; + int len; - char headBuf[HEAD_BUFF_LEN]; + char headBuf[HEAD_BUFF_LEN]; - if (AUTO_CREATE_SUBTBL == superTblInfo->autoCreateTable) { - char* tagsValBuf = NULL; - if (0 == superTblInfo->tagSource) { - tagsValBuf = generateTagVaulesForStb(superTblInfo, tableSeq); - } else { + if (AUTO_CREATE_SUBTBL == superTblInfo->autoCreateTable) { + char* tagsValBuf = NULL; + if (0 == superTblInfo->tagSource) { + tagsValBuf = generateTagValuesForStb(superTblInfo, tableSeq); + } else { tagsValBuf = getTagValueFromTagSample( superTblInfo, tableSeq % superTblInfo->tagSampleCount); - } - if (NULL == tagsValBuf) { - errorPrint("%s() LN%d, tag buf failed to allocate memory\n", - __func__, __LINE__); - return -1; - } + } + if (NULL == tagsValBuf) { + errorPrint("%s() LN%d, tag buf failed to allocate memory\n", + __func__, __LINE__); + return -1; + } - len = snprintf( - headBuf, - HEAD_BUFF_LEN, - "%s.%s using %s.%s tags %s values", - dbName, - tableName, - dbName, - superTblInfo->sTblName, - tagsValBuf); - tmfree(tagsValBuf); + len = snprintf( + headBuf, + HEAD_BUFF_LEN, + "%s.%s using %s.%s TAGS%s values", + dbName, + tableName, + dbName, + superTblInfo->sTblName, + tagsValBuf); + tmfree(tagsValBuf); } else if (TBL_ALREADY_EXISTS == superTblInfo->childTblExists) { - len = snprintf( - headBuf, - HEAD_BUFF_LEN, - "%s.%s values", - dbName, - tableName); + len = snprintf( + headBuf, + HEAD_BUFF_LEN, + "%s.%s values", + dbName, + tableName); } else { - len = snprintf( - headBuf, - HEAD_BUFF_LEN, - "%s.%s values", - dbName, - tableName); - } + len = snprintf( + headBuf, + HEAD_BUFF_LEN, + "%s.%s values", + dbName, + tableName); + } - if (len > remainderBufLen) - return -1; + if (len > remainderBufLen) + return -1; - tstrncpy(buffer, headBuf, len + 1); + tstrncpy(buffer, headBuf, len + 1); - return len; + return len; } static int32_t generateStbInterlaceData( @@ -5650,8 +5666,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, *ptr += bind->buffer_length; } else { - errorPrint( "No support data type: %s\n", - dataType); + errorPrint( "No support data type: %s\n", dataType); return -1; } @@ -5737,28 +5752,120 @@ static int32_t prepareStmtWithoutStb( return k; } +static int32_t prepareStbStmtBind( + char *bindArray, SSuperTable *stbInfo, bool sourceRand, + int64_t startTime, int32_t recSeq, + bool isColumn) +{ + char *bindBuffer = calloc(1, g_args.len_of_binary); + if (bindBuffer == NULL) { + errorPrint("%s() LN%d, Failed to allocate %d bind buffer\n", + __func__, __LINE__, g_args.len_of_binary); + return -1; + } + + char data[MAX_DATA_SIZE]; + memset(data, 0, MAX_DATA_SIZE); + char *ptr = data; + + TAOS_BIND *bind; + + if (isColumn) { + for (int i = 0; i < stbInfo->columnCount + 1; i ++) { + bind = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * i)); + + if (i == 0) { + int64_t *bind_ts; + + bind_ts = (int64_t *)ptr; + bind->buffer_type = TSDB_DATA_TYPE_TIMESTAMP; + if (stbInfo->disorderRatio) { + *bind_ts = startTime + getTSRandTail( + stbInfo->timeStampStep, recSeq, + stbInfo->disorderRatio, + stbInfo->disorderRange); + } else { + *bind_ts = startTime + stbInfo->timeStampStep * recSeq; + } + bind->buffer_length = sizeof(int64_t); + bind->buffer = bind_ts; + bind->length = &bind->buffer_length; + bind->is_null = NULL; + + ptr += bind->buffer_length; + } else { + int cursor = 0; + + if (sourceRand) { + if ( -1 == prepareStmtBindArrayByType( + bind, + stbInfo->columns[i-1].dataType, + stbInfo->columns[i-1].dataLen, + &ptr, + NULL)) { + free(bindBuffer); + return -1; + } + } else { + char *restStr = stbInfo->sampleDataBuf + cursor; + int lengthOfRest = strlen(restStr); + + int index = 0; + for (index = 0; index < lengthOfRest; index ++) { + if (restStr[index] == ',') { + break; + } + } + + memset(bindBuffer, 0, g_args.len_of_binary); + strncpy(bindBuffer, restStr, index); + cursor += index + 1; // skip ',' too + + if ( -1 == prepareStmtBindArrayByType( + bind, + stbInfo->columns[i-1].dataType, + stbInfo->columns[i-1].dataLen, + &ptr, + bindBuffer)) { + free(bindBuffer); + return -1; + } + } + } + } + } else { + TAOS_BIND *tag; + + for (int t = 0; t < stbInfo->tagCount; t ++) { + tag = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * t)); + if ( -1 == prepareStmtBindArrayByType( + tag, + stbInfo->tags[t].dataType, + stbInfo->tags[t].dataLen, + &ptr, + NULL)) { + free(bindBuffer); + return -1; + } + } + + } + + return 0; +} + static int32_t prepareStbStmt( SSuperTable *stbInfo, TAOS_STMT *stmt, - char *tableName, uint32_t batch, + char *tableName, + int64_t tableSeq, + uint32_t batch, uint64_t insertRows, uint64_t recordFrom, int64_t startTime, int64_t *pSamplePos) { - int ret = taos_stmt_set_tbname(stmt, tableName); - if (ret != 0) { - errorPrint("failed to execute taos_stmt_set_tbname(%s). return 0x%x. reason: %s\n", - tableName, ret, taos_errstr(NULL)); - return ret; - } - - char *bindArray = malloc(sizeof(TAOS_BIND) * (stbInfo->columnCount + 1)); - if (bindArray == NULL) { - errorPrint("%s() LN%d, Failed to allocate %d bind params\n", - __func__, __LINE__, (stbInfo->columnCount + 1)); - return -1; - } + int ret; bool sourceRand; if (0 == strncasecmp(stbInfo->dataSource, "rand", strlen("rand"))) { @@ -5767,83 +5874,68 @@ static int32_t prepareStbStmt( sourceRand = false; // from sample data file } - char *bindBuffer = malloc(g_args.len_of_binary); - if (bindBuffer == NULL) { - errorPrint("%s() LN%d, Failed to allocate %d bind buffer\n", - __func__, __LINE__, g_args.len_of_binary); - free(bindArray); + if (AUTO_CREATE_SUBTBL == stbInfo->autoCreateTable) { + char* tagsValBuf = NULL; + + bool tagRand; + if (0 == stbInfo->tagSource) { + tagRand = true; + tagsValBuf = generateTagValuesForStb(stbInfo, tableSeq); + } else { + tagRand = false; + tagsValBuf = getTagValueFromTagSample( + stbInfo, + tableSeq % stbInfo->tagSampleCount); + } + + if (NULL == tagsValBuf) { + errorPrint("%s() LN%d, tag buf failed to allocate memory\n", + __func__, __LINE__); + return -1; + } + + char *tagsArray = calloc(1, sizeof(TAOS_BIND) * stbInfo->tagCount); + if (NULL == tagsArray) { + tmfree(tagsValBuf); + errorPrint("%s() LN%d, tag buf failed to allocate memory\n", + __func__, __LINE__); + return -1; + } + + if (-1 == prepareStbStmtBind( + tagsArray, stbInfo, tagRand, -1, -1, false /* is tag */)) { + free(tagsArray); + return -1; + } + + ret = taos_stmt_set_tbname_tags(stmt, tableName, (TAOS_BIND *)tagsArray); + + tmfree(tagsValBuf); + tmfree((char *)tagsArray); + } else { + ret = taos_stmt_set_tbname(stmt, tableName); + } + + if (ret != 0) { + errorPrint("failed to execute taos_stmt_set_tbname(%s). return 0x%x. reason: %s\n", + tableName, ret, taos_errstr(NULL)); + return ret; + } + + char *bindArray = calloc(1, sizeof(TAOS_BIND) * (stbInfo->columnCount + 1)); + if (bindArray == NULL) { + errorPrint("%s() LN%d, Failed to allocate %d bind params\n", + __func__, __LINE__, (stbInfo->columnCount + 1)); return -1; } uint32_t k; for (k = 0; k < batch;) { /* columnCount + 1 (ts) */ - char data[MAX_DATA_SIZE]; - memset(data, 0, MAX_DATA_SIZE); - - char *ptr = data; - TAOS_BIND *bind = (TAOS_BIND *)(bindArray + 0); - - int64_t *bind_ts; - - bind_ts = (int64_t *)ptr; - bind->buffer_type = TSDB_DATA_TYPE_TIMESTAMP; - if (stbInfo->disorderRatio) { - *bind_ts = startTime + getTSRandTail( - stbInfo->timeStampStep, k, - stbInfo->disorderRatio, - stbInfo->disorderRange); - } else { - *bind_ts = startTime + stbInfo->timeStampStep * k; - } - bind->buffer_length = sizeof(int64_t); - bind->buffer = bind_ts; - bind->length = &bind->buffer_length; - bind->is_null = NULL; - - ptr += bind->buffer_length; - - int cursor = 0; - for (int i = 0; i < stbInfo->columnCount; i ++) { - bind = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * (i + 1))); - - if (sourceRand) { - if ( -1 == prepareStmtBindArrayByType( - bind, - stbInfo->columns[i].dataType, - stbInfo->columns[i].dataLen, - &ptr, - NULL)) { - free(bindArray); - free(bindBuffer); - return -1; - } - } else { - char *restStr = stbInfo->sampleDataBuf + cursor; - int lengthOfRest = strlen(restStr); - - int index = 0; - for (index = 0; index < lengthOfRest; index ++) { - if (restStr[index] == ',') { - break; - } - } - - memset(bindBuffer, 0, g_args.len_of_binary); - strncpy(bindBuffer, restStr, index); - cursor += index + 1; // skip ',' too - - if ( -1 == prepareStmtBindArrayByType( - bind, - stbInfo->columns[i].dataType, - stbInfo->columns[i].dataLen, - &ptr, - bindBuffer)) { - free(bindArray); - free(bindBuffer); - return -1; - } - } + if (-1 == prepareStbStmtBind(bindArray, stbInfo, sourceRand, + startTime, k, true /* is column */)) { + free(bindArray); + return -1; } taos_stmt_bind_param(stmt, (TAOS_BIND *)bindArray); // if msg > 3MB, break @@ -5861,7 +5953,6 @@ static int32_t prepareStbStmt( } } - free(bindBuffer); free(bindArray); return k; } @@ -5869,7 +5960,9 @@ static int32_t prepareStbStmt( static int32_t prepareStbStmtInterlace( SSuperTable *stbInfo, TAOS_STMT *stmt, - char *tableName, uint32_t batch, + char *tableName, + int64_t tableSeq, + uint32_t batch, uint64_t insertRows, uint64_t recordFrom, int64_t startTime, @@ -5879,6 +5972,7 @@ static int32_t prepareStbStmtInterlace( stbInfo, stmt, tableName, + tableSeq, batch, insertRows, 0, startTime, pSamplePos); @@ -5887,7 +5981,9 @@ static int32_t prepareStbStmtInterlace( static int32_t prepareStbStmtProgressive( SSuperTable *stbInfo, TAOS_STMT *stmt, - char *tableName, uint32_t batch, + char *tableName, + int64_t tableSeq, + uint32_t batch, uint64_t insertRows, uint64_t recordFrom, int64_t startTime, @@ -5897,6 +5993,7 @@ static int32_t prepareStbStmtProgressive( stbInfo, stmt, tableName, + tableSeq, g_args.num_of_RPR, insertRows, recordFrom, startTime, pSamplePos); @@ -6097,6 +6194,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { superTblInfo, pThreadInfo->stmt, tableName, + tableSeq, batchPerTbl, insertRows, i, startTime, @@ -6263,164 +6361,165 @@ free_of_interlace: // sync insertion progressive data static void* syncWriteProgressive(threadInfo *pThreadInfo) { - debugPrint("%s() LN%d: ### progressive write\n", __func__, __LINE__); + debugPrint("%s() LN%d: ### progressive write\n", __func__, __LINE__); - SSuperTable* superTblInfo = pThreadInfo->superTblInfo; - uint64_t maxSqlLen = superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len; - int64_t timeStampStep = - superTblInfo?superTblInfo->timeStampStep:DEFAULT_TIMESTAMP_STEP; - int64_t insertRows = + SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + uint64_t maxSqlLen = superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len; + int64_t timeStampStep = + superTblInfo?superTblInfo->timeStampStep:DEFAULT_TIMESTAMP_STEP; + int64_t insertRows = (superTblInfo)?superTblInfo->insertRows:g_args.num_of_DPT; - verbosePrint("%s() LN%d insertRows=%"PRId64"\n", + verbosePrint("%s() LN%d insertRows=%"PRId64"\n", __func__, __LINE__, insertRows); - pThreadInfo->buffer = calloc(maxSqlLen, 1); - if (NULL == pThreadInfo->buffer) { - errorPrint( "Failed to alloc %"PRIu64" Bytes, reason:%s\n", - maxSqlLen, - strerror(errno)); - return NULL; - } - - uint64_t lastPrintTime = taosGetTimestampMs(); - uint64_t startTs = taosGetTimestampMs(); - uint64_t endTs; - - pThreadInfo->totalInsertRows = 0; - pThreadInfo->totalAffectedRows = 0; - - pThreadInfo->samplePos = 0; - - for (uint64_t tableSeq = pThreadInfo->start_table_from; - tableSeq <= pThreadInfo->end_table_to; - tableSeq ++) { - int64_t start_time = pThreadInfo->start_time; - - for (uint64_t i = 0; i < insertRows;) { - char tableName[TSDB_TABLE_NAME_LEN]; - getTableName(tableName, pThreadInfo, tableSeq); - verbosePrint("%s() LN%d: tid=%d seq=%"PRId64" tableName=%s\n", - __func__, __LINE__, - pThreadInfo->threadID, tableSeq, tableName); - if (0 == strlen(tableName)) { - errorPrint("[%d] %s() LN%d, getTableName return null\n", - pThreadInfo->threadID, __func__, __LINE__); - free(pThreadInfo->buffer); + pThreadInfo->buffer = calloc(maxSqlLen, 1); + if (NULL == pThreadInfo->buffer) { + errorPrint( "Failed to alloc %"PRIu64" Bytes, reason:%s\n", + maxSqlLen, + strerror(errno)); return NULL; - } - - int64_t remainderBufLen = maxSqlLen; - char *pstr = pThreadInfo->buffer; - - int len = snprintf(pstr, - strlen(STR_INSERT_INTO) + 1, "%s", STR_INSERT_INTO); - - pstr += len; - remainderBufLen -= len; - - int32_t generated; - if (superTblInfo) { - if (superTblInfo->iface == STMT_IFACE) { -#if STMT_IFACE_ENABLED == 1 - generated = prepareStbStmtProgressive( - superTblInfo, - pThreadInfo->stmt, - tableName, - g_args.num_of_RPR, - insertRows, i, start_time, - &(pThreadInfo->samplePos)); -#else - generated = -1; -#endif - } else { - generated = generateStbProgressiveData( - superTblInfo, - tableName, tableSeq, pThreadInfo->db_name, pstr, - insertRows, i, start_time, - &(pThreadInfo->samplePos), - &remainderBufLen); - } - } else { - if (g_args.iface == STMT_IFACE) { -#if STMT_IFACE_ENABLED == 1 - generated = prepareStmtWithoutStb( - pThreadInfo->stmt, - tableName, - g_args.num_of_RPR, - insertRows, i, - start_time); -#else - generated = -1; -#endif - } else { - generated = generateProgressiveDataWithoutStb( - tableName, - /* tableSeq, */ - pThreadInfo, pstr, insertRows, - i, start_time, - /* &(pThreadInfo->samplePos), */ - &remainderBufLen); - } - } - if (generated > 0) - i += generated; - else - goto free_of_progressive; - - start_time += generated * timeStampStep; - pThreadInfo->totalInsertRows += generated; - - startTs = taosGetTimestampMs(); - - int32_t affectedRows = execInsert(pThreadInfo, generated); - - endTs = taosGetTimestampMs(); - uint64_t delay = endTs - startTs; - performancePrint("%s() LN%d, insert execution time is %"PRId64"ms\n", - __func__, __LINE__, delay); - verbosePrint("[%d] %s() LN%d affectedRows=%d\n", - pThreadInfo->threadID, - __func__, __LINE__, affectedRows); - - if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; - if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; - pThreadInfo->cntDelay++; - pThreadInfo->totalDelay += delay; - - if (affectedRows < 0) { - errorPrint("%s() LN%d, affected rows: %d\n", - __func__, __LINE__, affectedRows); - goto free_of_progressive; - } - - pThreadInfo->totalAffectedRows += affectedRows; - - int64_t currentPrintTime = taosGetTimestampMs(); - if (currentPrintTime - lastPrintTime > 30*1000) { - printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n", - pThreadInfo->threadID, - pThreadInfo->totalInsertRows, - pThreadInfo->totalAffectedRows); - lastPrintTime = currentPrintTime; - } - - if (i >= insertRows) - break; - } // num_of_DPT - - if ((g_args.verbose_print) && - (tableSeq == pThreadInfo->ntables - 1) && (superTblInfo) && - (0 == strncasecmp( - superTblInfo->dataSource, "sample", strlen("sample")))) { - verbosePrint("%s() LN%d samplePos=%"PRId64"\n", - __func__, __LINE__, pThreadInfo->samplePos); } - } // tableSeq + + uint64_t lastPrintTime = taosGetTimestampMs(); + uint64_t startTs = taosGetTimestampMs(); + uint64_t endTs; + + pThreadInfo->totalInsertRows = 0; + pThreadInfo->totalAffectedRows = 0; + + pThreadInfo->samplePos = 0; + + for (uint64_t tableSeq = pThreadInfo->start_table_from; + tableSeq <= pThreadInfo->end_table_to; + tableSeq ++) { + int64_t start_time = pThreadInfo->start_time; + + for (uint64_t i = 0; i < insertRows;) { + char tableName[TSDB_TABLE_NAME_LEN]; + getTableName(tableName, pThreadInfo, tableSeq); + verbosePrint("%s() LN%d: tid=%d seq=%"PRId64" tableName=%s\n", + __func__, __LINE__, + pThreadInfo->threadID, tableSeq, tableName); + if (0 == strlen(tableName)) { + errorPrint("[%d] %s() LN%d, getTableName return null\n", + pThreadInfo->threadID, __func__, __LINE__); + free(pThreadInfo->buffer); + return NULL; + } + + int64_t remainderBufLen = maxSqlLen; + char *pstr = pThreadInfo->buffer; + + int len = snprintf(pstr, + strlen(STR_INSERT_INTO) + 1, "%s", STR_INSERT_INTO); + + pstr += len; + remainderBufLen -= len; + + int32_t generated; + if (superTblInfo) { + if (superTblInfo->iface == STMT_IFACE) { +#if STMT_IFACE_ENABLED == 1 + generated = prepareStbStmtProgressive( + superTblInfo, + pThreadInfo->stmt, + tableName, + tableSeq, + g_args.num_of_RPR, + insertRows, i, start_time, + &(pThreadInfo->samplePos)); +#else + generated = -1; +#endif + } else { + generated = generateStbProgressiveData( + superTblInfo, + tableName, tableSeq, pThreadInfo->db_name, pstr, + insertRows, i, start_time, + &(pThreadInfo->samplePos), + &remainderBufLen); + } + } else { + if (g_args.iface == STMT_IFACE) { +#if STMT_IFACE_ENABLED == 1 + generated = prepareStmtWithoutStb( + pThreadInfo->stmt, + tableName, + g_args.num_of_RPR, + insertRows, i, + start_time); +#else + generated = -1; +#endif + } else { + generated = generateProgressiveDataWithoutStb( + tableName, + /* tableSeq, */ + pThreadInfo, pstr, insertRows, + i, start_time, + /* &(pThreadInfo->samplePos), */ + &remainderBufLen); + } + } + if (generated > 0) + i += generated; + else + goto free_of_progressive; + + start_time += generated * timeStampStep; + pThreadInfo->totalInsertRows += generated; + + startTs = taosGetTimestampMs(); + + int32_t affectedRows = execInsert(pThreadInfo, generated); + + endTs = taosGetTimestampMs(); + uint64_t delay = endTs - startTs; + performancePrint("%s() LN%d, insert execution time is %"PRId64"ms\n", + __func__, __LINE__, delay); + verbosePrint("[%d] %s() LN%d affectedRows=%d\n", + pThreadInfo->threadID, + __func__, __LINE__, affectedRows); + + if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; + if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; + pThreadInfo->cntDelay++; + pThreadInfo->totalDelay += delay; + + if (affectedRows < 0) { + errorPrint("%s() LN%d, affected rows: %d\n", + __func__, __LINE__, affectedRows); + goto free_of_progressive; + } + + pThreadInfo->totalAffectedRows += affectedRows; + + int64_t currentPrintTime = taosGetTimestampMs(); + if (currentPrintTime - lastPrintTime > 30*1000) { + printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n", + pThreadInfo->threadID, + pThreadInfo->totalInsertRows, + pThreadInfo->totalAffectedRows); + lastPrintTime = currentPrintTime; + } + + if (i >= insertRows) + break; + } // num_of_DPT + + if ((g_args.verbose_print) && + (tableSeq == pThreadInfo->ntables - 1) && (superTblInfo) && + (0 == strncasecmp( + superTblInfo->dataSource, "sample", strlen("sample")))) { + verbosePrint("%s() LN%d samplePos=%"PRId64"\n", + __func__, __LINE__, pThreadInfo->samplePos); + } + } // tableSeq free_of_progressive: - tmfree(pThreadInfo->buffer); - printStatPerThread(pThreadInfo); - return NULL; + tmfree(pThreadInfo->buffer); + printStatPerThread(pThreadInfo); + return NULL; } static void* syncWrite(void *sarg) { @@ -6428,6 +6527,8 @@ static void* syncWrite(void *sarg) { threadInfo *pThreadInfo = (threadInfo *)sarg; SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + setThreadName("syncWrite"); + uint32_t interlaceRows; if (superTblInfo) { @@ -6513,6 +6614,8 @@ static void *asyncWrite(void *sarg) { threadInfo *pThreadInfo = (threadInfo *)sarg; SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + setThreadName("asyncWrite"); + pThreadInfo->st = 0; pThreadInfo->et = 0; pThreadInfo->lastTs = pThreadInfo->start_time; @@ -6590,6 +6693,8 @@ static void startMultiThreadInsertData(int threads, char* db_name, } else { start_time = 1500000000000; } + debugPrint("%s() LN%d, start_time= %"PRId64"\n", + __func__, __LINE__, start_time); int64_t start = taosGetTimestampMs(); @@ -6752,7 +6857,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, exit(-1); } - char buffer[3000]; + char buffer[BUFFER_SIZE]; char *pstr = buffer; if ((superTblInfo) @@ -6911,6 +7016,7 @@ static void *readTable(void *sarg) { #if 1 threadInfo *pThreadInfo = (threadInfo *)sarg; TAOS *taos = pThreadInfo->taos; + setThreadName("readTable"); char command[BUFFER_SIZE] = "\0"; uint64_t sTime = pThreadInfo->start_time; char *tb_prefix = pThreadInfo->tb_prefix; @@ -6983,6 +7089,7 @@ static void *readMetric(void *sarg) { #if 1 threadInfo *pThreadInfo = (threadInfo *)sarg; TAOS *taos = pThreadInfo->taos; + setThreadName("readMetric"); char command[BUFFER_SIZE] = "\0"; FILE *fp = fopen(pThreadInfo->filePath, "a"); if (NULL == fp) { @@ -7159,6 +7266,8 @@ static int insertTestProcess() { static void *specifiedTableQuery(void *sarg) { threadInfo *pThreadInfo = (threadInfo *)sarg; + setThreadName("specTableQuery"); + if (pThreadInfo->taos == NULL) { TAOS * taos = NULL; taos = taos_connect(g_queryInfo.host, @@ -7258,6 +7367,8 @@ static void *superTableQuery(void *sarg) { char sqlstr[MAX_QUERY_SQL_LENGTH]; threadInfo *pThreadInfo = (threadInfo *)sarg; + setThreadName("superTableQuery"); + if (pThreadInfo->taos == NULL) { TAOS * taos = NULL; taos = taos_connect(g_queryInfo.host, @@ -7560,6 +7671,8 @@ static void *superSubscribe(void *sarg) { TAOS_SUB* tsub[MAX_QUERY_SQL_COUNT] = {0}; uint64_t tsubSeq; + setThreadName("superSub"); + if (pThreadInfo->ntables > MAX_QUERY_SQL_COUNT) { errorPrint("The table number(%"PRId64") of the thread is more than max query sql count: %d\n", pThreadInfo->ntables, MAX_QUERY_SQL_COUNT); @@ -7706,6 +7819,8 @@ static void *specifiedSubscribe(void *sarg) { threadInfo *pThreadInfo = (threadInfo *)sarg; // TAOS_SUB* tsub = NULL; + setThreadName("specSub"); + if (pThreadInfo->taos == NULL) { pThreadInfo->taos = taos_connect(g_queryInfo.host, g_queryInfo.user, @@ -8138,55 +8253,55 @@ static int isCommentLine(char *line) { static void querySqlFile(TAOS* taos, char* sqlFile) { - FILE *fp = fopen(sqlFile, "r"); - if (fp == NULL) { - printf("failed to open file %s, reason:%s\n", sqlFile, strerror(errno)); - return; - } - - int read_len = 0; - char * cmd = calloc(1, TSDB_MAX_BYTES_PER_ROW); - size_t cmd_len = 0; - char * line = NULL; - size_t line_len = 0; - - double t = taosGetTimestampMs(); - - while((read_len = tgetline(&line, &line_len, fp)) != -1) { - if (read_len >= TSDB_MAX_BYTES_PER_ROW) continue; - line[--read_len] = '\0'; - - if (read_len == 0 || isCommentLine(line)) { // line starts with # - continue; - } - - if (line[read_len - 1] == '\\') { - line[read_len - 1] = ' '; - memcpy(cmd + cmd_len, line, read_len); - cmd_len += read_len; - continue; - } - - memcpy(cmd + cmd_len, line, read_len); - if (0 != queryDbExec(taos, cmd, NO_INSERT_TYPE, false)) { - errorPrint("%s() LN%d, queryDbExec %s failed!\n", - __func__, __LINE__, cmd); - tmfree(cmd); - tmfree(line); - tmfclose(fp); + FILE *fp = fopen(sqlFile, "r"); + if (fp == NULL) { + printf("failed to open file %s, reason:%s\n", sqlFile, strerror(errno)); return; } - memset(cmd, 0, TSDB_MAX_BYTES_PER_ROW); - cmd_len = 0; - } - t = taosGetTimestampMs() - t; - printf("run %s took %.6f second(s)\n\n", sqlFile, t); + int read_len = 0; + char * cmd = calloc(1, TSDB_MAX_BYTES_PER_ROW); + size_t cmd_len = 0; + char * line = NULL; + size_t line_len = 0; - tmfree(cmd); - tmfree(line); - tmfclose(fp); - return; + double t = taosGetTimestampMs(); + + while((read_len = tgetline(&line, &line_len, fp)) != -1) { + if (read_len >= TSDB_MAX_BYTES_PER_ROW) continue; + line[--read_len] = '\0'; + + if (read_len == 0 || isCommentLine(line)) { // line starts with # + continue; + } + + if (line[read_len - 1] == '\\') { + line[read_len - 1] = ' '; + memcpy(cmd + cmd_len, line, read_len); + cmd_len += read_len; + continue; + } + + memcpy(cmd + cmd_len, line, read_len); + if (0 != queryDbExec(taos, cmd, NO_INSERT_TYPE, false)) { + errorPrint("%s() LN%d, queryDbExec %s failed!\n", + __func__, __LINE__, cmd); + tmfree(cmd); + tmfree(line); + tmfclose(fp); + return; + } + memset(cmd, 0, TSDB_MAX_BYTES_PER_ROW); + cmd_len = 0; + } + + t = taosGetTimestampMs() - t; + printf("run %s took %.6f second(s)\n\n", sqlFile, t); + + tmfree(cmd); + tmfree(line); + tmfclose(fp); + return; } static void testMetaFile() { diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index 98521d8420..e5501b4366 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -1474,6 +1474,8 @@ static void* taosDumpOutWorkThreadFp(void *arg) STableRecord tableRecord; int fd; + setThreadName("dumpOutWorkThrd"); + char tmpBuf[4096] = {0}; sprintf(tmpBuf, ".tables.tmp.%d", pThread->threadIndex); fd = open(tmpBuf, O_RDWR | O_CREAT, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH); @@ -2571,6 +2573,8 @@ static int taosDumpInOneFile(TAOS* taos, FILE* fp, char* fcharset, static void* taosDumpInWorkThreadFp(void *arg) { SThreadParaObj *pThread = (SThreadParaObj*)arg; + setThreadName("dumpInWorkThrd"); + for (int32_t f = 0; f < g_tsSqlFileNum; ++f) { if (f % pThread->totalThreads == pThread->threadIndex) { char *SQLFileName = g_tsDumpInSqlFiles[f]; diff --git a/src/kit/taospack/CMakeLists.txt b/src/kit/taospack/CMakeLists.txt new file mode 100644 index 0000000000..58c3688732 --- /dev/null +++ b/src/kit/taospack/CMakeLists.txt @@ -0,0 +1,21 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(TDengine) + +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc) +INCLUDE_DIRECTORIES(inc) + +IF (TD_LINUX) + AUX_SOURCE_DIRECTORY(. SRC) + ADD_EXECUTABLE(taospack ${SRC}) + TARGET_LINK_LIBRARIES(taospack os tutil tsdb ${VAR_TSZ}) +ELSEIF (TD_WINDOWS) + AUX_SOURCE_DIRECTORY(. SRC) + ADD_EXECUTABLE(taospack ${SRC}) + TARGET_LINK_LIBRARIES(taospack) +ELSEIF (TD_DARWIN) + # MAC + AUX_SOURCE_DIRECTORY(. SRC) + ADD_EXECUTABLE(taospack ${SRC}) + TARGET_LINK_LIBRARIES(taospack os tutil tsdb) +ENDIF () \ No newline at end of file diff --git a/src/kit/taospack/taospack.c b/src/kit/taospack/taospack.c new file mode 100644 index 0000000000..33d779dfcf --- /dev/null +++ b/src/kit/taospack/taospack.c @@ -0,0 +1,766 @@ + + +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include + +#if defined(WINDOWS) +int main(int argc, char *argv[]) { + printf("welcome to use taospack tools v1.3 for windows.\n"); +} +#elif !defined(TD_TSZ) +int main(int argc, char *argv[]) { + printf(" welcome taospack. \n You not open TSZ , please define TD_TSZ to open TSZ algo.\n"); +} +#else + +#include "os.h" +#include "tscompression.h" +#include "tdataformat.h" + + + +// ------- define ----------- +#define FT_CNT 8 + +// ------- function declare -------- +void cost_start(); +double cost_end(const char* tag); +int notsame_cnt = 0; + +// ------- global declare ----------- +float g_ft1[ ] = {\ + 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.9010000228881836, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.630000114440918, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7079999446868896, 3.7079999446868896, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7119998931884766, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7100000381469727, 3.7079999446868896, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7070000171661377, 3.7100000381469727, 3.7119998931884766, 3.7119998931884766, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7139999866485596, 3.7109999656677246, 3.7109999656677246, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7130000591278076, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7119998931884766, 3.7130000591278076, 3.7109999656677246, 3.7079999446868896, 3.7090001106262207, 3.7090001106262207, 3.7119998931884766, 3.7109999656677246, 3.7109999656677246, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7090001106262207, 3.7109999656677246, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7079999446868896, 3.7079999446868896, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7090001106262207, 3.7100000381469727, 3.7090001106262207, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7109999656677246, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7149999141693115, 3.7079999446868896, 3.7070000171661377, 3.7049999237060547, 3.7060000896453857, 3.7060000896453857\ + ,3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.634000062942505, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422 + ,3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.9010000228881836, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.630000114440918, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7079999446868896, 3.7079999446868896, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7119998931884766, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7100000381469727, 3.7079999446868896, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7070000171661377, 3.7100000381469727, 3.7119998931884766, 3.7119998931884766, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7139999866485596, 3.7109999656677246, 3.7109999656677246, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7130000591278076, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7119998931884766, 3.7130000591278076, 3.7109999656677246, 3.7079999446868896, 3.7090001106262207, 3.7090001106262207, 3.7119998931884766, 3.7109999656677246, 3.7109999656677246, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7090001106262207, 3.7109999656677246, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7079999446868896, 3.7079999446868896, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7090001106262207, 3.7100000381469727, 3.7090001106262207, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7109999656677246, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7149999141693115, 3.7079999446868896, 3.7070000171661377, 3.7049999237060547, 3.7060000896453857, 3.7060000896453857\ + ,3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.634000062942505, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422 + }; + +double g_de1[ ] = {\ + 3.895999908447265612345, 3.897000074386596701234, 3.89800000190734860123456789, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.9010000228881836, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.630000114440918, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7079999446868896, 3.7079999446868896, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7119998931884766, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7100000381469727, 3.7079999446868896, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7070000171661377, 3.7100000381469727, 3.7119998931884766, 3.7119998931884766, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7139999866485596, 3.7109999656677246, 3.7109999656677246, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7130000591278076, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7119998931884766, 3.7130000591278076, 3.7109999656677246, 3.7079999446868896, 3.7090001106262207, 3.7090001106262207, 3.7119998931884766, 3.7109999656677246, 3.7109999656677246, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7090001106262207, 3.7109999656677246, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7079999446868896, 3.7079999446868896, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7090001106262207, 3.7100000381469727, 3.7090001106262207, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7109999656677246, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7149999141693115, 3.7079999446868896, 3.7070000171661377, 3.7049999237060547, 3.7060000896453857, 3.7060000896453857\ + ,3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.634000062942505, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422 + ,3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8980000019073486, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8980000019073486, 3.8949999809265137, 3.8959999084472656, 3.8980000019073486, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.9010000228881836, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8980000019073486, 3.8970000743865967, 3.8989999294281006, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8949999809265137, 3.8970000743865967, 3.8980000019073486, 3.8980000019073486, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8970000743865967, 3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8959999084472656, 3.8970000743865967, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.9000000953674316, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8959999084472656, 3.8980000019073486, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.630000114440918, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.8940000534057617, 3.8959999084472656, 3.8970000743865967, 3.8970000743865967, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8929998874664307, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8959999084472656, 3.8929998874664307, 3.8949999809265137, 3.8929998874664307, 3.8959999084472656, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8940000534057617, 3.8970000743865967, 3.8940000534057617, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8949999809265137, 3.8940000534057617, 3.8940000534057617, 3.8959999084472656, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8959999084472656, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787, 3.8929998874664307, 3.8940000534057617, 3.8929998874664307, 3.8940000534057617, 3.8949999809265137, 3.8929998874664307, 3.8929998874664307, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8929998874664307, 3.8940000534057617, 3.8989999294281006, 3.8929998874664307, 3.8929998874664307, 3.8929998874664307, 3.8919999599456787, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8949999809265137, 3.8970000743865967, 3.8940000534057617, 3.8940000534057617, 3.8940000534057617, 3.8929998874664307, 3.8919999599456787\ + ,3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7079999446868896, 3.7079999446868896, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7119998931884766, 3.7090001106262207, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7100000381469727, 3.7079999446868896, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7070000171661377, 3.7100000381469727, 3.7119998931884766, 3.7119998931884766, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7139999866485596, 3.7109999656677246, 3.7109999656677246, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7130000591278076, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7119998931884766, 3.7130000591278076, 3.7109999656677246, 3.7079999446868896, 3.7090001106262207, 3.7090001106262207, 3.7119998931884766, 3.7109999656677246, 3.7109999656677246, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7090001106262207, 3.7109999656677246, 3.7119998931884766, 3.7109999656677246, 3.7090001106262207, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7109999656677246, 3.7119998931884766, 3.7079999446868896, 3.7079999446868896, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7100000381469727, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7100000381469727, 3.7070000171661377, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7090001106262207, 3.7100000381469727, 3.7090001106262207, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7079999446868896, 3.7090001106262207, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7070000171661377, 3.7090001106262207, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7070000171661377, 3.7060000896453857, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7060000896453857, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7060000896453857, 3.7060000896453857, 3.7109999656677246, 3.7070000171661377, 3.7060000896453857, 3.7060000896453857, 3.7049999237060547, 3.7070000171661377, 3.7100000381469727, 3.7079999446868896, 3.7070000171661377, 3.7070000171661377, 3.7079999446868896, 3.7079999446868896, 3.7149999141693115, 3.7079999446868896, 3.7070000171661377, 3.7049999237060547, 3.7060000896453857, 3.7060000896453857\ + ,3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.634000062942505, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.63100004196167, 3.63100004196167, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.63100004196167, 3.63100004196167, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.63100004196167, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.631999969482422, 3.632999897003174, 3.631999969482422, 3.632999897003174, 3.631999969482422 + }; + +/* +struct timeval startTime; +struct timeval endTime; +struct timeval costStart; +double totalCost = 0; + +void cost_start() +{ + totalCost = 0; + gettimeofday(&costStart, NULL); +} + +double cost_end(const char* tag) +{ + double elapsed; + struct timeval costEnd; + gettimeofday(&costEnd, NULL); + elapsed = ((costEnd.tv_sec*1000000+costEnd.tv_usec)-(costStart.tv_sec*1000000+costStart.tv_usec))/1000000.0; + totalCost += elapsed; + double use_ms = totalCost*1000; + printf(" timecost %s : %.3f ms\n", tag, use_ms); + return use_ms; +} +*/ + +float toFloat(char* buf){ + return (float)atoll(buf); +} + +// +// read float +// +float* read_float(const char* inFile, int* pcount){ + // check valid + if(inFile == NULL || inFile[0] == 0 ){ + printf(" inFile is NULL or EMPTY.\n"); + return NULL; + } + + // read in file + FILE* pfin = fopen(inFile, "r"); + if(pfin == NULL){ + printf(" open IN file %s error. errno=%d\n", inFile, errno); + return false; + } + + // read one line from infile and write to outfile + char buf[256]={0}; + int malloc_cnt = 100000; + float* floats = malloc(malloc_cnt*sizeof(float)); + int fi = 0; + while(fgets(buf, sizeof(buf), pfin) != NULL) { + // get item + if(buf[0] == 0 || strcmp(buf, " ") == 0) + continue; + floats[fi] = atof(buf); + //printf(" buff=%s float=%.50f \n ", buf, floats[fi]); + if ( ++fi == malloc_cnt ) { + malloc_cnt += 100000; + floats = realloc(floats, malloc_cnt*sizeof(float)); + } + memset(buf, 0, sizeof(buf)); + } + + // close + fclose(pfin); + if(pcount) + *pcount = fi; + return floats; +} + +float check_same(float* ft1, float* ft2, int count){ + int same_cnt =0; + for(int i=0; i< count; i++){ + + if(ft1[i] == ft2[i]){ + same_cnt ++; + } + + if(i < 5){ + printf(" i=%d ft1=%.40f diff=%.40f \n", i, ft1[i], ft1[i] - ft2[i]); + printf(" i=%d ft2=%.40f \n", i, ft2[i]); + } + + } + float same_rate = same_cnt*100/count; + printf(" all count=%d same=%d same rate=%.0f%% \n", count, same_cnt, same_rate); + return same_rate; +} + +double check_same_double(double* ft1, double* ft2, int count){ + int same_cnt =0; + for(int i=0; i< count; i++){ + + if(ft1[i] == ft2[i]){ + same_cnt ++; + } + + if(i < 5){ + printf(" i=%d ft1=%.40f diff=%.40f \n", i, ft1[i], ft1[i] - ft2[i]); + printf(" i=%d ft2=%.40f \n", i, ft2[i]); + } + + } + double same_rate = same_cnt*100/count; + printf(" all count=%d same=%d same rate=%.0f%% \n", count, same_cnt, same_rate); + return same_rate; +} + +// +// test compress and decompress +// + +bool DoDouble(double* doubles, int cnt, int algorithm) { + // compress + const char* input = (const char*)doubles; + int input_len = cnt * sizeof(double); + char* output = (char*) malloc(input_len); + int output_len = input_len; + char* buff = (char*) malloc(input_len); + int buff_len = input_len; + + cost_start(); + int ret_len = 0; + if(algorithm == 2) + ret_len = tsCompressDouble(input, input_len, cnt, output, output_len, algorithm, buff, buff_len); + else + ret_len = tsCompressDoubleLossy(input, input_len, cnt, output, output_len, algorithm, buff, buff_len); + + if(ret_len == -1) { + printf(" compress error.\n"); + return 0; + } + double use_ms1 = cost_end("compress"); + + printf(" compress len=%d input len=%d\n", ret_len, input_len); + double rate=100*(double)ret_len/(double)input_len; + printf(" compress rate=%.1f an-rate=%.4f%%\n", (double)input_len/(double)ret_len, rate); + + // + // decompress + // + double* ft2 = (double*)malloc(input_len); + cost_start(); + int code = 0; + + if(algorithm == 2) + code = tsDecompressDouble(output, ret_len, cnt, (char*)ft2, input_len, algorithm, buff, buff_len); + else + code = tsDecompressDoubleLossy(output, ret_len, cnt, (char*)ft2, input_len, algorithm, buff, buff_len); + + + double use_ms2 = cost_end("Decompress"); + printf(" Decompress return length=%d \n", code); + + // compare same + double same_rate = check_same_double(doubles, ft2, cnt); + + printf("\n ------------------ count:%d <%s> ---------------- \n", cnt, algorithm == 2?"TD":"SZ"); + printf(" Compress Rate ......... [%.2f%%] \n", rate); + double speed1 = (cnt*sizeof(double)*1000/1024/1024)/use_ms1; + printf(" Compress Time ......... [%.4fms] speed=%.1f MB/s\n", use_ms1, speed1); + double speed2 = (cnt*sizeof(double)*1000/1024/1024)/use_ms2; + printf(" Decompress Time........ [%.4fms] speed=%.1f MB/s\n", use_ms2, speed2); + printf(" Same Rate ............. [%.0f%%] \n\n", same_rate); + + + // free + free(ft2); + free(buff); + free(output); + + return true; +} + +bool DoFloat(float* floats, int cnt, int algorithm, bool lossy) { + // compress + const char* input = (const char*)floats; + int input_len = cnt * sizeof(float); + char* output = (char*) malloc(input_len); + int output_len = input_len; + char* buff = (char*) malloc(input_len); + int buff_len = input_len; + + cost_start(); + int ret_len = 0; + ret_len = tsCompressFloat(input, input_len, cnt, output, output_len, algorithm, buff, buff_len); + + if(ret_len == -1) { + printf(" compress error.\n"); + return 0; + } + double use_ms1 = cost_end("compress"); + + printf(" compress len=%d input len=%d\n", ret_len, input_len); + float rate=100*(float)ret_len/(float)input_len; + printf(" compress rate=%.1f an-rate=%.4f%%\n", (float)input_len/(float)ret_len, rate); + + // + // decompress + // + float* ft2 = (float*)malloc(input_len); + cost_start(); + int code = 0; + code = tsDecompressFloat(output, ret_len, cnt, (char*)ft2, input_len, algorithm, buff, buff_len); + + double use_ms2 = cost_end("Decompress"); + printf(" Decompress return length=%d \n", code); + + // compare same + float same_rate = check_same(floats, ft2, cnt); + + printf("\n ------------------ count:%d <%s> ---------------- \n", cnt, lossy?"SZ":"TD"); + printf(" Compress Rate ......... [%.2f%%] \n", rate); + double speed1 = (cnt*sizeof(float)*1000/1024/1024)/use_ms1; + printf(" Compress Time ......... [%.4fms] speed=%.1f MB/s\n", use_ms1, speed1); + double speed2 = (cnt*sizeof(float)*1000/1024/1024)/use_ms2; + printf(" Decompress Time........ [%.4fms] speed=%.1f MB/s\n", use_ms2, speed2); + printf(" Same Rate ............. [%.0f%%] \n\n", same_rate); + + + // free + free(ft2); + free(buff); + free(output); + + return true; +} + + +bool testFile(const char* inFile, char algorithm, bool lossy){ + // check valid + if(inFile == NULL || inFile[0] == 0 ){ + printf(" inFile is NULL or EMPTY.\n"); + return false; + } + + int cnt = 0; + float* floats = read_float(inFile, &cnt); + if(floats == NULL) { + return false; + } + + DoFloat(floats, cnt, algorithm, lossy); + + free(floats); + return true; +} +// +// txt to binary file +// +#define BUFF_CNT 256 +bool txt_to_bin(const char* inFile, const char* outFile){ + // check valid + if(inFile == NULL || outFile == NULL || inFile[0] == 0 || outFile[0] == 0){ + printf(" inFile or outFile is NULL or EMPTY.\n"); + return false; + } + + printf(" infile=%s \n", inFile); + printf(" outfile=%s \n", outFile); + + // read in file + FILE* pfin = fopen(inFile, "r"); + if(pfin == NULL){ + printf(" open IN file %s error. errno=%d\n", inFile, errno); + return false; + } + + // create out file + FILE* pfout = fopen(outFile, "w+"); + if(pfout == NULL){ + printf(" open OUT file %s error. errno=%d\n", outFile, errno); + fclose(pfin); + return false; + } + + // read one line from infile and write to outfile + char buf[256]={0}; + float fbuf[BUFF_CNT] = {0}; + int fi = 0; + int count = 0; + while(fgets(buf, sizeof(buf), pfin) != NULL) { + // get item + fbuf[fi] = toFloat(buf); + if ( ++fi == BUFF_CNT ) { + // write + if(fwrite(fbuf, sizeof(float), BUFF_CNT, pfout) == 0) { + printf(" write to file %s error , code=%d . app exit.\n", outFile, errno); + exit(1); + } + fi = 0; + } + count ++; + memset(buf, 0, sizeof(buf)); + } + + // write retain + if( fi > 0){ + if(fwrite(fbuf, sizeof(float), fi, pfout) == 0) { + printf(" write to file %s error , code=%d . app exit.\n", outFile, errno); + exit(1); + } + } + + // close + fclose(pfin); + fclose(pfout); + + // total + printf(" count=%d write bytes=%d \n", count, (int)(count*sizeof(float))); + return true; +} + + +int memTestDouble() { + // douelbe + const char* input = (const char*) g_de1; + double* de1 = g_de1; + int input_len = sizeof(g_de1); + int cnt = input_len/sizeof(double); + printf(" input input_len=%d count=%d \n", input_len, cnt); + + char* output = (char*) malloc(input_len); + int output_len = input_len; + + char buff[1024] ={0}; + int buff_len = sizeof(buff); + + cost_start(); + int ret_len = tsCompressDoubleLossy(input, input_len, cnt, output, output_len, ONE_STAGE_COMP, buff, buff_len); + if(ret_len == -1) { + printf(" compress error.\n"); + return 0; + } + cost_end(" tscompress"); + + printf(" compress return len=%d input len=%d\n", ret_len, input_len); + printf(" compress rate=%.1f an-rate=%.0f%%\n", (float)input_len/(float)ret_len, 100*(float)ret_len/(float)input_len); + + // + // decompress + // + double* de2 = (double*)malloc(input_len); + cost_start(); + int code = tsDecompressDoubleLossy(output, ret_len, cnt, (char*)de2, input_len, ONE_STAGE_COMP, buff, buff_len); + cost_end("tsde-compress double"); + printf(" de-compress return code=%d \n", code); + + + // + // show + // + int same_cnt = 0; + int diffshow_cnt = 0; + for(int i=0; i< cnt; i++){ + + if(i < 10) + printf(" i=%d de1=%.20f de2=%.20f same=%d\n", i, de1[i], de2[i], de1[i] == de2[i]); + + if(de1[i] == de2[i]) + same_cnt ++; + else { + notsame_cnt++; + if(i >= 10 && ++diffshow_cnt < 50){ + printf(" i=%d de1=%.20f de2=%.20f diff\n", i, de1[i], de2[i]); + } + } + } + + printf(" ---- result doulbe : same =%d cnt=%d rate:%d%% global not same=%d---- \n", same_cnt, cnt, same_cnt*100/cnt, notsame_cnt); + + free(output); + free(de2); + return 1; +} + + + + +int memTest() { + + // + //float ft1[] = {1.2, 2.4, 3.33, 4.444, 5.555, 6.6666, 7.7777, 8.88888,1.2, 2.4, 3.33, 4.444, 5.555, 6.6666, 7.7777, 8.88888,1.2, 2.4, 3.33, 4.444, 5.555, 6.6666, 7.7777, 8.88888}; + // + + float* ft1 = g_ft1; + const char* input = (const char*) ft1; + int input_len = sizeof(g_ft1); + int cnt = input_len/sizeof(float); + printf(" input input_len=%d count=%d \n", input_len, cnt); + + + char* output = (char*) malloc(input_len); + int output_len = input_len; + + char buff[1024] ={0}; + int buff_len = sizeof(buff); + + cost_start(); + int ret_len = tsCompressFloatLossy(input, input_len, cnt, output, output_len, ONE_STAGE_COMP, buff, buff_len); + if(ret_len == -1) { + printf(" compress error.\n"); + return 0; + } + cost_end(" tscompress"); + + printf(" compress return len=%d input len=%d\n", ret_len, input_len); + printf(" compress sz rate=%.1f an-rate=%.2f%%\n", (float)input_len/(float)ret_len, 100*(float)ret_len/(float)input_len); + + // + // decompress + // + float* ft2 = (float*)malloc(input_len); + cost_start(); + int code = tsDecompressFloatLossy(output, ret_len, cnt, (char*)ft2, input_len, ONE_STAGE_COMP, buff, buff_len); + cost_end("tsde-compress"); + printf(" de-compress return code=%d \n", code); + + + // + // show + // + int same_cnt = 0; + int diffshow_cnt = 0; + for(int i=0; i< cnt; i++){ + + if(i < 10) + printf(" i=%d ft1=%.20f ft2=%.20f same=%d\n", i, ft1[i], ft2[i], ft1[i] == ft2[i]); + + if(ft1[i] == ft2[i]) + same_cnt ++; + else { + notsame_cnt++; + if(i >= 10 && ++diffshow_cnt < 50){ + printf(" i=%d ft1=%.20f ft2=%.20f diff\n", i, ft1[i], ft2[i]); + } + } + } + + printf(" ---- result : same =%d cnt=%d rate:%d%% global not same=%d---- \n", same_cnt, cnt, same_cnt*100/cnt, notsame_cnt); + + free(output); + free(ft2); + return 1; +} + +void* memTestThread(void* lparam) { + //memTest(); + printf(" enter thread ....\n"); + for(int i=0; i<1; i++) + { + memTest(); + printf(" start i=%d .... \n", i); + } + return NULL; +} + +void test_threadsafe(int thread_count){ + printf(" test thread safe . thread count=%d \n", thread_count); + pthread_t handle[1000000]; + int i=0; + for(i=0; i< thread_count; i++){ + printf(" create thread %d... \n", i); + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_create(&handle[i], &attr, memTestThread, NULL); + pthread_attr_destroy(&attr); + } + + for(i=0; i< thread_count; i++) + { + pthread_join(handle[i], NULL); + } + + printf(" test thread safe end. not same count=%d\n", notsame_cnt); + +} + + +void* memTestThreadDouble(void* lparam) { + //memTest(); + printf(" enter thread ....\n"); + for(int i=0; i< 1; i++) + { + memTest(); + printf(" double start i=%d .... \n", i); + } + return NULL; +} + +void test_threadsafe_double(int thread_count){ + printf(" test thread safe . thread count=%d \n", thread_count); + pthread_t handle[1000000]; + int i=0; + for(i=0; i< thread_count; i++){ + printf(" create thread %d... \n", i); + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_create(&handle[i], &attr, memTestThreadDouble, NULL); + pthread_attr_destroy(&attr); + } + + for(i=0; i< thread_count; i++) + { + pthread_join(handle[i], NULL); + } + + printf("\n ---- double test thread safe end. not same count=%d-----\n", notsame_cnt); + +} + + +void unitTestFloat() { + + float ft1 [] = {1.11, 2.22, 3.333}; + int cnt = sizeof(ft1)/sizeof(float); + float* floats = ft1; + int algorithm = 2; + + // compress + const char* input = (const char*)floats; + int input_len = cnt * sizeof(float); + int output_len = input_len + 1024; + char* output = (char*) malloc(output_len); + char* buff = (char*) malloc(input_len); + int buff_len = input_len; + + printf(" ft1 have count=%d \n", cnt); + strcpy(output, "abcde"); + + cost_start(); + int ret_len = 0; + ret_len = tsCompressFloatLossy(input, input_len, cnt, output, output_len, algorithm, buff, buff_len); + + if(ret_len == 0) { + printf(" compress error.\n"); + return ; + } + double use_ms1 = cost_end("compress"); + + printf(" compress len=%d input len=%d\n", ret_len, input_len); + float rate=100*(float)ret_len/(float)input_len; + printf(" compress rate=%.1f an-rate=%.4f%%\n", (float)input_len/(float)ret_len, rate); + + // + // decompress + // + float* ft2 = (float*)malloc(input_len); + cost_start(); + int code = 0; + code = tsDecompressFloatLossy(output, ret_len, cnt, (char*)ft2, input_len, algorithm, buff, buff_len); + + + double use_ms2 = cost_end("Decompress"); + printf(" Decompress return length=%d \n", code); + + // compare same + float same_rate = check_same(floats, ft2, cnt); + + printf("\n ------------------ count:%d TD ---------------- \n", cnt); + printf(" Compress Rate ......... [%.0f%%] \n", rate); + double speed1 = (cnt*sizeof(float)*1000/1024/1024)/use_ms1; + printf(" Compress Time ......... [%.4fms] speed=%.1f MB/s\n", use_ms1, speed1); + double speed2 = (cnt*sizeof(float)*1000/1024/1024)/use_ms2; + printf(" Decompress Time........ [%.4fms] speed=%.1f MB/s\n", use_ms2, speed2); + printf(" Same Rate ............. [%.0f%%] \n\n", same_rate); + + + // free + free(ft2); + free(buff); + free(output); + +} + +#define DB_CNT 500 +void test_same_double(int algo){ + double ori = 3.1415926; + + double doubles [DB_CNT]; + for(int i=0; i< DB_CNT; i++){ + doubles[i] = ori; + } + + DoDouble(doubles, DB_CNT, algo); + +} + +#ifdef TD_TSZ +extern char lossyColumns []; +extern bool lossyDouble; +extern bool lossyFloat; +extern double fPrecision; +extern char Compressor []; +#endif +// +// ----------------- main ---------------------- +// +int main(int argc, char *argv[]) { + printf("welcome to use taospack tools v1.3\n"); + + //printf(" sizeof(int)=%d\n", (int)sizeof(int)); + //printf(" sizeof(long)=%d\n", (int)sizeof(long)); + //printf(" sizeof(short)=%d\n",(int)sizeof(short)); + + + strcpy(lossyColumns, "float|double"); + bool lossy = true; + //fPrecision = 1E-5; + //strcpy(Compressor, "GZIP_COMPRESSOR"); + + tsCompressInit(); + lossyFloat = lossyDouble = true; + + printf(" fPrecision=%.15f\n",fPrecision); + + + // + //tsCompressExit(); + //return 1; + //printf(" SZ_SIZE_TYPE=%d", ) + + if(argc == 3){ + char algo = 0; + // t + if(strcmp(argv[1], "-tone") == 0 || strcmp(argv[1], "-t") == 0 ) { + algo = ONE_STAGE_COMP; + lossyFloat = lossyDouble = true; + } + if(strcmp(argv[1], "-tw") == 0) { + algo = TWO_STAGE_COMP; + lossy = false; + lossyFloat = lossyDouble = false; + } + + if(strcmp(argv[1], "-sf") == 0) { + test_threadsafe(atoi(argv[2])); + return 0; + } + + if(strcmp(argv[1], "-sd") == 0) { + test_threadsafe_double(atoi(argv[2])); + return 0; + } + + if(strcmp(argv[1], "-samed") == 0) { + test_same_double(atoi(argv[2])); + return 0; + } + + if(algo == 0){ + printf(" no param -tone -tw \n"); + return 0; + } + + bool ret = testFile(argv[2], algo, lossy); + printf(" test file %s. \n", ret ? "ok" : "err"); + return 1; + + } else if( argc == 2) { + if(strcmp(argv[1], "-mem") == 0) { + memTest(); + } + } + else{ + unitTestFloat(); + } + + tsCompressExit(); + return 0; +} + +#endif + diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index 897c3a2f0f..7644f4d733 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -1113,6 +1113,7 @@ static void *sdbWorkerFp(void *pWorker) { void * unUsed; taosBlockSIGPIPE(); + setThreadName("sdbWorker"); while (1) { int32_t numOfMsgs = taosReadAllQitemsFromQset(tsSdbWQset, tsSdbWQall, &unUsed); diff --git a/src/os/inc/osDef.h b/src/os/inc/osDef.h index 9176da5b8e..54a4f98254 100644 --- a/src/os/inc/osDef.h +++ b/src/os/inc/osDef.h @@ -210,6 +210,25 @@ extern "C" { #define PRIzu "zu" #endif + +#if defined(_TD_LINUX_64) || defined(_TD_LINUX_32) || defined(_TD_MIPS_64) || defined(_TD_ARM_32) || defined(_TD_ARM_64) || defined(_TD_DARWIN_64) + #if defined(_TD_DARWIN_64) + // MacOS + #if !defined(_GNU_SOURCE) + #define setThreadName(name) do { pthread_setname_np((name)); } while (0) + #else + // pthread_setname_np not defined + #define setThreadName(name) + #endif + #else + // Linux, length of name must <= 16 (the last '\0' included) + #define setThreadName(name) do { prctl(PR_SET_NAME, (name)); } while (0) + #endif +#else + // Windows + #define setThreadName(name) +#endif + #ifdef __cplusplus } #endif diff --git a/src/os/inc/osInc.h b/src/os/inc/osInc.h index 340ff34635..9b78110833 100644 --- a/src/os/inc/osInc.h +++ b/src/os/inc/osInc.h @@ -85,6 +85,7 @@ extern "C" { #include #include #include + #include #if !(defined(_ALPINE)) #include diff --git a/src/os/src/darwin/dwSemaphore.c b/src/os/src/darwin/dwSemaphore.c index 898410647a..25cb28cff1 100644 --- a/src/os/src/darwin/dwSemaphore.c +++ b/src/os/src/darwin/dwSemaphore.c @@ -41,6 +41,8 @@ static semaphore_t sem_exit; static void* sem_thread_routine(void *arg) { (void)arg; + setThreadName("sem_thrd"); + sem_port = mach_task_self(); kern_return_t ret = semaphore_create(sem_port, &sem_exit, SYNC_POLICY_FIFO, 0); if (ret != KERN_SUCCESS) { diff --git a/src/os/src/darwin/dwTimer.c b/src/os/src/darwin/dwTimer.c index ee1becc91a..d395a7f53f 100644 --- a/src/os/src/darwin/dwTimer.c +++ b/src/os/src/darwin/dwTimer.c @@ -32,6 +32,7 @@ static volatile int timer_stop = 0; static void* timer_routine(void *arg) { (void)arg; + setThreadName("timer"); int r = 0; struct timespec to = {0}; diff --git a/src/os/src/detail/osTimer.c b/src/os/src/detail/osTimer.c index b054f08c78..c381b3e825 100644 --- a/src/os/src/detail/osTimer.c +++ b/src/os/src/detail/osTimer.c @@ -38,6 +38,8 @@ static void *taosProcessAlarmSignal(void *tharg) { struct sigevent sevent = {{0}}; + setThreadName("alarmSignal"); + #ifdef _ALPINE sevent.sigev_notify = SIGEV_THREAD; sevent.sigev_value.sival_int = syscall(__NR_gettid); diff --git a/src/plugins/http/inc/httpParser.h b/src/plugins/http/inc/httpParser.h index fbe1ecee7e..f7b55958c8 100644 --- a/src/plugins/http/inc/httpParser.h +++ b/src/plugins/http/inc/httpParser.h @@ -100,6 +100,7 @@ typedef enum HTTP_PARSER_STATE { HTTP_PARSER_CHUNK, HTTP_PARSER_END, HTTP_PARSER_ERROR, + HTTP_PARSER_OPTIONAL_SP } HTTP_PARSER_STATE; typedef enum HTTP_AUTH_TYPE { diff --git a/src/plugins/http/src/httpParser.c b/src/plugins/http/src/httpParser.c index a68a9bd7ed..ba88a2b9cd 100644 --- a/src/plugins/http/src/httpParser.c +++ b/src/plugins/http/src/httpParser.c @@ -744,6 +744,15 @@ static int32_t httpParserOnSp(HttpParser *parser, HTTP_PARSER_STATE state, const return ok; } +static int32_t httpParserOnOptionalSp(HttpParser *parser, HTTP_PARSER_STATE state, const char c, int32_t *again) { + int32_t ok = 0; + if (c != ' ') { + *again = 1; + httpPopStack(parser); + } + return ok; +} + static int32_t httpParserOnStatusCode(HttpParser *parser, HTTP_PARSER_STATE state, const char c, int32_t *again) { HttpContext *pContext = parser->pContext; int32_t ok = 0; @@ -867,7 +876,7 @@ static int32_t httpParserOnHeader(HttpParser *parser, HTTP_PARSER_STATE state, c } httpPushStack(parser, HTTP_PARSER_CRLF); httpPushStack(parser, HTTP_PARSER_HEADER_VAL); - httpPushStack(parser, HTTP_PARSER_SP); + httpPushStack(parser, HTTP_PARSER_OPTIONAL_SP); httpPushStack(parser, HTTP_PARSER_HEADER_KEY); break; } @@ -1061,6 +1070,10 @@ static int32_t httpParseChar(HttpParser *parser, const char c, int32_t *again) { ok = httpParserOnSp(parser, state, c, again); break; } + if (state == HTTP_PARSER_OPTIONAL_SP) { + ok = httpParserOnOptionalSp(parser, state, c, again); + break; + } if (state == HTTP_PARSER_STATUS_CODE) { ok = httpParserOnStatusCode(parser, state, c, again); break; diff --git a/src/plugins/http/src/httpQueue.c b/src/plugins/http/src/httpQueue.c index 7f7ce40460..677ab0c91d 100644 --- a/src/plugins/http/src/httpQueue.c +++ b/src/plugins/http/src/httpQueue.c @@ -70,6 +70,8 @@ static void *httpProcessResultQueue(void *param) { int32_t type; void * unUsed; + setThreadName("httpResultQ"); + while (1) { if (taosReadQitemFromQset(tsHttpQset, &type, (void **)&pMsg, &unUsed) == 0) { httpDebug("qset:%p, http queue got no message from qset, exiting", tsHttpQset); diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index 9d98d3f113..f02859f165 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -117,6 +117,7 @@ static void httpProcessHttpData(void *param) { int32_t fdNum; taosSetMaskSIGPIPE(); + setThreadName("httpData"); while (1) { struct epoll_event events[HTTP_MAX_EVENTS]; @@ -208,6 +209,7 @@ static void *httpAcceptHttpConnection(void *arg) { int32_t totalFds = 0; taosSetMaskSIGPIPE(); + setThreadName("httpAcceptConn"); pServer->fd = taosOpenTcpServerSocket(pServer->serverIp, pServer->serverPort); diff --git a/src/plugins/monitor/src/monMain.c b/src/plugins/monitor/src/monMain.c index 2c4a0c1a4c..960a097f5d 100644 --- a/src/plugins/monitor/src/monMain.c +++ b/src/plugins/monitor/src/monMain.c @@ -114,6 +114,7 @@ int32_t monStartSystem() { static void *monThreadFunc(void *param) { monDebug("starting to initialize monitor module ..."); + setThreadName("monThrd"); while (1) { static int32_t accessTimes = 0; diff --git a/src/plugins/mqtt/src/mqttSystem.c b/src/plugins/mqtt/src/mqttSystem.c index eacc3b1f74..e0f2f393bb 100644 --- a/src/plugins/mqtt/src/mqttSystem.c +++ b/src/plugins/mqtt/src/mqttSystem.c @@ -100,6 +100,8 @@ void mqttPublishCallback(void** unused, struct mqtt_response_publish* published) } void* mqttClientRefresher(void* client) { + setThreadName("mqttCliRefresh"); + while (tsMqttIsRuning) { mqtt_sync((struct mqtt_client*)client); taosMsleep(100); @@ -141,4 +143,4 @@ void mqttReconnectClient(struct mqtt_client* client, void** unused) { mqtt_reinit(client, sockfd, tsMqttStatus.sendbuf, tsMqttStatus.sendbufsz, tsMqttStatus.recvbuf, tsMqttStatus.recvbufsz); mqtt_connect(client, tsMqttClientId, NULL, NULL, 0, tsMqttUser, tsMqttPass, MQTT_CONNECT_CLEAN_SESSION, 400); mqtt_subscribe(client, tsMqttTopic, 0); -} \ No newline at end of file +} diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index 029629eff0..e9feeef9d3 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -242,6 +242,7 @@ static void *taosAcceptTcpConnection(void *arg) { pServerObj = (SServerObj *)arg; tDebug("%s TCP server is ready, ip:0x%x:%hu", pServerObj->label, pServerObj->ip, pServerObj->port); + setThreadName("acceptTcpConn"); while (1) { socklen_t addrlen = sizeof(caddr); @@ -528,6 +529,11 @@ static void *taosProcessTcpData(void *param) { SFdObj *pFdObj; struct epoll_event events[maxEvents]; SRecvInfo recvInfo; + char name[16]; + + memset(name, 0, sizeof(name)); + snprintf(name, 16, "%s-tcpData", pThreadObj->label); + setThreadName(name); while (1) { int fdNum = epoll_wait(pThreadObj->pollFd, events, maxEvents, TAOS_EPOLL_WAIT_TIME); diff --git a/src/rpc/src/rpcUdp.c b/src/rpc/src/rpcUdp.c index 7a46dbe5c3..086a390cb8 100644 --- a/src/rpc/src/rpcUdp.c +++ b/src/rpc/src/rpcUdp.c @@ -195,6 +195,8 @@ static void *taosRecvUdpData(void *param) { tDebug("%s UDP thread is created, index:%d", pConn->label, pConn->index); char *msg = pConn->buffer; + setThreadName("recvUdpData"); + while (1) { dataLen = recvfrom(pConn->fd, pConn->buffer, RPC_MAX_UDP_SIZE, 0, (struct sockaddr *)&sourceAdd, &addLen); if (dataLen <= 0) { diff --git a/src/rpc/test/rclient.c b/src/rpc/test/rclient.c index faa6d40da3..de30114bd1 100644 --- a/src/rpc/test/rclient.c +++ b/src/rpc/test/rclient.c @@ -47,6 +47,8 @@ static int tcount = 0; static void *sendRequest(void *param) { SInfo *pInfo = (SInfo *)param; SRpcMsg rpcMsg = {0}; + + setThreadName("sendCliReq"); tDebug("thread:%d, start to send request", pInfo->index); diff --git a/src/rpc/test/rsclient.c b/src/rpc/test/rsclient.c index a152d8e4a5..3e94a56efb 100644 --- a/src/rpc/test/rsclient.c +++ b/src/rpc/test/rsclient.c @@ -39,8 +39,10 @@ static int terror = 0; static void *sendRequest(void *param) { SInfo *pInfo = (SInfo *)param; - SRpcMsg rpcMsg, rspMsg; + SRpcMsg rpcMsg, rspMsg; + setThreadName("sendSrvReq"); + tDebug("thread:%d, start to send request", pInfo->index); while ( pInfo->numOfReqs == 0 || pInfo->num < pInfo->numOfReqs) { diff --git a/src/sync/src/syncRestore.c b/src/sync/src/syncRestore.c index c0d66316cd..bf9d5201a0 100644 --- a/src/sync/src/syncRestore.c +++ b/src/sync/src/syncRestore.c @@ -263,6 +263,7 @@ static int32_t syncRestoreDataStepByStep(SSyncPeer *pPeer) { } void *syncRestoreData(void *param) { + setThreadName("syncRestoreData"); int64_t rid = (int64_t)param; SSyncPeer *pPeer = syncAcquirePeer(rid); if (pPeer == NULL) { diff --git a/src/sync/src/syncRetrieve.c b/src/sync/src/syncRetrieve.c index c86ab85499..89fdda0686 100644 --- a/src/sync/src/syncRetrieve.c +++ b/src/sync/src/syncRetrieve.c @@ -415,6 +415,7 @@ static int32_t syncRetrieveDataStepByStep(SSyncPeer *pPeer) { } void *syncRetrieveData(void *param) { + setThreadName("syncRetrievData"); int64_t rid = (int64_t)param; SSyncPeer *pPeer = syncAcquirePeer(rid); if (pPeer == NULL) { diff --git a/src/sync/src/syncTcp.c b/src/sync/src/syncTcp.c index 3ad9e9bba0..698245f9e4 100644 --- a/src/sync/src/syncTcp.c +++ b/src/sync/src/syncTcp.c @@ -195,6 +195,8 @@ static void *syncProcessTcpData(void *param) { SConnObj * pConn = NULL; struct epoll_event events[maxEvents]; + setThreadName("syncTcpData"); + void *buffer = malloc(pInfo->bufferSize); taosBlockSIGPIPE(); @@ -257,6 +259,7 @@ static void *syncAcceptPeerTcpConnection(void *argv) { SPoolInfo *pInfo = &pPool->info; taosBlockSIGPIPE(); + setThreadName("acceptTcpConn"); while (1) { struct sockaddr_in clientAddr; diff --git a/src/sync/test/syncClient.c b/src/sync/test/syncClient.c index 23ea54ee0c..303d2376ef 100644 --- a/src/sync/test/syncClient.c +++ b/src/sync/test/syncClient.c @@ -48,6 +48,8 @@ void *sendRequest(void *param) { SInfo * pInfo = (SInfo *)param; SRpcMsg rpcMsg = {0}; + setThreadName("sendCliReq"); + uDebug("thread:%d, start to send request", pInfo->index); while (pInfo->numOfReqs == 0 || pInfo->num < pInfo->numOfReqs) { diff --git a/src/sync/test/syncServer.c b/src/sync/test/syncServer.c index eeaa6a08c2..a3d0696648 100644 --- a/src/sync/test/syncServer.c +++ b/src/sync/test/syncServer.c @@ -178,6 +178,8 @@ void *processWriteQueue(void *param) { int type; void *item; + setThreadName("writeQ"); + while (1) { int ret = taosReadQitem(qhandle, &type, &item); if (ret <= 0) { diff --git a/src/tsdb/src/tsdbCommitQueue.c b/src/tsdb/src/tsdbCommitQueue.c index e25014bc1e..e45ac05e97 100644 --- a/src/tsdb/src/tsdbCommitQueue.c +++ b/src/tsdb/src/tsdbCommitQueue.c @@ -158,6 +158,8 @@ static void *tsdbLoopCommit(void *arg) { STsdbRepo * pRepo = NULL; TSDB_REQ_T req; + setThreadName("tsdbCommit"); + while (true) { pthread_mutex_lock(&(pQueue->lock)); @@ -208,4 +210,4 @@ void tsdbDecCommitRef(int vgId) { int refCount = atomic_sub_fetch_32(&tsCommitQueue.refCount, 1); pthread_cond_broadcast(&(tsCommitQueue.queueNotEmpty)); tsdbDebug("vgId:%d, dec commit queue ref to %d", vgId, refCount); -} \ No newline at end of file +} diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 621be04e21..f233500ee9 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -787,7 +787,7 @@ static char *getTagIndexKey(const void *pData) { void * res = tdGetKVRowValOfCol(pTable->tagVal, pCol->colId); if (res == NULL) { // treat the column as NULL if we cannot find it - res = getNullValue(pCol->type); + res = (char*)getNullValue(pCol->type); } return res; } diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index c48851df45..0957a777e3 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -3085,7 +3085,7 @@ int32_t checkForCachedLastRow(STsdbQueryHandle* pQueryHandle, STableGroupInfo *g } // update the tsdb query time range - if (pQueryHandle->cachelastrow) { + if (pQueryHandle->cachelastrow != TSDB_CACHED_TYPE_NONE) { pQueryHandle->window = TSWINDOW_INITIALIZER; pQueryHandle->checkFiles = false; pQueryHandle->activeIndex = -1; // start from -1 @@ -3117,6 +3117,7 @@ STimeWindow updateLastrowForEachGroup(STableGroupInfo *groupList) { STimeWindow window = {INT64_MAX, INT64_MIN}; int32_t totalNumOfTable = 0; + SArray* emptyGroup = taosArrayInit(16, sizeof(int32_t)); // NOTE: starts from the buffer in case of descending timestamp order check data blocks size_t numOfGroups = taosArrayGetSize(groupList->pGroupList); @@ -3159,27 +3160,30 @@ STimeWindow updateLastrowForEachGroup(STableGroupInfo *groupList) { } } - taosArrayClear(pGroup); - // more than one table in each group, only one table left for each group if (keyInfo.pTable != NULL) { totalNumOfTable++; - taosArrayPush(pGroup, &keyInfo); - } else { + if (taosArrayGetSize(pGroup) == 1) { + // do nothing + } else { + taosArrayClear(pGroup); + taosArrayPush(pGroup, &keyInfo); + } + } else { // mark all the empty groups, and remove it later taosArrayDestroy(pGroup); - - taosArrayRemove(groupList->pGroupList, j); - numOfGroups -= 1; - j -= 1; + taosArrayPush(emptyGroup, &j); } } // window does not being updated, so set the original if (window.skey == INT64_MAX && window.ekey == INT64_MIN) { window = TSWINDOW_INITIALIZER; - assert(totalNumOfTable == 0 && taosArrayGetSize(groupList->pGroupList) == 0); + assert(totalNumOfTable == 0 && taosArrayGetSize(groupList->pGroupList) == numOfGroups); } + taosArrayRemoveBatch(groupList->pGroupList, TARRAY_GET_START(emptyGroup), (int32_t) taosArrayGetSize(emptyGroup)); + taosArrayDestroy(emptyGroup); + groupList->numOfTables = totalNumOfTable; return window; } diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 85b15c0a4f..ef304d2fcb 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -4,13 +4,18 @@ PROJECT(TDengine) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/rpc/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/sync/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/rmonotonic/inc) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/TSZ/sz/include) + AUX_SOURCE_DIRECTORY(src SRC) ADD_LIBRARY(tutil ${SRC}) -TARGET_LINK_LIBRARIES(tutil pthread os lz4 z rmonotonic) + +TARGET_LINK_LIBRARIES(tutil pthread os lz4 z rmonotonic ${VAR_TSZ} ) + + IF (TD_LINUX) TARGET_LINK_LIBRARIES(tutil m rt) - # ADD_SUBDIRECTORY(tests) + ADD_SUBDIRECTORY(tests) FIND_PATH(ICONV_INCLUDE_EXIST iconv.h /usr/include/ /usr/local/include/) IF (ICONV_INCLUDE_EXIST) @@ -36,4 +41,4 @@ ENDIF() IF (TD_STORAGE) TARGET_LINK_LIBRARIES(tutil storage) -ENDIF () \ No newline at end of file +ENDIF () diff --git a/src/util/inc/tarray.h b/src/util/inc/tarray.h index 63cadf39a3..2da74eac82 100644 --- a/src/util/inc/tarray.h +++ b/src/util/inc/tarray.h @@ -52,6 +52,22 @@ void* taosArrayInit(size_t size, size_t elemSize); */ void *taosArrayAddBatch(SArray *pArray, const void *pData, int nEles); +/** + * + * @param pArray + * @param pData position array list + * @param numOfElems the number of removed position + */ +void taosArrayRemoveBatch(SArray *pArray, const int32_t* pData, int32_t numOfElems); + +/** + * + * @param pArray + * @param comparFn + * @param fp + */ +void taosArrayRemoveDuplicate(SArray *pArray, __compar_fn_t comparFn, void (*fp)(void*)); + /** * add all element from the source array list into the destination * @param pArray diff --git a/src/util/inc/tconfig.h b/src/util/inc/tconfig.h index fdb2595fd8..d03ce6e0f1 100644 --- a/src/util/inc/tconfig.h +++ b/src/util/inc/tconfig.h @@ -20,7 +20,7 @@ extern "C" { #endif -#define TSDB_CFG_MAX_NUM 110 +#define TSDB_CFG_MAX_NUM 116 // 110 + 6 with lossy option #define TSDB_CFG_PRINT_LEN 23 #define TSDB_CFG_OPTION_LEN 24 #define TSDB_CFG_VALUE_LEN 41 @@ -32,6 +32,9 @@ extern "C" { #define TSDB_CFG_CTYPE_B_OPTION 16U // can be configured by taos_options function #define TSDB_CFG_CTYPE_B_NOT_PRINT 32U // such as password +#define MAX_FLOAT 100000 +#define MIN_FLOAT 0 + enum { TAOS_CFG_CSTATUS_NONE, // not configured TAOS_CFG_CSTATUS_DEFAULT, // use system default value @@ -50,6 +53,7 @@ enum { TAOS_CFG_VTYPE_IPSTR, TAOS_CFG_VTYPE_DIRECTORY, TAOS_CFG_VTYPE_DATA_DIRCTORY, + TAOS_CFG_VTYPE_DOUBLE, }; enum { diff --git a/src/util/inc/tscompression.h b/src/util/inc/tscompression.h index cca6d6e250..3f2160bbf2 100644 --- a/src/util/inc/tscompression.h +++ b/src/util/inc/tscompression.h @@ -34,6 +34,22 @@ extern "C" { #define ONE_STAGE_COMP 1 #define TWO_STAGE_COMP 2 +// +// compressed data first byte foramt +// ------ 7 bit ---- | ---- 1 bit ---- +// algorithm mode +// + +// compression data mode save first byte lower 1 bit +#define MODE_NOCOMPRESS 0 // original data +#define MODE_COMPRESS 1 // compatible old compress + +// compression algorithm save first byte higher 7 bit +#define ALGO_SZ_LOSSY 1 // SZ compress + +#define HEAD_MODE(x) x%2 +#define HEAD_ALGO(x) x/2 + extern int tsCompressINTImp(const char *const input, const int nelements, char *const output, const char type); extern int tsDecompressINTImp(const char *const input, const int nelements, char *const output, const char type); extern int tsCompressBoolImp(const char *const input, const int nelements, char *const output); @@ -46,6 +62,20 @@ extern int tsCompressDoubleImp(const char *const input, const int nelements, cha extern int tsDecompressDoubleImp(const char *const input, const int nelements, char *const output); extern int tsCompressFloatImp(const char *const input, const int nelements, char *const output); extern int tsDecompressFloatImp(const char *const input, const int nelements, char *const output); +// lossy +extern int tsCompressFloatLossyImp(const char * input, const int nelements, char *const output); +extern int tsDecompressFloatLossyImp(const char * input, int compressedSize, const int nelements, char *const output); +extern int tsCompressDoubleLossyImp(const char * input, const int nelements, char *const output); +extern int tsDecompressDoubleLossyImp(const char * input, int compressedSize, const int nelements, char *const output); + +#ifdef TD_TSZ +extern bool lossyFloat; +extern bool lossyDouble; +// init call +int tsCompressInit(); +// exit call +void tsCompressExit(); +#endif static FORCE_INLINE int tsCompressTinyint(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { @@ -189,56 +219,123 @@ static FORCE_INLINE int tsDecompressString(const char *const input, int compress static FORCE_INLINE int tsCompressFloat(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { - if (algorithm == ONE_STAGE_COMP) { - return tsCompressFloatImp(input, nelements, output); - } else if (algorithm == TWO_STAGE_COMP) { - int len = tsCompressFloatImp(input, nelements, buffer); - return tsCompressStringImp(buffer, len, output, outputSize); +#ifdef TD_TSZ + // lossy mode + if(lossyFloat) { + return tsCompressFloatLossyImp(input, nelements, output); + // lossless mode } else { - assert(0); - return -1; +#endif + if (algorithm == ONE_STAGE_COMP) { + return tsCompressFloatImp(input, nelements, output); + } else if (algorithm == TWO_STAGE_COMP) { + int len = tsCompressFloatImp(input, nelements, buffer); + return tsCompressStringImp(buffer, len, output, outputSize); + } else { + assert(0); + return -1; + } +#ifdef TD_TSZ } +#endif } static FORCE_INLINE int tsDecompressFloat(const char *const input, int compressedSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { - if (algorithm == ONE_STAGE_COMP) { - return tsDecompressFloatImp(input, nelements, output); - } else if (algorithm == TWO_STAGE_COMP) { - if (tsDecompressStringImp(input, compressedSize, buffer, bufferSize) < 0) return -1; - return tsDecompressFloatImp(buffer, nelements, output); +#ifdef TD_TSZ + if(HEAD_ALGO(input[0]) == ALGO_SZ_LOSSY){ + // decompress lossy + return tsDecompressFloatLossyImp(input, compressedSize, nelements, output); } else { - assert(0); - return -1; +#endif + // decompress lossless + if (algorithm == ONE_STAGE_COMP) { + return tsDecompressFloatImp(input, nelements, output); + } else if (algorithm == TWO_STAGE_COMP) { + if (tsDecompressStringImp(input, compressedSize, buffer, bufferSize) < 0) return -1; + return tsDecompressFloatImp(buffer, nelements, output); + } else { + assert(0); + return -1; + } +#ifdef TD_TSZ } +#endif } + static FORCE_INLINE int tsCompressDouble(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { - if (algorithm == ONE_STAGE_COMP) { - return tsCompressDoubleImp(input, nelements, output); - } else if (algorithm == TWO_STAGE_COMP) { - int len = tsCompressDoubleImp(input, nelements, buffer); - return tsCompressStringImp(buffer, len, output, outputSize); +#ifdef TD_TSZ + if(lossyDouble){ + // lossy mode + return tsCompressDoubleLossyImp(input, nelements, output); } else { - assert(0); - return -1; +#endif + // lossless mode + if (algorithm == ONE_STAGE_COMP) { + return tsCompressDoubleImp(input, nelements, output); + } else if (algorithm == TWO_STAGE_COMP) { + int len = tsCompressDoubleImp(input, nelements, buffer); + return tsCompressStringImp(buffer, len, output, outputSize); + } else { + assert(0); + return -1; + } +#ifdef TD_TSZ } +#endif } static FORCE_INLINE int tsDecompressDouble(const char *const input, int compressedSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { - if (algorithm == ONE_STAGE_COMP) { - return tsDecompressDoubleImp(input, nelements, output); - } else if (algorithm == TWO_STAGE_COMP) { - if (tsDecompressStringImp(input, compressedSize, buffer, bufferSize) < 0) return -1; - return tsDecompressDoubleImp(buffer, nelements, output); + #ifdef TD_TSZ + if(HEAD_ALGO(input[0]) == ALGO_SZ_LOSSY){ + // decompress lossy + return tsDecompressDoubleLossyImp(input, compressedSize, nelements, output); } else { - assert(0); - return -1; + #endif + // decompress lossless + if (algorithm == ONE_STAGE_COMP) { + return tsDecompressDoubleImp(input, nelements, output); + } else if (algorithm == TWO_STAGE_COMP) { + if (tsDecompressStringImp(input, compressedSize, buffer, bufferSize) < 0) return -1; + return tsDecompressDoubleImp(buffer, nelements, output); + } else { + assert(0); + return -1; + } +#ifdef TD_TSZ } +#endif } +#ifdef TD_TSZ +// +// lossy float double +// +static FORCE_INLINE int tsCompressFloatLossy(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, + char algorithm, char *const buffer, int bufferSize) { + return tsCompressFloatLossyImp(input, nelements, output); +} + +static FORCE_INLINE int tsDecompressFloatLossy(const char *const input, int compressedSize, const int nelements, char *const output, + int outputSize, char algorithm, char *const buffer, int bufferSize){ + return tsDecompressFloatLossyImp(input, compressedSize, nelements, output); +} + +static FORCE_INLINE int tsCompressDoubleLossy(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, + char algorithm, char *const buffer, int bufferSize){ + return tsCompressDoubleLossyImp(input, nelements, output); +} + +static FORCE_INLINE int tsDecompressDoubleLossy(const char *const input, int compressedSize, const int nelements, char *const output, + int outputSize, char algorithm, char *const buffer, int bufferSize){ + return tsDecompressDoubleLossyImp(input, compressedSize, nelements, output); +} + +#endif + static FORCE_INLINE int tsCompressTimestamp(const char *const input, int inputSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize) { if (algorithm == ONE_STAGE_COMP) { diff --git a/src/util/src/tarray.c b/src/util/src/tarray.c index fe529edaac..d0d126c1e4 100644 --- a/src/util/src/tarray.c +++ b/src/util/src/tarray.c @@ -83,6 +83,87 @@ void* taosArrayAddBatch(SArray* pArray, const void* pData, int nEles) { return dst; } +void taosArrayRemoveBatch(SArray *pArray, const int32_t* pData, int32_t numOfElems) { + assert(pArray != NULL && pData != NULL); + if (numOfElems <= 0) { + return; + } + + size_t size = taosArrayGetSize(pArray); + if (numOfElems >= size) { + taosArrayClear(pArray); + return; + } + + int32_t i = pData[0] + 1, j = 0; + while(i < size) { + if (j == numOfElems - 1) { + break; + } + + char* p = TARRAY_GET_ELEM(pArray, i); + if (i > pData[j] && i < pData[j + 1]) { + char* dst = TARRAY_GET_ELEM(pArray, i - (j + 1)); + memmove(dst, p, pArray->elemSize); + } else if (i == pData[j + 1]) { + j += 1; + } + + i += 1; + } + + assert(i == pData[numOfElems - 1] + 1); + + int32_t dstIndex = pData[numOfElems - 1] - numOfElems + 1; + int32_t srcIndex = pData[numOfElems - 1] + 1; + + char* dst = TARRAY_GET_ELEM(pArray, dstIndex); + char* src = TARRAY_GET_ELEM(pArray, srcIndex); + memmove(dst, src, pArray->elemSize * (pArray->size - numOfElems)); + + pArray->size -= numOfElems; +} + +void taosArrayRemoveDuplicate(SArray *pArray, __compar_fn_t comparFn, void (*fp)(void*)) { + assert(pArray); + + size_t size = pArray->size; + if (size <= 1) { + return; + } + + int32_t pos = 0; + for(int32_t i = 1; i < size; ++i) { + char* p1 = taosArrayGet(pArray, pos); + char* p2 = taosArrayGet(pArray, i); + + if (comparFn(p1, p2) == 0) { + // do nothing + } else { + if (pos + 1 != i) { + void* p = taosArrayGet(pArray, pos + 1); + if (fp != NULL) { + fp(p); + } + + taosArraySet(pArray, pos + 1, p2); + pos += 1; + } else { + pos += 1; + } + } + } + + if (fp != NULL) { + for(int32_t i = pos + 1; i < pArray->size; ++i) { + void* p = taosArrayGet(pArray, i); + fp(p); + } + } + + pArray->size = pos + 1; +} + void* taosArrayAddAll(SArray* pArray, const SArray* pInput) { return taosArrayAddBatch(pArray, pInput->pData, (int32_t) taosArrayGetSize(pInput)); } diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index 569f9b01bd..c6ee79e101 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -656,6 +656,8 @@ void* taosCacheTimedRefresh(void *handle) { return NULL; } + setThreadName("cacheTimedRefre"); + const int32_t SLEEP_DURATION = 500; //500 ms int64_t totalTick = pCacheObj->refreshTime / SLEEP_DURATION; diff --git a/src/util/src/tcompression.c b/src/util/src/tcompression.c index 1de6e76f71..a11f6a2f3d 100644 --- a/src/util/src/tcompression.c +++ b/src/util/src/tcompression.c @@ -49,9 +49,14 @@ #include "os.h" #include "lz4.h" +#ifdef TD_TSZ + #include "td_sz.h" +#endif #include "taosdef.h" #include "tscompression.h" #include "tulog.h" +#include "tglobal.h" + static const int TEST_NUMBER = 1; #define is_bigendian() ((*(char *)&TEST_NUMBER) == 0) @@ -61,6 +66,39 @@ static const int TEST_NUMBER = 1; #define ZIGZAG_ENCODE(T, v) ((u##T)((v) >> (sizeof(T) * 8 - 1))) ^ (((u##T)(v)) << 1) // zigzag encode #define ZIGZAG_DECODE(T, v) ((v) >> 1) ^ -((T)((v)&1)) // zigzag decode +#ifdef TD_TSZ +bool lossyFloat = false; +bool lossyDouble = false; + +// init call +int tsCompressInit(){ + // config + if(lossyColumns[0] == 0){ + lossyFloat = false; + lossyDouble = false; + return 0; + } + + lossyFloat = strstr(lossyColumns, "float") != NULL; + lossyDouble = strstr(lossyColumns, "double") != NULL; + + if(lossyFloat == false && lossyDouble == false) + return 0; + + tdszInit(fPrecision, dPrecision, maxIntervals, intervals, Compressor); + if(lossyFloat) + uInfo("lossy compression float is opened. "); + if(lossyDouble) + uInfo("lossy compression double is opened. "); + return 1; +} +// exit call +void tsCompressExit(){ + tdszExit(); +} + +#endif + /* * Compress Integer (Simple8B). */ @@ -410,6 +448,7 @@ int tsCompressStringImp(const char *const input, int inputSize, char *const outp int tsDecompressStringImp(const char *const input, int compressedSize, char *const output, int outputSize) { // compressedSize is the size of data after compression. + if (input[0] == 1) { /* It is compressed by LZ4 algorithm */ const int decompressed_size = LZ4_decompress_safe(input + 1, output, compressedSize - 1, outputSize); @@ -886,3 +925,72 @@ int tsDecompressFloatImp(const char *const input, const int nelements, char *con return nelements * FLOAT_BYTES; } + +#ifdef TD_TSZ +// +// ---------- float double lossy ----------- +// +int tsCompressFloatLossyImp(const char * input, const int nelements, char *const output){ + // compress with sz + int compressedSize = tdszCompress(SZ_FLOAT, input, nelements, output + 1); + unsigned char algo = ALGO_SZ_LOSSY << 1; + if (compressedSize == 0 || compressedSize >= nelements*sizeof(float)){ + // compressed error or large than original + output[0] = MODE_NOCOMPRESS | algo; + memcpy(output + 1, input, nelements * sizeof(float)); + compressedSize = 1 + nelements * sizeof(float); + } else { + // compressed successfully + output[0] = MODE_COMPRESS | algo; + compressedSize += 1; + } + + return compressedSize; +} + +int tsDecompressFloatLossyImp(const char * input, int compressedSize, const int nelements, char *const output){ + int decompressedSize = 0; + if( HEAD_MODE(input[0]) == MODE_NOCOMPRESS){ + // orginal so memcpy directly + decompressedSize = nelements * sizeof(float); + memcpy(output, input + 1, decompressedSize); + + return decompressedSize; + } + + // decompressed with sz + return tdszDecompress(SZ_FLOAT, input + 1, compressedSize - 1, nelements, output); +} + +int tsCompressDoubleLossyImp(const char * input, const int nelements, char *const output){ + // compress with sz + int compressedSize = tdszCompress(SZ_DOUBLE, input, nelements, output + 1); + unsigned char algo = ALGO_SZ_LOSSY << 1; + if (compressedSize == 0 || compressedSize >= nelements*sizeof(double)) { + // compressed error or large than original + output[0] = MODE_NOCOMPRESS | algo; + memcpy(output + 1, input, nelements * sizeof(double)); + compressedSize = 1 + nelements * sizeof(double); + } else { + // compressed successfully + output[0] = MODE_COMPRESS | algo; + compressedSize += 1; + } + + return compressedSize; +} + +int tsDecompressDoubleLossyImp(const char * input, int compressedSize, const int nelements, char *const output){ + int decompressedSize = 0; + if( HEAD_MODE(input[0]) == MODE_NOCOMPRESS){ + // orginal so memcpy directly + decompressedSize = nelements * sizeof(double); + memcpy(output, input + 1, decompressedSize); + + return decompressedSize; + } + + // decompressed with sz + return tdszDecompress(SZ_DOUBLE, input + 1, compressedSize - 1, nelements, output); +} +#endif \ No newline at end of file diff --git a/src/util/src/tconfig.c b/src/util/src/tconfig.c index 80071986d6..ea83debfdc 100644 --- a/src/util/src/tconfig.c +++ b/src/util/src/tconfig.c @@ -61,6 +61,24 @@ static void taosReadFloatConfig(SGlobalCfg *cfg, char *input_value) { } } +static void taosReadDoubleConfig(SGlobalCfg *cfg, char *input_value) { + double value = atof(input_value); + double *option = (double *)cfg->ptr; + if (value < cfg->minValue || value > cfg->maxValue) { + uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%f", + cfg->option, input_value, cfg->minValue, cfg->maxValue, *option); + } else { + if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) { + *option = value; + cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE; + } else { + uWarn("config option:%s, input value:%s, is configured by %s, use %f", cfg->option, input_value, + tsCfgStatusStr[cfg->cfgStatus], *option); + } + } +} + + static void taosReadInt32Config(SGlobalCfg *cfg, char *input_value) { int32_t value = atoi(input_value); int32_t *option = (int32_t *)cfg->ptr; @@ -262,6 +280,9 @@ static void taosReadConfigOption(const char *option, char *value, char *value2, case TAOS_CFG_VTYPE_FLOAT: taosReadFloatConfig(cfg, value); break; + case TAOS_CFG_VTYPE_DOUBLE: + taosReadDoubleConfig(cfg, value); + break; case TAOS_CFG_VTYPE_STRING: taosReadStringConfig(cfg, value); break; diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c index 45ff14ffa4..88f57e8ac2 100644 --- a/src/util/src/tlog.c +++ b/src/util/src/tlog.c @@ -178,6 +178,8 @@ static void *taosThreadToOpenNewFile(void *param) { char keepName[LOG_FILE_NAME_LEN + 20]; sprintf(keepName, "%s.%d", tsLogObj.logName, tsLogObj.flag); + setThreadName("openNewFile"); + tsLogObj.flag ^= 1; tsLogObj.lines = 0; char name[LOG_FILE_NAME_LEN + 20]; @@ -687,6 +689,8 @@ static void taosWriteLog(SLogBuff *tLogBuff) { static void *taosAsyncOutputLog(void *param) { SLogBuff *tLogBuff = (SLogBuff *)param; + + setThreadName("asyncOutputLog"); while (1) { //tsem_wait(&(tLogBuff->buffNotEmpty)); diff --git a/src/util/src/tnettest.c b/src/util/src/tnettest.c index 318a2d4860..0bab7b7e66 100644 --- a/src/util/src/tnettest.c +++ b/src/util/src/tnettest.c @@ -50,7 +50,9 @@ static void *taosNetBindUdpPort(void *sarg) { struct sockaddr_in server_addr; struct sockaddr_in clientAddr; - if ((serverSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { + setThreadName("netBindUdpPort"); + + if ((serverSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { uError("failed to create UDP socket since %s", strerror(errno)); return NULL; } @@ -106,13 +108,15 @@ static void *taosNetBindTcpPort(void *sarg) { struct sockaddr_in server_addr; struct sockaddr_in clientAddr; - STestInfo *pinfo = sarg; + STestInfo *pinfo = sarg; int32_t port = pinfo->port; SOCKET serverSocket; int32_t addr_len = sizeof(clientAddr); SOCKET client; char buffer[BUFFER_SIZE]; + setThreadName("netBindTcpPort"); + if ((serverSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { uError("failed to create TCP socket since %s", strerror(errno)); return NULL; diff --git a/src/util/src/tnote.c b/src/util/src/tnote.c index c6d49dfb3d..b691abc5b9 100644 --- a/src/util/src/tnote.c +++ b/src/util/src/tnote.c @@ -84,6 +84,8 @@ static void *taosThreadToOpenNewNote(void *param) { char name[NOTE_FILE_NAME_LEN * 2]; SNoteObj *pNote = (SNoteObj *)param; + setThreadName("openNewNote"); + pNote->flag ^= 1; pNote->lines = 0; sprintf(name, "%s.%d", pNote->name, pNote->flag); diff --git a/src/util/src/tsched.c b/src/util/src/tsched.c index 16142470c9..3d3dfd9899 100644 --- a/src/util/src/tsched.c +++ b/src/util/src/tsched.c @@ -122,6 +122,8 @@ void *taosProcessSchedQueue(void *scheduler) { SSchedQueue *pSched = (SSchedQueue *)scheduler; int ret = 0; + setThreadName("schedQ"); + while (1) { if ((ret = tsem_wait(&pSched->fullSem)) != 0) { uFatal("wait %s fullSem failed(%s)", pSched->label, strerror(errno)); @@ -234,4 +236,4 @@ void taosDumpSchedulerStatus(void *qhandle, void *tmrId) { } taosTmrReset(taosDumpSchedulerStatus, DUMP_SCHEDULER_TIME_WINDOW, pSched, pSched->pTmrCtrl, &pSched->pTimer); -} \ No newline at end of file +} diff --git a/src/util/src/tskiplist.c b/src/util/src/tskiplist.c index a88fee51d7..082b454bb5 100644 --- a/src/util/src/tskiplist.c +++ b/src/util/src/tskiplist.c @@ -681,143 +681,3 @@ static SSkipListNode *tSkipListPutImpl(SSkipList *pSkipList, void *pData, SSkipL return pNode; } - -// static int32_t tSkipListEndParQuery(SSkipList *pSkipList, SSkipListNode *pStartNode, SSkipListKey *pEndKey, -// int32_t cond, SSkipListNode ***pRes) { -// pthread_rwlock_rdlock(&pSkipList->lock); -// SSkipListNode *p = pStartNode; -// int32_t numOfRes = 0; -// -// __compar_fn_t filterComparFn = getComparFunc(pSkipList, pEndKey->nType); -// while (p != NULL) { -// int32_t ret = filterComparFn(&p->key, pEndKey); -// if (ret > 0) { -// break; -// } -// -// if (ret < 0) { -// numOfRes++; -// p = p->pForward[0]; -// } else if (ret == 0) { -// if (cond == TSDB_RELATION_LESS_EQUAL) { -// numOfRes++; -// p = p->pForward[0]; -// } else { -// break; -// } -// } -// } -// -// (*pRes) = (SSkipListNode **)malloc(POINTER_BYTES * numOfRes); -// for (int32_t i = 0; i < numOfRes; ++i) { -// (*pRes)[i] = pStartNode; -// pStartNode = pStartNode->pForward[0]; -// } -// pthread_rwlock_unlock(&pSkipList->lock); -// -// return numOfRes; -//} -// -///* -// * maybe return the copy of SSkipListNode would be better -// */ -// int32_t tSkipListGets(SSkipList *pSkipList, SSkipListKey *pKey, SSkipListNode ***pRes) { -// (*pRes) = NULL; -// -// SSkipListNode *pNode = tSkipListGet(pSkipList, pKey); -// if (pNode == NULL) { -// return 0; -// } -// -// __compar_fn_t filterComparFn = getComparFunc(pSkipList, pKey->nType); -// -// // backward check if previous nodes are with the same value. -// SSkipListNode *pPrev = pNode->pBackward[0]; -// while ((pPrev != &pSkipList->pHead) && filterComparFn(&pPrev->key, pKey) == 0) { -// pPrev = pPrev->pBackward[0]; -// } -// -// return tSkipListEndParQuery(pSkipList, pPrev->pForward[0], &pNode->key, TSDB_RELATION_LESS_EQUAL, pRes); -//} -// -// static SSkipListNode *tSkipListParQuery(SSkipList *pSkipList, SSkipListKey *pKey, int32_t cond) { -// int32_t sLevel = pSkipList->level - 1; -// int32_t ret = -1; -// -// SSkipListNode *x = &pSkipList->pHead; -// __compar_fn_t filterComparFn = getComparFunc(pSkipList, pKey->nType); -// -// pthread_rwlock_rdlock(&pSkipList->lock); -// -// if (cond == TSDB_RELATION_GREATER_EQUAL || cond == TSDB_RELATION_GREATER) { -// for (int32_t i = sLevel; i >= 0; --i) { -// while (x->pForward[i] != NULL && (ret = filterComparFn(&x->pForward[i]->key, pKey)) < 0) { -// x = x->pForward[i]; -// } -// } -// -// // backward check if previous nodes are with the same value. -// if (cond == TSDB_RELATION_GREATER_EQUAL && ret == 0) { -// SSkipListNode *pNode = x->pForward[0]; -// while ((pNode->pBackward[0] != &pSkipList->pHead) && (filterComparFn(&pNode->pBackward[0]->key, pKey) == 0)) { -// pNode = pNode->pBackward[0]; -// } -// pthread_rwlock_unlock(&pSkipList->lock); -// return pNode; -// } -// -// if (ret > 0 || cond == TSDB_RELATION_GREATER_EQUAL) { -// pthread_rwlock_unlock(&pSkipList->lock); -// return x->pForward[0]; -// } else { // cond == TSDB_RELATION_GREATER && ret == 0 -// SSkipListNode *pn = x->pForward[0]; -// while (pn != NULL && filterComparFn(&pn->key, pKey) == 0) { -// pn = pn->pForward[0]; -// } -// pthread_rwlock_unlock(&pSkipList->lock); -// return pn; -// } -// } -// -// pthread_rwlock_unlock(&pSkipList->lock); -// return NULL; -//} -// -// -// static bool removeSupport(SSkipList *pSkipList, SSkipListNode **forward, SSkipListKey *pKey) { -// __compar_fn_t filterComparFn = getComparFunc(pSkipList, pKey->nType); -// -// if (filterComparFn(&forward[0]->pForward[0]->key, pKey) == 0) { -// SSkipListNode *p = forward[0]->pForward[0]; -// doRemove(pSkipList, p, forward); -// } else { // failed to find the node of specified value,abort -// return false; -// } -// -// // compress the minimum level of skip list -// while (pSkipList->level > 0 && SL_NODE_GET_FORWARD_POINTER(pSkipList->pHead, pSkipList->level - 1) == NULL) { -// pSkipList->level -= 1; -// } -// -// return true; -//} -// -// bool tSkipListRemove(SSkipList *pSkipList, SSkipListKey *pKey) { -// SSkipListNode *forward[MAX_SKIP_LIST_LEVEL] = {0}; -// __compar_fn_t filterComparFn = getComparFunc(pSkipList, pKey->nType); -// -// pthread_rwlock_rdlock(&pSkipList->lock); -// -// SSkipListNode *x = &pSkipList->pHead; -// for (int32_t i = pSkipList->level - 1; i >= 0; --i) { -// while (x->pForward[i] != NULL && (filterComparFn(&x->pForward[i]->key, pKey) < 0)) { -// x = x->pForward[i]; -// } -// forward[i] = x; -// } -// -// bool ret = removeSupport(pSkipList, forward, pKey); -// pthread_rwlock_unlock(&pSkipList->lock); -// -// return ret; -//} diff --git a/src/util/tests/arrayTest.cpp b/src/util/tests/arrayTest.cpp new file mode 100644 index 0000000000..94b08ca6d7 --- /dev/null +++ b/src/util/tests/arrayTest.cpp @@ -0,0 +1,50 @@ +#include +#include +#include +#include + +#include "tarray.h" + +namespace { + +static void remove_batch_test() { + SArray *pa = (SArray*) taosArrayInit(4, sizeof(int32_t)); + + for(int32_t i = 0; i < 20; ++i) { + int32_t a = i; + taosArrayPush(pa, &a); + } + + SArray* delList = (SArray*)taosArrayInit(4, sizeof(int32_t)); + taosArrayRemoveBatch(pa, (const int32_t*) TARRAY_GET_START(delList), taosArrayGetSize(delList)); + EXPECT_EQ(taosArrayGetSize(pa), 20); + + int32_t a = 5; + taosArrayPush(delList, &a); + + taosArrayRemoveBatch(pa, (const int32_t*) TARRAY_GET_START(delList), taosArrayGetSize(delList)); + EXPECT_EQ(taosArrayGetSize(pa), 19); + EXPECT_EQ(*(int*)taosArrayGet(pa, 5), 6); + + taosArrayInsert(pa, 5, &a); + EXPECT_EQ(taosArrayGetSize(pa), 20); + EXPECT_EQ(*(int*)taosArrayGet(pa, 5), 5); + + taosArrayClear(delList); + + a = 6; + taosArrayPush(delList, &a); + + a = 9; + taosArrayPush(delList, &a); + + a = 14; + taosArrayPush(delList, &a); + taosArrayRemoveBatch(pa, (const int32_t*) TARRAY_GET_START(delList), taosArrayGetSize(delList)); + EXPECT_EQ(taosArrayGetSize(pa), 17); +} +} // namespace + +TEST(arrayTest, array_list_test) { + remove_batch_test(); +} diff --git a/src/util/tests/cacheTest.cpp b/src/util/tests/cacheTest.cpp index 0a4791f6a9..970f1c23a9 100644 --- a/src/util/tests/cacheTest.cpp +++ b/src/util/tests/cacheTest.cpp @@ -5,10 +5,6 @@ #include "taos.h" #include "tcache.h" -namespace { -int32_t tsMaxMgmtConnections = 10000; -int32_t tsMaxMeterConnections = 200; -} // test cache TEST(testCase, client_cache_test) { const int32_t REFRESH_TIME_IN_SEC = 2; @@ -43,7 +39,7 @@ TEST(testCase, client_cache_test) { sleep(3); char* d = (char*) taosCacheAcquireByKey(tscMetaCache, key3, strlen(key3)); -// assert(d == NULL); + assert(d == NULL); char key5[] = "test5"; char data5[] = "data5kkkkk"; @@ -102,7 +98,7 @@ TEST(testCase, cache_resize_test) { char key[256] = {0}; char data[1024] = "abcdefghijk"; - int32_t len = strlen(data); +// int32_t len = strlen(data); uint64_t startTime = taosGetTimestampUs(); int32_t num = 10000; diff --git a/src/util/tests/skiplistTest.cpp b/src/util/tests/skiplistTest.cpp index 2203ae8e4f..dfbe0f6716 100644 --- a/src/util/tests/skiplistTest.cpp +++ b/src/util/tests/skiplistTest.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "os.h" @@ -8,12 +9,14 @@ #include "tskiplist.h" #include "tutil.h" +#if 0 namespace { char* getkey(const void* data) { return (char*)(data); } void doubleSkipListTest() { - SSkipList* pSkipList = tSkipListCreate(10, TSDB_DATA_TYPE_DOUBLE, sizeof(double), 0, false, true, getkey); + SSkipList* pSkipList = tSkipListCreate(10, TSDB_DATA_TYPE_DOUBLE, sizeof(double), + getKeyComparFunc(TSDB_DATA_TYPE_DOUBLE), false, getkey); double doubleVal[1000] = {0}; int32_t size = 20000; @@ -25,18 +28,15 @@ void doubleSkipListTest() { doubleVal[i] = i * 0.997; } - int32_t level = 0; - int32_t size = 0; +// int32_t level = 0; + size = 0; - tSkipListNewNodeInfo(pSkipList, &level, &size); - auto d = (SSkipListNode*)calloc(1, size + sizeof(double) * 2); - d->level = level; + // tSkipListNewNodeInfo(pSkipList, &level, &size); + // auto d = (SSkipListNode*)calloc(1, size + sizeof(double) * 2); + // d->level = level; - double* key = (double*)SL_GET_NODE_KEY(pSkipList, d); - key[0] = i * 0.997; - key[1] = i * 0.997; - - tSkipListPut(pSkipList, d); + double key = 0.997; + tSkipListPut(pSkipList, &key); } printf("the first level of skip list is:\n"); @@ -70,7 +70,8 @@ void doubleSkipListTest() { } void randKeyTest() { - SSkipList* pSkipList = tSkipListCreate(10, TSDB_DATA_TYPE_INT, sizeof(int32_t), 0, false, true, getkey); + SSkipList* pSkipList = tSkipListCreate(10, TSDB_DATA_TYPE_INT, sizeof(int32_t), getKeyComparFunc(TSDB_DATA_TYPE_INT), + false, getkey); int32_t size = 200000; srand(time(NULL)); @@ -375,3 +376,5 @@ TEST(testCase, skiplist_test) { free(pKeys);*/ } + +#endif \ No newline at end of file diff --git a/src/util/tests/trefTest.c b/src/util/tests/trefTest.c index 454860410b..fe3dcab201 100644 --- a/src/util/tests/trefTest.c +++ b/src/util/tests/trefTest.c @@ -14,18 +14,18 @@ typedef struct { int refNum; int steps; int rsetId; - int64_t rid; + int64_t*rid; void **p; } SRefSpace; void iterateRefs(int rsetId) { int count = 0; - void *p = taosIterateRef(rsetId, NULL); + void *p = taosIterateRef(rsetId, 0); while (p) { // process P count++; - p = taosIterateRef(rsetId, p); + p = taosIterateRef(rsetId, (int64_t) p); } printf(" %d ", count); @@ -34,7 +34,8 @@ void iterateRefs(int rsetId) { void *addRef(void *param) { SRefSpace *pSpace = (SRefSpace *)param; int id; - int64_t rid; + + setThreadName("addRef"); for (int i=0; i < pSpace->steps; ++i) { printf("a"); @@ -51,8 +52,9 @@ void *addRef(void *param) { void *removeRef(void *param) { SRefSpace *pSpace = (SRefSpace *)param; - int id; - int64_t rid; + int id, code; + + setThreadName("removeRef"); for (int i=0; i < pSpace->steps; ++i) { printf("d"); @@ -71,16 +73,17 @@ void *removeRef(void *param) { void *acquireRelease(void *param) { SRefSpace *pSpace = (SRefSpace *)param; int id; - int64_t rid; + + setThreadName("acquireRelease"); for (int i=0; i < pSpace->steps; ++i) { printf("a"); id = random() % pSpace->refNum; - void *p = taosAcquireRef(pSpace->rsetId, pSpace->p[id]); + void *p = taosAcquireRef(pSpace->rsetId, (int64_t) pSpace->p[id]); if (p) { usleep(id % 5 + 1); - taosReleaseRef(pSpace->rsetId, pSpace->p[id]); + taosReleaseRef(pSpace->rsetId, (int64_t) pSpace->p[id]); } } @@ -94,6 +97,8 @@ void myfree(void *p) { void *openRefSpace(void *param) { SRefSpace *pSpace = (SRefSpace *)param; + setThreadName("openRefSpace"); + printf("c"); pSpace->rsetId = taosOpenRef(50, myfree); @@ -103,6 +108,7 @@ void *openRefSpace(void *param) { } pSpace->p = (void **) calloc(sizeof(void *), pSpace->refNum); + pSpace->rid = calloc(pSpace->refNum, sizeof(int64_t)); pthread_attr_t thattr; pthread_attr_init(&thattr); diff --git a/src/vnode/src/vnodeBackup.c b/src/vnode/src/vnodeBackup.c index a0a975be2b..801af42e0e 100644 --- a/src/vnode/src/vnodeBackup.c +++ b/src/vnode/src/vnodeBackup.c @@ -61,6 +61,8 @@ static void vnodeProcessBackupMsg(SVBackupMsg *pMsg) { } static void *vnodeBackupFunc(void *param) { + setThreadName("vnodeBackup"); + while (1) { SVBackupMsg *pMsg = NULL; if (taosReadQitemFromQset(tsVBackupQset, NULL, (void **)&pMsg, NULL) == 0) { diff --git a/src/vnode/src/vnodeWorker.c b/src/vnode/src/vnodeWorker.c index 6fb79d10fe..e94c99cbea 100644 --- a/src/vnode/src/vnodeWorker.c +++ b/src/vnode/src/vnodeWorker.c @@ -188,6 +188,8 @@ static void vnodeProcessMWorkerMsg(SVMWorkerMsg *pMsg) { } static void *vnodeMWorkerFunc(void *param) { + setThreadName("vnodeMWorker"); + while (1) { SVMWorkerMsg *pMsg = NULL; if (taosReadQitemFromQset(tsVMWorkerQset, NULL, (void **)&pMsg, NULL) == 0) { diff --git a/src/wal/src/walMgmt.c b/src/wal/src/walMgmt.c index 9bd5cdf175..45f65b2c2f 100644 --- a/src/wal/src/walMgmt.c +++ b/src/wal/src/walMgmt.c @@ -192,6 +192,7 @@ static void walFsyncAll() { static void *walThreadFunc(void *param) { int stop = 0; + setThreadName("walThrd"); while (1) { walUpdateSeq(); walFsyncAll(); diff --git a/tests/perftest-scripts/perftest-query.sh b/tests/perftest-scripts/perftest-query.sh index bf62f401bf..bcc944dadb 100755 --- a/tests/perftest-scripts/perftest-query.sh +++ b/tests/perftest-scripts/perftest-query.sh @@ -1,5 +1,21 @@ #!/bin/bash +branch= +if [ x$1 != x ];then + branch=$1 + echo "Testing branch: $branch" +else + echo "Please enter branch name as a parameter" + exit 1 +fi +jemalloc= +if [ x$2 != x ];then + jemalloc=jemalloc + echo "Building TDengine using jemalloc" +else + echo "Building TDengine using glibc" +fi + today=`date +"%Y%m%d"` WORK_DIR=/home/ubuntu/pxiao PERFORMANCE_TEST_REPORT=$WORK_DIR/TDengine/tests/performance-test-report-$today.log @@ -40,8 +56,8 @@ function buildTDengine { git remote update > /dev/null git reset --hard HEAD - git checkout master - REMOTE_COMMIT=`git rev-parse --short remotes/origin/master` + git checkout $branch + REMOTE_COMMIT=`git rev-parse --short remotes/origin/$branch` LOCAL_COMMIT=`git rev-parse --short @` echo " LOCAL: $LOCAL_COMMIT" @@ -53,9 +69,20 @@ function buildTDengine { git pull > /dev/null 2>&1 LOCAL_COMMIT=`git rev-parse --short @` + if [ $jemalloc = "jemalloc" ];then + echo "git submodule update --init --recursive" + git submodule update --init --recursive + fi + cd debug rm -rf * - cmake .. > /dev/null + + if [ $jemalloc = "jemalloc" ];then + echo "cmake .. -DJEMALLOC_ENABLED=true > /dev/null" + cmake .. -DJEMALLOC_ENABLED=true > /dev/null + else + cmake .. > /dev/null + fi make && make install > /dev/null fi } @@ -95,7 +122,8 @@ function sendReport { sed -i 's/\x1b\[[0-9;]*m//g' $PERFORMANCE_TEST_REPORT BODY_CONTENT=`cat $PERFORMANCE_TEST_REPORT` - echo -e "From: \nto: ${receiver}\nsubject: Query Performace Report ${today}, commit ID: ${LOCAL_COMMIT}\n\n${today}:\n${BODY_CONTENT}" | \ + + echo -e "From: \nto: ${receiver}\nsubject: Query Performace Report ${branch} ${jemalloc} ${today}, commit ID: ${LOCAL_COMMIT}\n\n${today}:\n${BODY_CONTENT}" | \ (cat - && uuencode $PERFORMANCE_TEST_REPORT performance-test-report-$today.log) | \ /usr/sbin/ssmtp "${receiver}" && echo "Report Sent!" } diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 2814f69817..555abf1863 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -242,7 +242,7 @@ python3 ./test.py -f query/queryStateWindow.py python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py python3 ./test.py -f query/nestquery_last_row.py python3 ./test.py -f query/queryCnameDisplay.py - +python3 test.py -f query/nestedQuery/queryWithSpread.py #stream python3 ./test.py -f stream/metric_1.py @@ -362,4 +362,6 @@ python3 test.py -f alter/alter_keep.py python3 test.py -f alter/alter_cacheLastRow.py python3 ./test.py -f query/querySession.py python3 test.py -f alter/alter_create_exception.py + +python3 ./test.py -f insert/flushwhiledrop.py #======================p4-end=============== diff --git a/tests/pytest/insert/flushwhiledrop.py b/tests/pytest/insert/flushwhiledrop.py new file mode 100644 index 0000000000..3784657117 --- /dev/null +++ b/tests/pytest/insert/flushwhiledrop.py @@ -0,0 +1,67 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import threading +from util.log import * +from util.cases import * +from util.sql import * +from time import sleep + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.numberOfRecords = 15000 + self.ts = 1601481600000 + + def run(self): + tdSql.execute('create database test cache 1 blocks 3') + tdSql.execute('use test') + tdSql.execute('create table tb(ts timestamp, c1 timestamp, c2 int, c3 bigint, c4 float, c5 double, c6 binary(8), c7 smallint, c8 tinyint, c9 bool, c10 nchar(8))') + threads = [] + t1 = threading.Thread(target=self.insertAndFlush, args=()) + threads.append(t1) + t2 = threading.Thread(target=self.drop, args=()) + threads.append(t2) + for t in threads: + t.setDaemon(True) + t.start() + for t in threads: + t.join() + + def insertAndFlush(self): + finish = 0 + currts = self.ts + + while(finish < self.numberOfRecords): + sql = "insert into tb values" + for i in range(finish, self.numberOfRecords): + sql += "(%d, 1019774612, 29931, 1442173978, 165092.468750, 1128.643179, 'MOCq1pTu', 18405, 82, 0, 'g0A6S0Fu')" % (currts + i) + finish = i + 1 + if (1048576 - len(sql)) < 16384: + break + tdSql.execute(sql) + + def drop(self): + sleep(30) + tdSql.execute('drop database test') + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/pytest/query/nestedQuery/queryWithSpread.py b/tests/pytest/query/nestedQuery/queryWithSpread.py new file mode 100644 index 0000000000..4e09b1b826 --- /dev/null +++ b/tests/pytest/query/nestedQuery/queryWithSpread.py @@ -0,0 +1,46 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdSql.execute('create table stb (ts timestamp, speed int) tags(t1 int);') + + for i in range(10): + tdSql.execute(f'create table tb_{i} using stb tags({i});') + tdSql.execute(f'insert into tb_{i} values(now, 0)') + tdSql.execute(f'insert into tb_{i} values(now+10s, {i})') + + tdSql.query('select max(col3) from (select spread(speed) as col3 from stb group by tbname);') + tdSql.checkData(0,0,'9.0') + tdSql.error('select max(col3) from (select spread(col3) as col3 from stb group by tbname);') + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoPerformance.py b/tests/pytest/tools/taosdemoPerformance.py index fb74588984..c8293ee31f 100644 --- a/tests/pytest/tools/taosdemoPerformance.py +++ b/tests/pytest/tools/taosdemoPerformance.py @@ -122,7 +122,6 @@ class taosdemoPerformace: return buildPath def insertData(self): - tdSql.prepare() buildPath = self.getBuildPath() if (buildPath == ""): diff --git a/tests/robust/makefile b/tests/robust/makefile new file mode 100644 index 0000000000..c98469498f --- /dev/null +++ b/tests/robust/makefile @@ -0,0 +1,8 @@ +NAME=robust +CFLAGS = -O3 -g -Wall -Wno-deprecated -fPIC -Wno-unused-result -Wconversion -Wno-char-subscripts -D_REENTRANT -Wno-format -DLINUX -msse4.2 -Wno-unused-function -D_M_X64 -std=gnu99 + +all: + gcc $(CFLAGS) ./$(NAME).c -o $(NAME) -ltaos -lpthread + +clean: + rm $(NAME) \ No newline at end of file diff --git a/tests/robust/robust.c b/tests/robust/robust.c new file mode 100644 index 0000000000..3488ca1b9b --- /dev/null +++ b/tests/robust/robust.c @@ -0,0 +1,260 @@ +#include +#include +#include +#include +#include +#include +#include + +typedef struct { + char querySQL[256]; + int client; + int stable; + int table; + unsigned interval; + int insert; + int create; + int query; +} ProArgs; + +typedef struct { + pthread_t pid; + int threadId; + void* taos; +} ThreadObj; + +static ProArgs arguments; +void parseArg(int argc, char *argv[]); +void create(); +void createImp(void *param); +void start(); +void insertImp(void *param); +void queryImp(void *param); + +int64_t getTimeStampMs() { + struct timeval systemTime; + gettimeofday(&systemTime, NULL); + return (int64_t)systemTime.tv_sec * 1000L + (int64_t)systemTime.tv_usec / 1000; +} + +void parseArg(int argc, char *argv[]) { + arguments.stable = 100000; + arguments.table = 50; + arguments.client = 16; + arguments.interval = 1; + sprintf(arguments.querySQL, "select count(*) from"); + for (int i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-stable") == 0) { + if (i < argc - 1) { + arguments.stable = atoi(argv[++i]); + } else { + fprintf(stderr, "'-stable' requires a parameter, default:%d\n", arguments.stable); + } + } else if (strcmp(argv[i], "-table") == 0) { + if (i < argc - 1) { + arguments.table = atoi(argv[++i]); + } else { + fprintf(stderr, "'-table' requires a parameter, default:%d\n", arguments.table); + } + } else if (strcmp(argv[i], "-client") == 0) { + if (i < argc - 1) { + arguments.client = atoi(argv[++i]); + } else { + fprintf(stderr, "'-client' requires a parameter, default:%d\n", arguments.client); + } + } else if (strcmp(argv[i], "-sql") == 0) { + if (i < argc - 1) { + strcpy(arguments.querySQL,argv[++i]); + } else { + fprintf(stderr, "'-sql' requires a parameter, default:%d\n", arguments.querySQL); + } + } else if (strcmp(argv[i], "-insert") == 0) { + arguments.insert = 1; + } else if (strcmp(argv[i], "-create") == 0) { + arguments.create = 1; + } else if (strcmp(argv[i], "-query") == 0) { + arguments.query = 1; + } + } +} + +void create() { + int64_t st = getTimeStampMs(); + void *taos = taos_connect("127.0.0.1", "root", "taosdata", NULL, 0); + if (taos == NULL) { + printf("TDengine error: failed to connect\n"); + exit(EXIT_FAILURE); + } + TAOS_RES *result = taos_query(taos, "drop database if exists db"); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + exit(EXIT_FAILURE); + } + taos_free_result(result); + int64_t elapsed = getTimeStampMs() - st; + printf("--- spend %ld ms to drop database db\n", elapsed); + st = getTimeStampMs(); + result = taos_query(taos, "create database if not exists db"); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + exit(EXIT_FAILURE); + } + taos_free_result(result); + elapsed = getTimeStampMs() - st; + printf("--- spend %ld ms to create database db\n", elapsed); + st = getTimeStampMs(); + start(); + printf("--- Spend %ld ms to create %d super tables and each %d tables\n", elapsed, arguments.stable, arguments.table); +} + +void createImp(void *param) { + char command[256] = "\0"; + int sqlLen = 0; + int count = 0; + char *sql = calloc(1, 1024*1024); + ThreadObj *pThread = (ThreadObj *)param; + printf("Thread %d start create super table s%d to s%d\n", pThread->threadId, (pThread->threadId - 1) * arguments.stable / arguments.client, pThread->threadId * arguments.stable / arguments.client - 1); + for (int i = (pThread->threadId - 1) * arguments.stable / arguments.client; i < pThread->threadId * arguments.stable / arguments.client; i++) { + sprintf(command, "create table if not exists db.s%d(ts timestamp, c1 int, c2 int, c3 int) TAGS (id int)", i); + TAOS_RES *result = taos_query(pThread->taos, command); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql:%s, reason:%s\n", __LINE__, command, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + result = taos_query(pThread->taos, "use db"); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + sqlLen = sprintf(sql, "create table if not exists "); + count = 0; + for (int j = 0; j < arguments.table; j++) { + sqlLen += sprintf(sql + sqlLen, " s%d_%d USING s%d TAGS (%d)", i, j, i, j); + if ((j + 1) % arguments.table == 0) { + result = taos_query(pThread->taos, sql); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + printf("Thread %d created table s%d_%d to s%d_%d\n", pThread->threadId, i, count, i, j); + count = j; + sqlLen = sprintf(sql, "create table if not exists "); + } + } + } +} + +void start() { + ThreadObj *threads = calloc((size_t)arguments.client, sizeof(ThreadObj)); + for (int i = 0; i < arguments.client; i++) { + ThreadObj *pthread = threads + i; + pthread_attr_t thattr; + pthread->threadId = i + 1; + pthread->taos = taos_connect("127.0.0.1", "root", "taosdata", NULL, 0); + pthread_attr_init(&thattr); + pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_JOINABLE); + if (arguments.create) { + pthread_create(&pthread->pid, &thattr, (void *(*)(void *))createImp, pthread); + } else if (arguments.insert) { + pthread_create(&pthread->pid, &thattr, (void *(*)(void *))insertImp, pthread); + } else if (arguments.query) { + pthread_create(&pthread->pid, &thattr, (void *(*)(void *))queryImp, pthread); + } + } + for (int i = 0; i < arguments.client; i++) { + pthread_join(threads[i].pid, NULL); + } + free(threads); +} + +void insertImp(void *param) { + int count = 0; + ThreadObj *pThread = (ThreadObj *)param; + printf("Thread %d start insert data\n", pThread->threadId); + int sqlLen = 0; + char *sql = calloc(1, 1024*1024); + TAOS_RES *result = taos_query(pThread->taos, "use db"); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + int64_t time = getTimeStampMs(); + while (true) { + sqlLen = sprintf(sql, "insert into"); + for (int i = (pThread->threadId - 1) * arguments.stable / arguments.client; i < pThread->threadId * arguments.stable / arguments.client; i++) { + for (int j = 0; j < arguments.table; j++) { + sqlLen += sprintf(sql + sqlLen, " s%d_%d values (%ld, %d, %d, %d)", i, j, time, rand(), rand(), rand()); + count++; + if ( (1048576 - sqlLen) < 49151 || i == (pThread->threadId * arguments.stable / arguments.client - 1)) { + result = taos_query(pThread->taos, sql); + printf("Thread %d already insert %d rows\n", pThread->threadId, count); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + sqlLen = sprintf(sql, "insert into"); + } + } + } + time += 1000*arguments.interval; + } +} + +void queryImp(void *param) { + ThreadObj *pThread = (ThreadObj *)param; + printf("Thread %d start query\n", pThread->threadId); + int sqlLen = 0; + char *sql = calloc(1, 1024*1024); + TAOS_RES *result = taos_query(pThread->taos, "use db"); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql, reason:%s\n", __LINE__, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); + while (true) { + for (int i = (pThread->threadId - 1) * arguments.stable / arguments.client; i < pThread->threadId * arguments.stable / arguments.client; i++) { + sqlLen = sprintf(sql, arguments.querySQL); + sqlLen += sprintf(sql + sqlLen, " s%d", i); + result = taos_query(pThread->taos, sql); + if (result == NULL || taos_errno(result) != 0) { + printf("In line:%d, failed to execute sql: %s, reason:%s\n", __LINE__, sql, taos_errstr(result)); + taos_free_result(result); + return; + } + int num_fields = taos_field_count(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + TAOS_ROW row = NULL; + while ((row = taos_fetch_row(result))) { + char temp[16000] = {0}; + int len = taos_print_row(temp, row, fields, num_fields); + len += sprintf(temp + len, "\n"); + printf("Thread %d query result: %s\n", pThread->threadId, temp); + } + taos_free_result(result); + sleep(arguments.interval); + } + } + +} + +int main(int argc, char *argv[]) { + parseArg(argc, argv); + if (arguments.insert || arguments.query || arguments.create) { + start(); + } else { + printf("choose one argument: \n1) -create\n2) -insert\n3) -query\n"); + } +} \ No newline at end of file diff --git a/tests/script/sh/prepare_udf.sh b/tests/script/sh/prepare_udf.sh index ecfc53660e..a856b96c98 100644 --- a/tests/script/sh/prepare_udf.sh +++ b/tests/script/sh/prepare_udf.sh @@ -5,6 +5,7 @@ echo -n "" > /tmp/empty dd if=/dev/zero bs=3584 of=/tmp/big count=1 rm -rf /tmp/sum_double.so /tmp/add_one.so +touch /tmp/normal gcc -g -O0 -fPIC -shared sh/sum_double.c -o /tmp/sum_double.so gcc -g -O0 -fPIC -shared sh/add_one.c -o /tmp/add_one.so