diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 25d9fcdf85fa09f7da3c96499cad526e9f120e7a..595c9c34edaea0c58a3db01fa8e9c4735501156f 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -526,29 +526,39 @@ int32_t tDeserializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pR typedef struct { char db[TSDB_DB_FNAME_LEN]; int32_t numOfVgroups; - int32_t cacheBlockSize; // MB - int32_t totalBlocks; - int32_t daysPerFile; - int32_t daysToKeep0; - int32_t daysToKeep1; - int32_t daysToKeep2; + int32_t numOfStables; // single_stable + int32_t buffer; // MB + int32_t pageSize; + int32_t pages; + int32_t durationPerFile; // unit is minute + int32_t durationToKeep0; + int32_t durationToKeep1; + int32_t durationToKeep2; int32_t minRows; int32_t maxRows; - int32_t commitTime; int32_t fsyncPeriod; - int32_t ttl; int8_t walLevel; int8_t precision; // time resolution int8_t compression; int8_t replications; int8_t strict; - int8_t update; int8_t cacheLastRow; int8_t ignoreExist; int8_t streamMode; - int8_t singleSTable; int32_t numOfRetensions; SArray* pRetensions; // SRetention + + // deleted or changed + int32_t daysPerFile; // durationPerFile + int32_t daysToKeep0; // durationToKeep0 + int32_t daysToKeep1; // durationToKeep1 + int32_t daysToKeep2; // durationToKeep2 + int32_t cacheBlockSize; // MB + int32_t totalBlocks; + int32_t commitTime; + int32_t ttl; + int8_t update; + int8_t singleSTable; // numOfStables } SCreateDbReq; int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq); @@ -557,10 +567,13 @@ void tFreeSCreateDbReq(SCreateDbReq* pReq); typedef struct { char db[TSDB_DB_FNAME_LEN]; - int32_t totalBlocks; - int32_t daysToKeep0; - int32_t daysToKeep1; - int32_t daysToKeep2; + int32_t buffer; + int32_t pageSize; + int32_t pages; + int32_t durationPerFile; + int32_t durationToKeep0; + int32_t durationToKeep1; + int32_t durationToKeep2; int32_t fsyncPeriod; int8_t walLevel; int8_t strict; @@ -621,26 +634,24 @@ int32_t tDeserializeSDbCfgReq(void* buf, int32_t bufLen, SDbCfgReq* pReq); typedef struct { int32_t numOfVgroups; - int32_t cacheBlockSize; - int32_t totalBlocks; - int32_t daysPerFile; - int32_t daysToKeep0; - int32_t daysToKeep1; - int32_t daysToKeep2; + int32_t numOfStables; + int32_t buffer; + int32_t pageSize; + int32_t pages; + int32_t durationPerFile; + int32_t durationToKeep0; + int32_t durationToKeep1; + int32_t durationToKeep2; int32_t minRows; int32_t maxRows; - int32_t commitTime; int32_t fsyncPeriod; - int32_t ttl; int8_t walLevel; int8_t precision; int8_t compression; int8_t replications; int8_t strict; - int8_t update; int8_t cacheLastRow; int8_t streamMode; - int8_t singleSTable; int32_t numOfRetensions; SArray* pRetensions; } SDbCfgRsp; @@ -840,15 +851,16 @@ typedef struct { char db[TSDB_DB_FNAME_LEN]; int64_t dbUid; int32_t vgVersion; - int32_t cacheBlockSize; - int32_t totalBlocks; - int32_t daysPerFile; - int32_t daysToKeep0; - int32_t daysToKeep1; - int32_t daysToKeep2; + int32_t numOfStables; + int32_t buffer; + int32_t pageSize; + int32_t pages; + int32_t durationPerFile; + int32_t durationToKeep0; + int32_t durationToKeep1; + int32_t durationToKeep2; int32_t minRows; int32_t maxRows; - int32_t commitTime; int32_t fsyncPeriod; uint32_t hashBegin; uint32_t hashEnd; @@ -857,7 +869,6 @@ typedef struct { int8_t precision; int8_t compression; int8_t strict; - int8_t update; int8_t cacheLastRow; int8_t replica; int8_t selfIndex; @@ -891,10 +902,14 @@ int32_t tDeserializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq typedef struct { int32_t vgVersion; - int32_t totalBlocks; - int32_t daysToKeep0; - int32_t daysToKeep1; - int32_t daysToKeep2; + int32_t buffer; + int32_t pageSize; + int32_t pages; + int32_t durationPerFile; + int32_t durationToKeep0; + int32_t durationToKeep1; + int32_t durationToKeep2; + int32_t fsyncPeriod; int8_t walLevel; int8_t strict; int8_t cacheLastRow; @@ -949,7 +964,6 @@ typedef struct { int32_t numOfColumns; int8_t precision; int8_t tableType; - int8_t update; int32_t sversion; int32_t tversion; uint64_t suid; diff --git a/include/util/tdef.h b/include/util/tdef.h index aa0d0bd8ff2355e7ad67132986200a5a4e53537c..cadce7ddc263c2cdaa56c256ec352b787cb60906 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -319,62 +319,68 @@ typedef enum ELogicConditionType { #define TSDB_MULTI_TABLEMETA_MAX_NUM 100000 // maximum batch size allowed to load table meta -#define TSDB_MIN_VNODES_PER_DB 1 -#define TSDB_MAX_VNODES_PER_DB 4096 -#define TSDB_DEFAULT_VN_PER_DB 2 -#define TSDB_MIN_CACHE_BLOCK_SIZE 1 -#define TSDB_MAX_CACHE_BLOCK_SIZE 128 // 128MB for each vnode -#define TSDB_DEFAULT_CACHE_BLOCK_SIZE 16 -#define TSDB_MIN_TOTAL_BLOCKS 3 -#define TSDB_MAX_TOTAL_BLOCKS 10000 -#define TSDB_DEFAULT_TOTAL_BLOCKS 6 -#define TSDB_MIN_DAYS_PER_FILE 60 // unit minute -#define TSDB_MAX_DAYS_PER_FILE (3650 * 1440) -#define TSDB_DEFAULT_DAYS_PER_FILE (10 * 1440) -#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute -#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved. -#define TSDB_DEFAULT_KEEP (3650 * 1440) // ten years -#define TSDB_MIN_MINROWS_FBLOCK 10 -#define TSDB_MAX_MINROWS_FBLOCK 1000 -#define TSDB_DEFAULT_MINROWS_FBLOCK 100 -#define TSDB_MIN_MAXROWS_FBLOCK 200 -#define TSDB_MAX_MAXROWS_FBLOCK 10000 -#define TSDB_DEFAULT_MAXROWS_FBLOCK 4096 -#define TSDB_MIN_COMMIT_TIME 30 -#define TSDB_MAX_COMMIT_TIME 40960 -#define TSDB_DEFAULT_COMMIT_TIME 3600 -#define TSDB_MIN_FSYNC_PERIOD 0 -#define TSDB_MAX_FSYNC_PERIOD 180000 // millisecond -#define TSDB_DEFAULT_FSYNC_PERIOD 3000 // three second -#define TSDB_MIN_DB_TTL 1 -#define TSDB_DEFAULT_DB_TTL 1 -#define TSDB_MIN_WAL_LEVEL 1 -#define TSDB_MAX_WAL_LEVEL 2 -#define TSDB_DEFAULT_WAL_LEVEL 1 -#define TSDB_MIN_PRECISION TSDB_TIME_PRECISION_MILLI -#define TSDB_MAX_PRECISION TSDB_TIME_PRECISION_NANO -#define TSDB_DEFAULT_PRECISION TSDB_TIME_PRECISION_MILLI -#define TSDB_MIN_COMP_LEVEL 0 -#define TSDB_MAX_COMP_LEVEL 2 -#define TSDB_DEFAULT_COMP_LEVEL 2 -#define TSDB_MIN_DB_REPLICA 1 -#define TSDB_MAX_DB_REPLICA 3 -#define TSDB_DEFAULT_DB_REPLICA 1 -#define TSDB_DB_STRICT_OFF 0 -#define TSDB_DB_STRICT_ON 1 -#define TSDB_DEFAULT_DB_STRICT 0 -#define TSDB_MIN_DB_UPDATE 0 -#define TSDB_MAX_DB_UPDATE 2 -#define TSDB_DEFAULT_DB_UPDATE 0 -#define TSDB_MIN_DB_CACHE_LAST_ROW 0 -#define TSDB_MAX_DB_CACHE_LAST_ROW 3 -#define TSDB_DEFAULT_CACHE_LAST_ROW 0 -#define TSDB_DB_STREAM_MODE_OFF 0 -#define TSDB_DB_STREAM_MODE_ON 1 -#define TSDB_DEFAULT_DB_STREAM_MODE 0 -#define TSDB_DB_SINGLE_STABLE_ON 0 -#define TSDB_DB_SINGLE_STABLE_OFF 1 -#define TSDB_DEFAULT_DB_SINGLE_STABLE 0 +#define TSDB_MIN_VNODES_PER_DB 1 +#define TSDB_MAX_VNODES_PER_DB 4096 +#define TSDB_DEFAULT_VN_PER_DB 2 +#define TSDB_MIN_STBS_PER_DB 0 +#define TSDB_MAX_STBS_PER_DB 1 +#define TSDB_DEFAULT_STBS_PER_DB 0 +#define TSDB_MIN_BUFFER_SIZE 1 +#define TSDB_MAX_BUFFER_SIZE 16384 +#define TSDB_DEFAULT_BUFFER_SIZE 96 // 96MB for each vnode +#define TSDB_MIN_PAGE_SIZE 1 // 1KB +#define TSDB_MAX_PAGE_SIZE 16384 // 16MB +#define TSDB_DEFAULT_PAGE_SIZE 4 +#define TSDB_MIN_TOTAL_PAGES 64 +#define TSDB_MAX_TOTAL_PAGES 16384 +#define TSDB_DEFAULT_TOTAL_PAGES 256 +#define TSDB_MIN_DURATION_PER_FILE 60 // unit minute +#define TSDB_MAX_DURATION_PER_FILE (3650 * 1440) +#define TSDB_DEFAULT_DURATION_PER_FILE (10 * 1440) +#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute +#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved. +#define TSDB_DEFAULT_KEEP (3650 * 1440) // ten years +#define TSDB_MIN_MINROWS_FBLOCK 10 +#define TSDB_MAX_MINROWS_FBLOCK 1000 +#define TSDB_DEFAULT_MINROWS_FBLOCK 100 +#define TSDB_MIN_MAXROWS_FBLOCK 200 +#define TSDB_MAX_MAXROWS_FBLOCK 10000 +#define TSDB_DEFAULT_MAXROWS_FBLOCK 4096 +#define TSDB_MIN_COMMIT_TIME 30 +#define TSDB_MAX_COMMIT_TIME 40960 +#define TSDB_DEFAULT_COMMIT_TIME 3600 +#define TSDB_MIN_FSYNC_PERIOD 0 +#define TSDB_MAX_FSYNC_PERIOD 180000 // millisecond +#define TSDB_DEFAULT_FSYNC_PERIOD 3000 // three second +#define TSDB_MIN_DB_TTL 1 +#define TSDB_DEFAULT_DB_TTL 1 +#define TSDB_MIN_WAL_LEVEL 1 +#define TSDB_MAX_WAL_LEVEL 2 +#define TSDB_DEFAULT_WAL_LEVEL 1 +#define TSDB_MIN_PRECISION TSDB_TIME_PRECISION_MILLI +#define TSDB_MAX_PRECISION TSDB_TIME_PRECISION_NANO +#define TSDB_DEFAULT_PRECISION TSDB_TIME_PRECISION_MILLI +#define TSDB_MIN_COMP_LEVEL 0 +#define TSDB_MAX_COMP_LEVEL 2 +#define TSDB_DEFAULT_COMP_LEVEL 2 +#define TSDB_MIN_DB_REPLICA 1 +#define TSDB_MAX_DB_REPLICA 3 +#define TSDB_DEFAULT_DB_REPLICA 1 +#define TSDB_DB_STRICT_OFF 0 +#define TSDB_DB_STRICT_ON 1 +#define TSDB_DEFAULT_DB_STRICT 0 +#define TSDB_MIN_DB_UPDATE 0 +#define TSDB_MAX_DB_UPDATE 2 +#define TSDB_DEFAULT_DB_UPDATE 0 +#define TSDB_MIN_DB_CACHE_LAST_ROW 0 +#define TSDB_MAX_DB_CACHE_LAST_ROW 3 +#define TSDB_DEFAULT_CACHE_LAST_ROW 0 +#define TSDB_DB_STREAM_MODE_OFF 0 +#define TSDB_DB_STREAM_MODE_ON 1 +#define TSDB_DEFAULT_DB_STREAM_MODE 0 +#define TSDB_DB_SINGLE_STABLE_ON 0 +#define TSDB_DB_SINGLE_STABLE_OFF 1 +#define TSDB_DEFAULT_DB_SINGLE_STABLE 0 #define TSDB_MIN_DB_FILE_FACTOR 0 #define TSDB_MAX_DB_FILE_FACTOR 1 diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 05fd9e301bf535739e642ca77022978e6220dbc8..12fa11cbcda5e5409fc10ec3c695fb5d8c03aacf 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1891,27 +1891,25 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) { if (tStartEncode(&encoder) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfVgroups) < 0) return -1; - if (tEncodeI32(&encoder, pReq->cacheBlockSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->totalBlocks) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep2) < 0) return -1; + if (tEncodeI32(&encoder, pReq->numOfStables) < 0) return -1; + if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; + if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; + if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationPerFile) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep0) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep1) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep2) < 0) return -1; if (tEncodeI32(&encoder, pReq->minRows) < 0) return -1; if (tEncodeI32(&encoder, pReq->maxRows) < 0) return -1; - if (tEncodeI32(&encoder, pReq->commitTime) < 0) return -1; if (tEncodeI32(&encoder, pReq->fsyncPeriod) < 0) return -1; - if (tEncodeI32(&encoder, pReq->ttl) < 0) return -1; if (tEncodeI8(&encoder, pReq->walLevel) < 0) return -1; if (tEncodeI8(&encoder, pReq->precision) < 0) return -1; if (tEncodeI8(&encoder, pReq->compression) < 0) return -1; if (tEncodeI8(&encoder, pReq->replications) < 0) return -1; if (tEncodeI8(&encoder, pReq->strict) < 0) return -1; - if (tEncodeI8(&encoder, pReq->update) < 0) return -1; if (tEncodeI8(&encoder, pReq->cacheLastRow) < 0) return -1; if (tEncodeI8(&encoder, pReq->ignoreExist) < 0) return -1; if (tEncodeI8(&encoder, pReq->streamMode) < 0) return -1; - if (tEncodeI8(&encoder, pReq->singleSTable) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfRetensions) < 0) return -1; for (int32_t i = 0; i < pReq->numOfRetensions; ++i) { SRetention *pRetension = taosArrayGet(pReq->pRetensions, i); @@ -1934,27 +1932,25 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) if (tStartDecode(&decoder) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; if (tDecodeI32(&decoder, &pReq->numOfVgroups) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->cacheBlockSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->totalBlocks) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysPerFile) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep2) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->numOfStables) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationPerFile) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep0) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep1) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep2) < 0) return -1; if (tDecodeI32(&decoder, &pReq->minRows) < 0) return -1; if (tDecodeI32(&decoder, &pReq->maxRows) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->commitTime) < 0) return -1; if (tDecodeI32(&decoder, &pReq->fsyncPeriod) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->ttl) < 0) return -1; if (tDecodeI8(&decoder, &pReq->walLevel) < 0) return -1; if (tDecodeI8(&decoder, &pReq->precision) < 0) return -1; if (tDecodeI8(&decoder, &pReq->compression) < 0) return -1; if (tDecodeI8(&decoder, &pReq->replications) < 0) return -1; if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->update) < 0) return -1; if (tDecodeI8(&decoder, &pReq->cacheLastRow) < 0) return -1; if (tDecodeI8(&decoder, &pReq->ignoreExist) < 0) return -1; if (tDecodeI8(&decoder, &pReq->streamMode) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->singleSTable) < 0) return -1; if (tDecodeI32(&decoder, &pReq->numOfRetensions) < 0) return -1; pReq->pRetensions = taosArrayInit(pReq->numOfRetensions, sizeof(SRetention)); if (pReq->pRetensions == NULL) { @@ -1991,10 +1987,13 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (tStartEncode(&encoder) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; - if (tEncodeI32(&encoder, pReq->totalBlocks) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep2) < 0) return -1; + if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; + if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; + if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationPerFile) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep0) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep1) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep2) < 0) return -1; if (tEncodeI32(&encoder, pReq->fsyncPeriod) < 0) return -1; if (tEncodeI8(&encoder, pReq->walLevel) < 0) return -1; if (tEncodeI8(&encoder, pReq->strict) < 0) return -1; @@ -2013,10 +2012,13 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (tStartDecode(&decoder) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->totalBlocks) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep2) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationPerFile) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep0) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep1) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep2) < 0) return -1; if (tDecodeI32(&decoder, &pReq->fsyncPeriod) < 0) return -1; if (tDecodeI8(&decoder, &pReq->walLevel) < 0) return -1; if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1; @@ -2167,7 +2169,7 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp pRsp->addrsList = taosArrayInit(num, sizeof(SQueryNodeAddr)); if (NULL == pRsp->addrsList) return -1; } - + for (int32_t i = 0; i < num; ++i) { SQueryNodeAddr addr = {0}; if (tDecodeSQueryNodeAddr(&decoder, &addr) < 0) return -1; @@ -2368,22 +2370,22 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) { if (tStartEncode(&encoder) < 0) return -1; if (tEncodeI32(&encoder, pRsp->numOfVgroups) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->cacheBlockSize) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->totalBlocks) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->daysPerFile) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->daysToKeep0) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->daysToKeep1) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->daysToKeep2) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->numOfStables) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->buffer) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->pageSize) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->pages) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->durationPerFile) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->durationToKeep0) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->durationToKeep1) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->durationToKeep2) < 0) return -1; if (tEncodeI32(&encoder, pRsp->minRows) < 0) return -1; if (tEncodeI32(&encoder, pRsp->maxRows) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->commitTime) < 0) return -1; if (tEncodeI32(&encoder, pRsp->fsyncPeriod) < 0) return -1; if (tEncodeI8(&encoder, pRsp->walLevel) < 0) return -1; if (tEncodeI8(&encoder, pRsp->precision) < 0) return -1; if (tEncodeI8(&encoder, pRsp->compression) < 0) return -1; if (tEncodeI8(&encoder, pRsp->replications) < 0) return -1; if (tEncodeI8(&encoder, pRsp->strict) < 0) return -1; - if (tEncodeI8(&encoder, pRsp->update) < 0) return -1; if (tEncodeI8(&encoder, pRsp->cacheLastRow) < 0) return -1; if (tEncodeI8(&encoder, pRsp->streamMode) < 0) return -1; if (tEncodeI32(&encoder, pRsp->numOfRetensions) < 0) return -1; @@ -2407,22 +2409,22 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) { if (tStartDecode(&decoder) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->numOfVgroups) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->cacheBlockSize) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->totalBlocks) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->daysPerFile) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->daysToKeep0) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->daysToKeep1) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->daysToKeep2) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->numOfStables) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->buffer) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->pageSize) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->pages) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->durationPerFile) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->durationToKeep0) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->durationToKeep1) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->durationToKeep2) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->minRows) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->maxRows) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->commitTime) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->fsyncPeriod) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->walLevel) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->precision) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->compression) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->replications) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->strict) < 0) return -1; - if (tDecodeI8(&decoder, &pRsp->update) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->cacheLastRow) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->streamMode) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->numOfRetensions) < 0) return -1; @@ -2583,7 +2585,6 @@ static int32_t tEncodeSTableMetaRsp(SCoder *pEncoder, STableMetaRsp *pRsp) { if (tEncodeI32(pEncoder, pRsp->numOfColumns) < 0) return -1; if (tEncodeI8(pEncoder, pRsp->precision) < 0) return -1; if (tEncodeI8(pEncoder, pRsp->tableType) < 0) return -1; - if (tEncodeI8(pEncoder, pRsp->update) < 0) return -1; if (tEncodeI32(pEncoder, pRsp->sversion) < 0) return -1; if (tEncodeI32(pEncoder, pRsp->tversion) < 0) return -1; if (tEncodeU64(pEncoder, pRsp->suid) < 0) return -1; @@ -2606,7 +2607,6 @@ static int32_t tDecodeSTableMetaRsp(SCoder *pDecoder, STableMetaRsp *pRsp) { if (tDecodeI32(pDecoder, &pRsp->numOfColumns) < 0) return -1; if (tDecodeI8(pDecoder, &pRsp->precision) < 0) return -1; if (tDecodeI8(pDecoder, &pRsp->tableType) < 0) return -1; - if (tDecodeI8(pDecoder, &pRsp->update) < 0) return -1; if (tDecodeI32(pDecoder, &pRsp->sversion) < 0) return -1; if (tDecodeI32(pDecoder, &pRsp->tversion) < 0) return -1; if (tDecodeU64(pDecoder, &pRsp->suid) < 0) return -1; @@ -3026,15 +3026,16 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; if (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1; if (tEncodeI32(&encoder, pReq->vgVersion) < 0) return -1; - if (tEncodeI32(&encoder, pReq->cacheBlockSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->totalBlocks) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysPerFile) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep2) < 0) return -1; + if (tEncodeI32(&encoder, pReq->numOfStables) < 0) return -1; + if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; + if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; + if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationPerFile) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep0) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep1) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep2) < 0) return -1; if (tEncodeI32(&encoder, pReq->minRows) < 0) return -1; if (tEncodeI32(&encoder, pReq->maxRows) < 0) return -1; - if (tEncodeI32(&encoder, pReq->commitTime) < 0) return -1; if (tEncodeI32(&encoder, pReq->fsyncPeriod) < 0) return -1; if (tEncodeU32(&encoder, pReq->hashBegin) < 0) return -1; if (tEncodeU32(&encoder, pReq->hashEnd) < 0) return -1; @@ -3043,7 +3044,6 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR if (tEncodeI8(&encoder, pReq->precision) < 0) return -1; if (tEncodeI8(&encoder, pReq->compression) < 0) return -1; if (tEncodeI8(&encoder, pReq->strict) < 0) return -1; - if (tEncodeI8(&encoder, pReq->update) < 0) return -1; if (tEncodeI8(&encoder, pReq->cacheLastRow) < 0) return -1; if (tEncodeI8(&encoder, pReq->replica) < 0) return -1; if (tEncodeI8(&encoder, pReq->selfIndex) < 0) return -1; @@ -3077,15 +3077,16 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq * if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1; if (tDecodeI32(&decoder, &pReq->vgVersion) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->cacheBlockSize) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->totalBlocks) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysPerFile) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep2) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->numOfStables) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationPerFile) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep0) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep1) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep2) < 0) return -1; if (tDecodeI32(&decoder, &pReq->minRows) < 0) return -1; if (tDecodeI32(&decoder, &pReq->maxRows) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->commitTime) < 0) return -1; if (tDecodeI32(&decoder, &pReq->fsyncPeriod) < 0) return -1; if (tDecodeU32(&decoder, &pReq->hashBegin) < 0) return -1; if (tDecodeU32(&decoder, &pReq->hashEnd) < 0) return -1; @@ -3094,7 +3095,6 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq * if (tDecodeI8(&decoder, &pReq->precision) < 0) return -1; if (tDecodeI8(&decoder, &pReq->compression) < 0) return -1; if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1; - if (tDecodeI8(&decoder, &pReq->update) < 0) return -1; if (tDecodeI8(&decoder, &pReq->cacheLastRow) < 0) return -1; if (tDecodeI8(&decoder, &pReq->replica) < 0) return -1; if (tDecodeI8(&decoder, &pReq->selfIndex) < 0) return -1; @@ -3198,10 +3198,14 @@ int32_t tSerializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pReq if (tStartEncode(&encoder) < 0) return -1; if (tEncodeI32(&encoder, pReq->vgVersion) < 0) return -1; - if (tEncodeI32(&encoder, pReq->totalBlocks) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep0) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep1) < 0) return -1; - if (tEncodeI32(&encoder, pReq->daysToKeep2) < 0) return -1; + if (tEncodeI32(&encoder, pReq->buffer) < 0) return -1; + if (tEncodeI32(&encoder, pReq->pageSize) < 0) return -1; + if (tEncodeI32(&encoder, pReq->pages) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationPerFile) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep0) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep1) < 0) return -1; + if (tEncodeI32(&encoder, pReq->durationToKeep2) < 0) return -1; + if (tEncodeI32(&encoder, pReq->fsyncPeriod) < 0) return -1; if (tEncodeI8(&encoder, pReq->walLevel) < 0) return -1; if (tEncodeI8(&encoder, pReq->strict) < 0) return -1; if (tEncodeI8(&encoder, pReq->cacheLastRow) < 0) return -1; @@ -3225,10 +3229,14 @@ int32_t tDeserializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pR if (tStartDecode(&decoder) < 0) return -1; if (tDecodeI32(&decoder, &pReq->vgVersion) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->totalBlocks) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep0) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep1) < 0) return -1; - if (tDecodeI32(&decoder, &pReq->daysToKeep2) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->buffer) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->pageSize) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->pages) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationPerFile) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep0) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep1) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->durationToKeep2) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->fsyncPeriod) < 0) return -1; if (tDecodeI8(&decoder, &pReq->walLevel) < 0) return -1; if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1; if (tDecodeI8(&decoder, &pReq->cacheLastRow) < 0) return -1; diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 4cc1b8527c57f297d93383019d5c847648ec5945..abd71d03ea6a2adedd9f11e7ccecff6c70e4a2a6 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -107,15 +107,15 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { pCfg->vgId = pCreate->vgId; strcpy(pCfg->dbname, pCreate->db); - pCfg->wsize = pCreate->cacheBlockSize * 1024 * 1024; + pCfg->wsize = 16 * 1024 * 1024; pCfg->ssize = 1024; pCfg->lsize = 1024 * 1024; pCfg->streamMode = pCreate->streamMode; pCfg->isWeak = true; - pCfg->tsdbCfg.keep2 = pCreate->daysToKeep0; - pCfg->tsdbCfg.keep0 = pCreate->daysToKeep2; - pCfg->tsdbCfg.keep1 = pCreate->daysToKeep0; - pCfg->tsdbCfg.lruCacheSize = pCreate->cacheBlockSize; + pCfg->tsdbCfg.keep2 = pCreate->durationToKeep0; + pCfg->tsdbCfg.keep0 = pCreate->durationToKeep2; + pCfg->tsdbCfg.keep1 = pCreate->durationToKeep0; + pCfg->tsdbCfg.lruCacheSize = 16; pCfg->tsdbCfg.retentions = pCreate->pRetensions; pCfg->walCfg.vgId = pCreate->vgId; pCfg->hashBegin = pCreate->hashBegin; diff --git a/source/dnode/mgmt/test/vnode/vnode.cpp b/source/dnode/mgmt/test/vnode/vnode.cpp index 51b7d6818fdce72103f830eb4a9ba57c8b335197..c527a40d3f81e3225310a0c447517fd1da171933 100644 --- a/source/dnode/mgmt/test/vnode/vnode.cpp +++ b/source/dnode/mgmt/test/vnode/vnode.cpp @@ -33,22 +33,18 @@ TEST_F(DndTestVnode, 01_Create_Vnode) { strcpy(createReq.db, "1.d1"); createReq.dbUid = 9527; createReq.vgVersion = 1; - createReq.cacheBlockSize = 16; - createReq.totalBlocks = 10; - createReq.daysPerFile = 10; - createReq.daysToKeep0 = 3650; - createReq.daysToKeep1 = 3650; - createReq.daysToKeep2 = 3650; + createReq.durationPerFile = 10; + createReq.durationToKeep0 = 3650; + createReq.durationToKeep1 = 3650; + createReq.durationToKeep2 = 3650; createReq.minRows = 100; createReq.minRows = 4096; - createReq.commitTime = 3600; createReq.fsyncPeriod = 3000; createReq.walLevel = 1; createReq.precision = 0; createReq.compression = 2; createReq.replica = 1; createReq.strict = 1; - createReq.update = 0; createReq.cacheLastRow = 0; createReq.selfIndex = 0; for (int r = 0; r < createReq.replica; ++r) { @@ -75,27 +71,15 @@ TEST_F(DndTestVnode, 01_Create_Vnode) { TEST_F(DndTestVnode, 02_Alter_Vnode) { for (int i = 0; i < 3; ++i) { SAlterVnodeReq alterReq = {0}; - alterReq.vgId = 2; - alterReq.dnodeId = 1; - strcpy(alterReq.db, "1.d1"); - alterReq.dbUid = 9527; alterReq.vgVersion = 2; - alterReq.cacheBlockSize = 16; - alterReq.totalBlocks = 10; - alterReq.daysPerFile = 10; - alterReq.daysToKeep0 = 3650; - alterReq.daysToKeep1 = 3650; - alterReq.daysToKeep2 = 3650; - alterReq.minRows = 100; - alterReq.minRows = 4096; - alterReq.commitTime = 3600; + alterReq.durationPerFile = 10; + alterReq.durationToKeep0 = 3650; + alterReq.durationToKeep1 = 3650; + alterReq.durationToKeep2 = 3650; alterReq.fsyncPeriod = 3000; alterReq.walLevel = 1; - alterReq.precision = 0; - alterReq.compression = 2; alterReq.replica = 1; alterReq.strict = 1; - alterReq.update = 0; alterReq.cacheLastRow = 0; alterReq.selfIndex = 0; for (int r = 0; r < alterReq.replica; ++r) { diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index cf1cd58540733eba2a6f3d970d9462414de9c3bd..0c03592329c69717d204d84b5a96a43f29a93f5a 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -252,26 +252,24 @@ typedef struct { typedef struct { int32_t numOfVgroups; - int32_t cacheBlockSize; - int32_t totalBlocks; - int32_t daysPerFile; - int32_t daysToKeep0; - int32_t daysToKeep1; - int32_t daysToKeep2; + int32_t numOfStables; + int32_t buffer; + int32_t pageSize; + int32_t pages; + int32_t durationPerFile; + int32_t durationToKeep0; + int32_t durationToKeep1; + int32_t durationToKeep2; int32_t minRows; int32_t maxRows; - int32_t commitTime; int32_t fsyncPeriod; - int32_t ttl; int8_t walLevel; int8_t precision; int8_t compression; int8_t replications; int8_t strict; - int8_t update; int8_t cacheLastRow; int8_t streamMode; - int8_t singleSTable; int8_t hashMethod; // default is 1 int32_t numOfRetensions; SArray* pRetensions; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 9caadb7e030b7912f7ede818fbbcd8c58f7fad86..21dfe63faf54a6b8baaabd1eae37136bfec5d712 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -84,26 +84,24 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) { SDB_SET_INT32(pRaw, dataPos, pDb->cfgVersion, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->vgVersion, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.numOfVgroups, _OVER) - SDB_SET_INT32(pRaw, dataPos, pDb->cfg.cacheBlockSize, _OVER) - SDB_SET_INT32(pRaw, dataPos, pDb->cfg.totalBlocks, _OVER) - SDB_SET_INT32(pRaw, dataPos, pDb->cfg.daysPerFile, _OVER) - SDB_SET_INT32(pRaw, dataPos, pDb->cfg.daysToKeep0, _OVER) - SDB_SET_INT32(pRaw, dataPos, pDb->cfg.daysToKeep1, _OVER) - SDB_SET_INT32(pRaw, dataPos, pDb->cfg.daysToKeep2, _OVER) + SDB_SET_INT32(pRaw, dataPos, pDb->cfg.numOfStables, _OVER) + SDB_SET_INT32(pRaw, dataPos, pDb->cfg.buffer, _OVER) + SDB_SET_INT32(pRaw, dataPos, pDb->cfg.pageSize, _OVER) + SDB_SET_INT32(pRaw, dataPos, pDb->cfg.pages, _OVER) + SDB_SET_INT32(pRaw, dataPos, pDb->cfg.durationPerFile, _OVER) + SDB_SET_INT32(pRaw, dataPos, pDb->cfg.durationToKeep0, _OVER) + SDB_SET_INT32(pRaw, dataPos, pDb->cfg.durationToKeep1, _OVER) + SDB_SET_INT32(pRaw, dataPos, pDb->cfg.durationToKeep2, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.minRows, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.maxRows, _OVER) - SDB_SET_INT32(pRaw, dataPos, pDb->cfg.commitTime, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.fsyncPeriod, _OVER) - SDB_SET_INT32(pRaw, dataPos, pDb->cfg.ttl, _OVER) SDB_SET_INT8(pRaw, dataPos, pDb->cfg.walLevel, _OVER) SDB_SET_INT8(pRaw, dataPos, pDb->cfg.precision, _OVER) SDB_SET_INT8(pRaw, dataPos, pDb->cfg.compression, _OVER) SDB_SET_INT8(pRaw, dataPos, pDb->cfg.replications, _OVER) SDB_SET_INT8(pRaw, dataPos, pDb->cfg.strict, _OVER) - SDB_SET_INT8(pRaw, dataPos, pDb->cfg.update, _OVER) SDB_SET_INT8(pRaw, dataPos, pDb->cfg.cacheLastRow, _OVER) SDB_SET_INT8(pRaw, dataPos, pDb->cfg.streamMode, _OVER) - SDB_SET_INT8(pRaw, dataPos, pDb->cfg.singleSTable, _OVER) SDB_SET_INT8(pRaw, dataPos, pDb->cfg.hashMethod, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.numOfRetensions, _OVER) for (int32_t i = 0; i < pDb->cfg.numOfRetensions; ++i) { @@ -158,26 +156,24 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) { SDB_GET_INT32(pRaw, dataPos, &pDb->cfgVersion, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->vgVersion, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.numOfVgroups, _OVER) - SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.cacheBlockSize, _OVER) - SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.totalBlocks, _OVER) - SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.daysPerFile, _OVER) - SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.daysToKeep0, _OVER) - SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.daysToKeep1, _OVER) - SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.daysToKeep2, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.numOfStables, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.buffer, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.pageSize, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.pages, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.durationPerFile, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.durationToKeep0, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.durationToKeep1, _OVER) + SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.durationToKeep2, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.minRows, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.maxRows, _OVER) - SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.commitTime, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.fsyncPeriod, _OVER) - SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.ttl, _OVER) SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.walLevel, _OVER) SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.precision, _OVER) SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.compression, _OVER) SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.replications, _OVER) SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.strict, _OVER) - SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.update, _OVER) SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.cacheLastRow, _OVER) SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.streamMode, _OVER) - SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.singleSTable, _OVER) SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.hashMethod, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.numOfRetensions, _OVER) if (pDb->cfg.numOfRetensions > 0) { @@ -266,21 +262,22 @@ static int32_t mndCheckDbName(const char *dbName, SUserObj *pUser) { static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) { if (pCfg->numOfVgroups < TSDB_MIN_VNODES_PER_DB || pCfg->numOfVgroups > TSDB_MAX_VNODES_PER_DB) return -1; - if (pCfg->cacheBlockSize < TSDB_MIN_CACHE_BLOCK_SIZE || pCfg->cacheBlockSize > TSDB_MAX_CACHE_BLOCK_SIZE) return -1; - if (pCfg->totalBlocks < TSDB_MIN_TOTAL_BLOCKS || pCfg->totalBlocks > TSDB_MAX_TOTAL_BLOCKS) return -1; - if (pCfg->daysPerFile < TSDB_MIN_DAYS_PER_FILE || pCfg->daysPerFile > TSDB_MAX_DAYS_PER_FILE) return -1; - if (pCfg->daysToKeep0 < TSDB_MIN_KEEP || pCfg->daysToKeep0 > TSDB_MAX_KEEP) return -1; - if (pCfg->daysToKeep1 < TSDB_MIN_KEEP || pCfg->daysToKeep1 > TSDB_MAX_KEEP) return -1; - if (pCfg->daysToKeep2 < TSDB_MIN_KEEP || pCfg->daysToKeep2 > TSDB_MAX_KEEP) return -1; - if (pCfg->daysToKeep0 < pCfg->daysPerFile) return -1; - if (pCfg->daysToKeep0 > pCfg->daysToKeep1) return -1; - if (pCfg->daysToKeep1 > pCfg->daysToKeep2) return -1; + if (pCfg->numOfStables < TSDB_MIN_STBS_PER_DB || pCfg->numOfStables > TSDB_MAX_STBS_PER_DB) return -1; + if (pCfg->buffer < TSDB_MIN_BUFFER_SIZE || pCfg->buffer > TSDB_MAX_BUFFER_SIZE) return -1; + if (pCfg->pageSize < TSDB_MIN_PAGE_SIZE || pCfg->pageSize > TSDB_MAX_PAGE_SIZE) return -1; + if (pCfg->pages < TSDB_MIN_TOTAL_PAGES || pCfg->pages > TSDB_MAX_TOTAL_PAGES) return -1; + if (pCfg->durationPerFile < TSDB_MIN_DURATION_PER_FILE || pCfg->durationPerFile > TSDB_MAX_DURATION_PER_FILE) + return -1; + if (pCfg->durationToKeep0 < TSDB_MIN_KEEP || pCfg->durationToKeep0 > TSDB_MAX_KEEP) return -1; + if (pCfg->durationToKeep1 < TSDB_MIN_KEEP || pCfg->durationToKeep1 > TSDB_MAX_KEEP) return -1; + if (pCfg->durationToKeep2 < TSDB_MIN_KEEP || pCfg->durationToKeep2 > TSDB_MAX_KEEP) return -1; + if (pCfg->durationToKeep0 < pCfg->durationPerFile) return -1; + if (pCfg->durationToKeep0 > pCfg->durationToKeep1) return -1; + if (pCfg->durationToKeep1 > pCfg->durationToKeep2) return -1; if (pCfg->minRows < TSDB_MIN_MINROWS_FBLOCK || pCfg->minRows > TSDB_MAX_MINROWS_FBLOCK) return -1; if (pCfg->maxRows < TSDB_MIN_MAXROWS_FBLOCK || pCfg->maxRows > TSDB_MAX_MAXROWS_FBLOCK) return -1; if (pCfg->minRows > pCfg->maxRows) return -1; - if (pCfg->commitTime < TSDB_MIN_COMMIT_TIME || pCfg->commitTime > TSDB_MAX_COMMIT_TIME) return -1; if (pCfg->fsyncPeriod < TSDB_MIN_FSYNC_PERIOD || pCfg->fsyncPeriod > TSDB_MAX_FSYNC_PERIOD) return -1; - if (pCfg->ttl < TSDB_MIN_DB_TTL) return -1; if (pCfg->walLevel < TSDB_MIN_WAL_LEVEL || pCfg->walLevel > TSDB_MAX_WAL_LEVEL) return -1; if (pCfg->precision < TSDB_MIN_PRECISION && pCfg->precision > TSDB_MAX_PRECISION) return -1; if (pCfg->compression < TSDB_MIN_COMP_LEVEL || pCfg->compression > TSDB_MAX_COMP_LEVEL) return -1; @@ -288,36 +285,32 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) { if (pCfg->replications > mndGetDnodeSize(pMnode)) return -1; if (pCfg->strict < TSDB_DB_STRICT_OFF || pCfg->strict > TSDB_DB_STRICT_ON) return -1; if (pCfg->strict > pCfg->replications) return -1; - if (pCfg->update < TSDB_MIN_DB_UPDATE || pCfg->update > TSDB_MAX_DB_UPDATE) return -1; if (pCfg->cacheLastRow < TSDB_MIN_DB_CACHE_LAST_ROW || pCfg->cacheLastRow > TSDB_MAX_DB_CACHE_LAST_ROW) return -1; if (pCfg->streamMode < TSDB_DB_STREAM_MODE_OFF || pCfg->streamMode > TSDB_DB_STREAM_MODE_ON) return -1; - if (pCfg->singleSTable < TSDB_DB_SINGLE_STABLE_ON || pCfg->streamMode > TSDB_DB_SINGLE_STABLE_OFF) return -1; if (pCfg->hashMethod != 1) return -1; return TSDB_CODE_SUCCESS; } static void mndSetDefaultDbCfg(SDbCfg *pCfg) { if (pCfg->numOfVgroups < 0) pCfg->numOfVgroups = TSDB_DEFAULT_VN_PER_DB; - if (pCfg->cacheBlockSize < 0) pCfg->cacheBlockSize = TSDB_DEFAULT_CACHE_BLOCK_SIZE; - if (pCfg->totalBlocks < 0) pCfg->totalBlocks = TSDB_DEFAULT_TOTAL_BLOCKS; - if (pCfg->daysPerFile < 0) pCfg->daysPerFile = TSDB_DEFAULT_DAYS_PER_FILE; - if (pCfg->daysToKeep0 < 0) pCfg->daysToKeep0 = TSDB_DEFAULT_KEEP; - if (pCfg->daysToKeep1 < 0) pCfg->daysToKeep1 = pCfg->daysToKeep0; - if (pCfg->daysToKeep2 < 0) pCfg->daysToKeep2 = pCfg->daysToKeep1; + if (pCfg->numOfStables < 0) pCfg->numOfStables = TSDB_DEFAULT_STBS_PER_DB; + if (pCfg->buffer < 0) pCfg->buffer = TSDB_DEFAULT_BUFFER_SIZE; + if (pCfg->pageSize < 0) pCfg->pageSize = TSDB_DEFAULT_PAGE_SIZE; + if (pCfg->pages < 0) pCfg->pages = TSDB_DEFAULT_TOTAL_PAGES; + if (pCfg->durationPerFile < 0) pCfg->durationPerFile = TSDB_DEFAULT_DURATION_PER_FILE; + if (pCfg->durationToKeep0 < 0) pCfg->durationToKeep0 = TSDB_DEFAULT_KEEP; + if (pCfg->durationToKeep1 < 0) pCfg->durationToKeep1 = pCfg->durationToKeep0; + if (pCfg->durationToKeep2 < 0) pCfg->durationToKeep2 = pCfg->durationToKeep1; if (pCfg->minRows < 0) pCfg->minRows = TSDB_DEFAULT_MINROWS_FBLOCK; if (pCfg->maxRows < 0) pCfg->maxRows = TSDB_DEFAULT_MAXROWS_FBLOCK; - if (pCfg->commitTime < 0) pCfg->commitTime = TSDB_DEFAULT_COMMIT_TIME; if (pCfg->fsyncPeriod < 0) pCfg->fsyncPeriod = TSDB_DEFAULT_FSYNC_PERIOD; - if (pCfg->ttl < 0) pCfg->ttl = TSDB_DEFAULT_DB_TTL; if (pCfg->walLevel < 0) pCfg->walLevel = TSDB_DEFAULT_WAL_LEVEL; if (pCfg->precision < 0) pCfg->precision = TSDB_DEFAULT_PRECISION; if (pCfg->compression < 0) pCfg->compression = TSDB_DEFAULT_COMP_LEVEL; if (pCfg->replications < 0) pCfg->replications = TSDB_DEFAULT_DB_REPLICA; if (pCfg->strict < 0) pCfg->strict = TSDB_DEFAULT_DB_STRICT; - if (pCfg->update < 0) pCfg->update = TSDB_DEFAULT_DB_UPDATE; if (pCfg->cacheLastRow < 0) pCfg->cacheLastRow = TSDB_DEFAULT_CACHE_LAST_ROW; if (pCfg->streamMode < 0) pCfg->streamMode = TSDB_DEFAULT_DB_STREAM_MODE; - if (pCfg->singleSTable < 0) pCfg->singleSTable = TSDB_DEFAULT_DB_SINGLE_STABLE; if (pCfg->numOfRetensions < 0) pCfg->numOfRetensions = 0; } @@ -443,26 +436,24 @@ static int32_t mndCreateDb(SMnode *pMnode, SNodeMsg *pReq, SCreateDbReq *pCreate memcpy(dbObj.createUser, pUser->user, TSDB_USER_LEN); dbObj.cfg = (SDbCfg){ .numOfVgroups = pCreate->numOfVgroups, - .cacheBlockSize = pCreate->cacheBlockSize, - .totalBlocks = pCreate->totalBlocks, - .daysPerFile = pCreate->daysPerFile, - .daysToKeep0 = pCreate->daysToKeep0, - .daysToKeep1 = pCreate->daysToKeep1, - .daysToKeep2 = pCreate->daysToKeep2, + .numOfStables = pCreate->numOfStables, + .buffer = pCreate->buffer, + .pageSize = pCreate->pageSize, + .pages = pCreate->pages, + .durationPerFile = pCreate->durationPerFile, + .durationToKeep0 = pCreate->durationToKeep0, + .durationToKeep1 = pCreate->durationToKeep1, + .durationToKeep2 = pCreate->durationToKeep2, .minRows = pCreate->minRows, .maxRows = pCreate->maxRows, - .commitTime = pCreate->commitTime, .fsyncPeriod = pCreate->fsyncPeriod, - .ttl = pCreate->ttl, .walLevel = pCreate->walLevel, .precision = pCreate->precision, .compression = pCreate->compression, .replications = pCreate->replications, .strict = pCreate->strict, - .update = pCreate->update, .cacheLastRow = pCreate->cacheLastRow, .streamMode = pCreate->streamMode, - .singleSTable = pCreate->singleSTable, .hashMethod = 1, }; @@ -566,23 +557,38 @@ _OVER: static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) { terrno = TSDB_CODE_MND_DB_OPTION_UNCHANGED; - if (pAlter->totalBlocks >= 0 && pAlter->totalBlocks != pDb->cfg.totalBlocks) { - pDb->cfg.totalBlocks = pAlter->totalBlocks; + if (pAlter->buffer >= 0 && pAlter->buffer != pDb->cfg.buffer) { + pDb->cfg.buffer = pAlter->buffer; + terrno = 0; + } + + if (pAlter->pages >= 0 && pAlter->pages != pDb->cfg.pages) { + pDb->cfg.pages = pAlter->pages; terrno = 0; } - if (pAlter->daysToKeep0 >= 0 && pAlter->daysToKeep0 != pDb->cfg.daysToKeep0) { - pDb->cfg.daysToKeep0 = pAlter->daysToKeep0; + if (pAlter->pageSize >= 0 && pAlter->pageSize != pDb->cfg.pageSize) { + pDb->cfg.pageSize = pAlter->pageSize; terrno = 0; } - if (pAlter->daysToKeep1 >= 0 && pAlter->daysToKeep1 != pDb->cfg.daysToKeep1) { - pDb->cfg.daysToKeep1 = pAlter->daysToKeep1; + if (pAlter->durationPerFile >= 0 && pAlter->durationPerFile != pDb->cfg.durationPerFile) { + pDb->cfg.durationPerFile = pAlter->durationPerFile; terrno = 0; } - if (pAlter->daysToKeep2 >= 0 && pAlter->daysToKeep2 != pDb->cfg.daysToKeep2) { - pDb->cfg.daysToKeep2 = pAlter->daysToKeep2; + if (pAlter->durationToKeep0 >= 0 && pAlter->durationToKeep0 != pDb->cfg.durationToKeep0) { + pDb->cfg.durationToKeep0 = pAlter->durationToKeep0; + terrno = 0; + } + + if (pAlter->durationToKeep1 >= 0 && pAlter->durationToKeep1 != pDb->cfg.durationToKeep1) { + pDb->cfg.durationToKeep1 = pAlter->durationToKeep1; + terrno = 0; + } + + if (pAlter->durationToKeep2 >= 0 && pAlter->durationToKeep2 != pDb->cfg.durationToKeep2) { + pDb->cfg.durationToKeep2 = pAlter->durationToKeep2; terrno = 0; } @@ -635,10 +641,14 @@ static int32_t mndSetAlterDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p void *mndBuildAlterVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen) { SAlterVnodeReq alterReq = {0}; alterReq.vgVersion = pVgroup->version; - alterReq.totalBlocks = pDb->cfg.totalBlocks; - alterReq.daysToKeep0 = pDb->cfg.daysToKeep0; - alterReq.daysToKeep1 = pDb->cfg.daysToKeep1; - alterReq.daysToKeep2 = pDb->cfg.daysToKeep2; + alterReq.buffer = pDb->cfg.buffer; + alterReq.pages = pDb->cfg.pages; + alterReq.pageSize = pDb->cfg.pageSize; + alterReq.durationPerFile = pDb->cfg.durationPerFile; + alterReq.durationToKeep0 = pDb->cfg.durationToKeep0; + alterReq.durationToKeep1 = pDb->cfg.durationToKeep1; + alterReq.durationToKeep2 = pDb->cfg.durationToKeep2; + alterReq.fsyncPeriod = pDb->cfg.fsyncPeriod; alterReq.walLevel = pDb->cfg.walLevel; alterReq.strict = pDb->cfg.strict; alterReq.cacheLastRow = pDb->cfg.cacheLastRow; @@ -831,26 +841,24 @@ static int32_t mndProcessGetDbCfgReq(SNodeMsg *pReq) { } cfgRsp.numOfVgroups = pDb->cfg.numOfVgroups; - cfgRsp.cacheBlockSize = pDb->cfg.cacheBlockSize; - cfgRsp.totalBlocks = pDb->cfg.totalBlocks; - cfgRsp.daysPerFile = pDb->cfg.daysPerFile; - cfgRsp.daysToKeep0 = pDb->cfg.daysToKeep0; - cfgRsp.daysToKeep1 = pDb->cfg.daysToKeep1; - cfgRsp.daysToKeep2 = pDb->cfg.daysToKeep2; + cfgRsp.numOfStables = pDb->cfg.numOfStables; + cfgRsp.buffer = pDb->cfg.buffer; + cfgRsp.pageSize = pDb->cfg.pageSize; + cfgRsp.pages = pDb->cfg.pages; + cfgRsp.durationPerFile = pDb->cfg.durationPerFile; + cfgRsp.durationToKeep0 = pDb->cfg.durationToKeep0; + cfgRsp.durationToKeep1 = pDb->cfg.durationToKeep1; + cfgRsp.durationToKeep2 = pDb->cfg.durationToKeep2; cfgRsp.minRows = pDb->cfg.minRows; cfgRsp.maxRows = pDb->cfg.maxRows; - cfgRsp.commitTime = pDb->cfg.commitTime; cfgRsp.fsyncPeriod = pDb->cfg.fsyncPeriod; - cfgRsp.ttl = pDb->cfg.ttl; cfgRsp.walLevel = pDb->cfg.walLevel; cfgRsp.precision = pDb->cfg.precision; cfgRsp.compression = pDb->cfg.compression; cfgRsp.replications = pDb->cfg.replications; cfgRsp.strict = pDb->cfg.strict; - cfgRsp.update = pDb->cfg.update; cfgRsp.cacheLastRow = pDb->cfg.cacheLastRow; cfgRsp.streamMode = pDb->cfg.streamMode; - cfgRsp.singleSTable = pDb->cfg.singleSTable; cfgRsp.numOfRetensions = pDb->cfg.numOfRetensions; cfgRsp.pRetensions = pDb->cfg.pRetensions; @@ -1191,7 +1199,7 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) { char *p = strchr(usedbReq.db, '.'); if (p && 0 == strcmp(p + 1, TSDB_INFORMATION_SCHEMA_DB)) { memcpy(usedbRsp.db, usedbReq.db, TSDB_DB_FNAME_LEN); - //mndGetGlobalVgroupVersion(); TODO + // mndGetGlobalVgroupVersion(); TODO static int32_t vgVersion = 1; if (usedbReq.vgVersion < vgVersion) { usedbRsp.pVgroupInfos = taosArrayInit(10, sizeof(SVgroupInfo)); @@ -1433,16 +1441,16 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in colDataAppend(pColInfo, rows, (const char *)b, false); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.daysPerFile, false); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.durationPerFile, false); char tmp[128] = {0}; int32_t len = 0; - if (pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep1 || pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep2) { - len = sprintf(&tmp[VARSTR_HEADER_SIZE], "%d,%d,%d", pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2, - pDb->cfg.daysToKeep0); + if (pDb->cfg.durationToKeep0 > pDb->cfg.durationToKeep1 || pDb->cfg.durationToKeep0 > pDb->cfg.durationToKeep2) { + len = sprintf(&tmp[VARSTR_HEADER_SIZE], "%d,%d,%d", pDb->cfg.durationToKeep1, pDb->cfg.durationToKeep2, + pDb->cfg.durationToKeep0); } else { - len = sprintf(&tmp[VARSTR_HEADER_SIZE], "%d,%d,%d", pDb->cfg.daysToKeep0, pDb->cfg.daysToKeep1, - pDb->cfg.daysToKeep2); + len = sprintf(&tmp[VARSTR_HEADER_SIZE], "%d,%d,%d", pDb->cfg.durationToKeep0, pDb->cfg.durationToKeep1, + pDb->cfg.durationToKeep2); } varDataSetLen(tmp, len); @@ -1450,10 +1458,13 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in colDataAppend(pColInfo, rows, (const char *)tmp, false); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.cacheBlockSize, false); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.buffer, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.pageSize, false); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.totalBlocks, false); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.pages, false); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.minRows, false); @@ -1495,11 +1506,7 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in colDataAppend(pColInfo, rows, (const char *)t, false); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.ttl, false); - - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.singleSTable, false); - + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.numOfStables, false); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.streamMode, false); @@ -1519,7 +1526,6 @@ static void setInformationSchemaDbCfg(SDbObj *pDbObj) { pDbObj->cfg.numOfVgroups = 0; pDbObj->cfg.strict = 1; pDbObj->cfg.replications = 1; - pDbObj->cfg.update = 1; pDbObj->cfg.precision = TSDB_TIME_PRECISION_MILLI; } @@ -1531,7 +1537,6 @@ static void setPerfSchemaDbCfg(SDbObj *pDbObj) { pDbObj->cfg.numOfVgroups = 0; pDbObj->cfg.strict = 1; pDbObj->cfg.replications = 1; - pDbObj->cfg.update = 1; pDbObj->cfg.precision = TSDB_TIME_PRECISION_MILLI; } diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index 2b46fc9274dae5407deccc7a362672db1005f8f0..81a852183b2882fcd3c8bf99910e340b4053e9af 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -76,10 +76,11 @@ static const SInfosTableSchema userDBSchema[] = { {.name = "ntables", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT}, {.name = "replica", .bytes = 2, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "strict", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, - {.name = "days", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "duration", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "keep", .bytes = 24 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, - {.name = "cache", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "buffer", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "pagesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "pages", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "minrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "maxrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "wal", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, @@ -87,7 +88,6 @@ static const SInfosTableSchema userDBSchema[] = { {.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "cachelast", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "precision", .bytes = 2 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, - {.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "single_stable", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "stream_mode", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 1e63dd983300ec1b644a3a64d1adb3d2449a479c..d367dafb582fc4de4b5f8e2d7b7ebb2e793de28c 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1510,7 +1510,6 @@ static int32_t mndBuildStbSchemaImp(SDbObj *pDb, SStbObj *pStb, const char *tbNa pRsp->numOfColumns = pStb->numOfColumns; pRsp->precision = pDb->cfg.precision; pRsp->tableType = TSDB_SUPER_TABLE; - pRsp->update = pDb->cfg.update; pRsp->sversion = pStb->version; pRsp->suid = pStb->uid; pRsp->tuid = pStb->uid; diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 3a4fde992fd999833321fcbe67714eeb27fb5919..7a2869b4cecc0a9c139c72c78e1dece989447b0d 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -190,21 +190,21 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg memcpy(createReq.db, pDb->name, TSDB_DB_FNAME_LEN); createReq.dbUid = pDb->uid; createReq.vgVersion = pVgroup->version; - createReq.cacheBlockSize = pDb->cfg.cacheBlockSize; - createReq.totalBlocks = pDb->cfg.totalBlocks; - createReq.daysPerFile = pDb->cfg.daysPerFile; - createReq.daysToKeep0 = pDb->cfg.daysToKeep0; - createReq.daysToKeep1 = pDb->cfg.daysToKeep1; - createReq.daysToKeep2 = pDb->cfg.daysToKeep2; + createReq.numOfStables = pDb->cfg.numOfStables; + createReq.buffer = pDb->cfg.buffer; + createReq.pageSize = pDb->cfg.pageSize; + createReq.pages = pDb->cfg.pages; + createReq.durationPerFile = pDb->cfg.durationPerFile; + createReq.durationToKeep0 = pDb->cfg.durationToKeep0; + createReq.durationToKeep1 = pDb->cfg.durationToKeep1; + createReq.durationToKeep2 = pDb->cfg.durationToKeep2; createReq.minRows = pDb->cfg.minRows; createReq.maxRows = pDb->cfg.maxRows; - createReq.commitTime = pDb->cfg.commitTime; createReq.fsyncPeriod = pDb->cfg.fsyncPeriod; createReq.walLevel = pDb->cfg.walLevel; createReq.precision = pDb->cfg.precision; createReq.compression = pDb->cfg.compression; createReq.strict = pDb->cfg.strict; - createReq.update = pDb->cfg.update; createReq.cacheLastRow = pDb->cfg.cacheLastRow; createReq.replica = pVgroup->replica; createReq.selfIndex = -1; diff --git a/source/dnode/mnode/impl/test/db/db.cpp b/source/dnode/mnode/impl/test/db/db.cpp index 1fc1bec650a3dbc3638b33d4da9ec373c971985c..77aeb94add10d2b8ab26beecfe0d85a385ae6aa1 100644 --- a/source/dnode/mnode/impl/test/db/db.cpp +++ b/source/dnode/mnode/impl/test/db/db.cpp @@ -35,12 +35,13 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { SCreateDbReq createReq = {0}; strcpy(createReq.db, "1.d1"); createReq.numOfVgroups = 2; - createReq.cacheBlockSize = 16; - createReq.totalBlocks = 10; - createReq.daysPerFile = 1000; - createReq.daysToKeep0 = 3650; - createReq.daysToKeep1 = 3650; - createReq.daysToKeep2 = 3650; + createReq.buffer = -1; + createReq.pageSize = -1; + createReq.pages = -1; + createReq.durationPerFile = 1000; + createReq.durationToKeep0 = 3650; + createReq.durationToKeep1 = 3650; + createReq.durationToKeep2 = 3650; createReq.minRows = 100; createReq.maxRows = 4096; createReq.commitTime = 3600; @@ -76,10 +77,10 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { { SAlterDbReq alterdbReq = {0}; strcpy(alterdbReq.db, "1.d1"); - alterdbReq.totalBlocks = 12; - alterdbReq.daysToKeep0 = 300; - alterdbReq.daysToKeep1 = 400; - alterdbReq.daysToKeep2 = 500; + alterdbReq.buffer = 12; + alterdbReq.durationToKeep0 = 300; + alterdbReq.durationToKeep1 = 400; + alterdbReq.durationToKeep2 = 500; alterdbReq.fsyncPeriod = 4000; alterdbReq.walLevel = 2; alterdbReq.strict = 2; @@ -130,12 +131,13 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { SCreateDbReq createReq = {0}; strcpy(createReq.db, "1.d2"); createReq.numOfVgroups = 2; - createReq.cacheBlockSize = 16; - createReq.totalBlocks = 10; - createReq.daysPerFile = 1000; - createReq.daysToKeep0 = 3650; - createReq.daysToKeep1 = 3650; - createReq.daysToKeep2 = 3650; + createReq.buffer = -1; + createReq.pageSize = -1; + createReq.pages = -1; + createReq.durationPerFile = 1000; + createReq.durationToKeep0 = 3650; + createReq.durationToKeep1 = 3650; + createReq.durationToKeep2 = 3650; createReq.minRows = 100; createReq.maxRows = 4096; createReq.commitTime = 3600; diff --git a/source/dnode/mnode/impl/test/sma/sma.cpp b/source/dnode/mnode/impl/test/sma/sma.cpp index 96c0c8e9530b5196a9c5d60db6e278f6e95914a8..baa47f3a61931e2cbf4f9132fa5636cf8161df78 100644 --- a/source/dnode/mnode/impl/test/sma/sma.cpp +++ b/source/dnode/mnode/impl/test/sma/sma.cpp @@ -40,12 +40,13 @@ void* MndTestSma::BuildCreateDbReq(const char* dbname, int32_t* pContLen) { SCreateDbReq createReq = {0}; strcpy(createReq.db, dbname); createReq.numOfVgroups = 2; - createReq.cacheBlockSize = 16; - createReq.totalBlocks = 10; - createReq.daysPerFile = 10 * 1440; - createReq.daysToKeep0 = 3650 * 1440; - createReq.daysToKeep1 = 3650 * 1440; - createReq.daysToKeep2 = 3650 * 1440; + createReq.buffer = -1; + createReq.pageSize = -1; + createReq.pages = -1; + createReq.durationPerFile = 10 * 1440; + createReq.durationToKeep0 = 3650 * 1440; + createReq.durationToKeep1 = 3650 * 1440; + createReq.durationToKeep2 = 3650 * 1440; createReq.minRows = 100; createReq.maxRows = 4096; createReq.commitTime = 3600; diff --git a/source/dnode/mnode/impl/test/stb/stb.cpp b/source/dnode/mnode/impl/test/stb/stb.cpp index 0c54091aa9b9111947bf0342102566cd8e692ab5..631fb8ccf6c9dad90379c82f5c755b2170dc31a7 100644 --- a/source/dnode/mnode/impl/test/stb/stb.cpp +++ b/source/dnode/mnode/impl/test/stb/stb.cpp @@ -41,12 +41,13 @@ void* MndTestStb::BuildCreateDbReq(const char* dbname, int32_t* pContLen) { SCreateDbReq createReq = {0}; strcpy(createReq.db, dbname); createReq.numOfVgroups = 2; - createReq.cacheBlockSize = 16; - createReq.totalBlocks = 10; - createReq.daysPerFile = 1000; - createReq.daysToKeep0 = 3650; - createReq.daysToKeep1 = 3650; - createReq.daysToKeep2 = 3650; + createReq.buffer = -1; + createReq.pageSize = -1; + createReq.pages = -1; + createReq.durationPerFile = 1000; + createReq.durationToKeep0 = 3650; + createReq.durationToKeep1 = 3650; + createReq.durationToKeep2 = 3650; createReq.minRows = 100; createReq.maxRows = 4096; createReq.commitTime = 3600; @@ -344,7 +345,6 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) { EXPECT_EQ(metaRsp.numOfTags, 3); EXPECT_EQ(metaRsp.precision, TSDB_TIME_PRECISION_MILLI); EXPECT_EQ(metaRsp.tableType, TSDB_SUPER_TABLE); - EXPECT_EQ(metaRsp.update, 0); EXPECT_EQ(metaRsp.sversion, 1); EXPECT_EQ(metaRsp.tversion, 0); EXPECT_GT(metaRsp.suid, 0); diff --git a/source/dnode/mnode/impl/test/topic/topic.cpp b/source/dnode/mnode/impl/test/topic/topic.cpp index 917cb23fc9b4cd2cec2204a2b0f6494a638f9b57..9e94ae786064540ca1cb46b207c5e6a2330cf44f 100644 --- a/source/dnode/mnode/impl/test/topic/topic.cpp +++ b/source/dnode/mnode/impl/test/topic/topic.cpp @@ -33,12 +33,13 @@ void* MndTestTopic::BuildCreateDbReq(const char* dbname, int32_t* pContLen) { SCreateDbReq createReq = {0}; strcpy(createReq.db, dbname); createReq.numOfVgroups = 2; - createReq.cacheBlockSize = 16; - createReq.totalBlocks = 10; - createReq.daysPerFile = 10 * 1440; - createReq.daysToKeep0 = 3650 * 1440; - createReq.daysToKeep1 = 3650 * 1440; - createReq.daysToKeep2 = 3650 * 1440; + createReq.buffer = -1; + createReq.pageSize = -1; + createReq.pages = -1; + createReq.durationPerFile = 10 * 1440; + createReq.durationToKeep0 = 3650 * 1440; + createReq.durationToKeep1 = 3650 * 1440; + createReq.durationToKeep2 = 3650 * 1440; createReq.minRows = 100; createReq.maxRows = 4096; createReq.commitTime = 3600; diff --git a/source/dnode/mnode/impl/test/user/user.cpp b/source/dnode/mnode/impl/test/user/user.cpp index 79464db134c1b1b6f842a68a72351ddfabf92716..dd15c0566a31e668e88bb7beb5c28b22b34973fb 100644 --- a/source/dnode/mnode/impl/test/user/user.cpp +++ b/source/dnode/mnode/impl/test/user/user.cpp @@ -286,12 +286,13 @@ TEST_F(MndTestUser, 03_Alter_User) { SCreateDbReq createReq = {0}; strcpy(createReq.db, "1.d2"); createReq.numOfVgroups = 2; - createReq.cacheBlockSize = 16; - createReq.totalBlocks = 10; - createReq.daysPerFile = 10 * 1440; - createReq.daysToKeep0 = 3650 * 1440; - createReq.daysToKeep1 = 3650 * 1440; - createReq.daysToKeep2 = 3650 * 1440; + createReq.buffer = -1; + createReq.pageSize = -1; + createReq.pages = -1; + createReq.durationPerFile = 10 * 1440; + createReq.durationToKeep0 = 3650 * 1440; + createReq.durationToKeep1 = 3650 * 1440; + createReq.durationToKeep2 = 3650 * 1440; createReq.minRows = 100; createReq.maxRows = 4096; createReq.commitTime = 3600; diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index 714497e786465e7b0403523341c24ecc26c7e03c..3fbbab3ae8904ed7a446ceea98dcf71108f4f4ff 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -64,7 +64,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "durationPerFile", pCfg->tsdbCfg.days) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep0) < 0) return -1; @@ -114,7 +114,7 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (tjsonGetNumberValue(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; if (tjsonGetNumberValue(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; if (tjsonGetNumberValue(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; - if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; + if (tjsonGetNumberValue(pJson, "durationPerFile", pCfg->tsdbCfg.days) < 0) return -1; if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep0) < 0) return -1; diff --git a/source/dnode/vnode/test/tsdbSmaTest.cpp b/source/dnode/vnode/test/tsdbSmaTest.cpp index ab617cb18660bc6663b500d7ef9da60a5c2d9fa5..963e3599de59d98c454c5a4dba5e45d42d2a7846 100644 --- a/source/dnode/vnode/test/tsdbSmaTest.cpp +++ b/source/dnode/vnode/test/tsdbSmaTest.cpp @@ -342,7 +342,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { pTsdb->pMeta = pMeta; pTsdb->vgId = 2; - pTsdb->config.daysPerFile = 10; // default days is 10 + pTsdb->config.durationPerFile = 10; // default days is 10 pTsdb->config.keep1 = 30; pTsdb->config.keep2 = 90; pTsdb->config.keep = 365; diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp index 1045acbe939417ed94a1a13f15c561797702146c..dafe10bcb2421ff7bab71bd89613040e6a85554e 100644 --- a/source/libs/catalog/test/catalogTests.cpp +++ b/source/libs/catalog/test/catalogTests.cpp @@ -97,12 +97,13 @@ void sendCreateDbMsg(void *shandle, SEpSet *pEpSet) { SCreateDbReq createReq = {0}; strcpy(createReq.db, "1.db1"); createReq.numOfVgroups = 2; - createReq.cacheBlockSize = 16; - createReq.totalBlocks = 10; - createReq.daysPerFile = 10; - createReq.daysToKeep0 = 3650; - createReq.daysToKeep1 = 3650; - createReq.daysToKeep2 = 3650; + createReq.buffer = -1; + createReq.pageSize = -1; + createReq.pages = -1; + createReq.durationPerFile = 10; + createReq.durationToKeep0 = 3650; + createReq.durationToKeep1 = 3650; + createReq.durationToKeep2 = 3650; createReq.minRows = 100; createReq.maxRows = 4096; createReq.commitTime = 3600; @@ -254,7 +255,6 @@ void ctgTestBuildSTableMetaRsp(STableMetaRsp *rspMsg) { rspMsg->numOfColumns = ctgTestColNum; rspMsg->precision = 1 + 1; rspMsg->tableType = TSDB_SUPER_TABLE; - rspMsg->update = 1 + 1; rspMsg->sversion = ctgTestSVersion + 1; rspMsg->tversion = ctgTestTVersion + 1; rspMsg->suid = ctgTestSuid + 1; @@ -333,7 +333,6 @@ void ctgTestRspTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg * metaRsp.numOfColumns = ctgTestColNum; metaRsp.precision = 1; metaRsp.tableType = TSDB_NORMAL_TABLE; - metaRsp.update = 1; metaRsp.sversion = ctgTestSVersion; metaRsp.tversion = ctgTestTVersion; metaRsp.suid = 0; @@ -379,7 +378,6 @@ void ctgTestRspCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg metaRsp.numOfColumns = ctgTestColNum; metaRsp.precision = 1; metaRsp.tableType = TSDB_CHILD_TABLE; - metaRsp.update = 1; metaRsp.sversion = ctgTestSVersion; metaRsp.tversion = ctgTestTVersion; metaRsp.suid = 0x0000000000000002; @@ -426,7 +424,6 @@ void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg metaRsp.numOfColumns = ctgTestColNum; metaRsp.precision = 1; metaRsp.tableType = TSDB_SUPER_TABLE; - metaRsp.update = 1; metaRsp.sversion = ctgTestSVersion; metaRsp.tversion = ctgTestTVersion; metaRsp.suid = ctgTestSuid; @@ -475,7 +472,6 @@ void ctgTestRspMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRp metaRsp.numOfColumns = ctgTestColNum; metaRsp.precision = 1; metaRsp.tableType = TSDB_SUPER_TABLE; - metaRsp.update = 1; metaRsp.sversion = ctgTestSVersion; metaRsp.tversion = ctgTestTVersion; metaRsp.suid = ctgTestSuid + idx; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index e74a5ad6a9d111fcae0a84dee88455f57ff6ac1c..5c9ce86ff4e5f312875b12823e6ba1b6e8795a27 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1519,12 +1519,12 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameGetFullDbName(&name, pReq->db); pReq->numOfVgroups = GET_OPTION_VAL(pStmt->pOptions->pNumOfVgroups, TSDB_DEFAULT_VN_PER_DB); - pReq->cacheBlockSize = GET_OPTION_VAL(pStmt->pOptions->pCacheBlockSize, TSDB_DEFAULT_CACHE_BLOCK_SIZE); - pReq->totalBlocks = GET_OPTION_VAL(pStmt->pOptions->pNumOfBlocks, TSDB_DEFAULT_TOTAL_BLOCKS); - pReq->daysPerFile = GET_OPTION_VAL(pStmt->pOptions->pDaysPerFile, TSDB_DEFAULT_DAYS_PER_FILE); - pReq->daysToKeep0 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 0), TSDB_DEFAULT_KEEP); - pReq->daysToKeep1 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 1), TSDB_DEFAULT_KEEP); - pReq->daysToKeep2 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 2), TSDB_DEFAULT_KEEP); + pReq->buffer = GET_OPTION_VAL(pStmt->pOptions->pCacheBlockSize, TSDB_DEFAULT_BUFFER_SIZE); + pReq->pages = GET_OPTION_VAL(pStmt->pOptions->pNumOfBlocks, TSDB_DEFAULT_TOTAL_PAGES); + pReq->durationPerFile = GET_OPTION_VAL(pStmt->pOptions->pDaysPerFile, TSDB_DEFAULT_DURATION_PER_FILE); + pReq->durationToKeep0 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 0), TSDB_DEFAULT_KEEP); + pReq->durationToKeep1 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 1), TSDB_DEFAULT_KEEP); + pReq->durationToKeep2 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 2), TSDB_DEFAULT_KEEP); pReq->minRows = GET_OPTION_VAL(pStmt->pOptions->pMinRowsPerBlock, TSDB_DEFAULT_MINROWS_FBLOCK); pReq->maxRows = GET_OPTION_VAL(pStmt->pOptions->pMaxRowsPerBlock, TSDB_DEFAULT_MAXROWS_FBLOCK); pReq->commitTime = -1; @@ -1656,16 +1656,16 @@ static int32_t checkKeepOption(STranslateContext* pCxt, SNodeList* pKeep) { pKeep2->unit); } - int32_t daysToKeep0 = getBigintFromValueNode(pKeep0); - int32_t daysToKeep1 = getBigintFromValueNode(pKeep1); - int32_t daysToKeep2 = getBigintFromValueNode(pKeep2); - if (daysToKeep0 < TSDB_MIN_KEEP || daysToKeep1 < TSDB_MIN_KEEP || daysToKeep2 < TSDB_MIN_KEEP || - daysToKeep0 > TSDB_MAX_KEEP || daysToKeep1 > TSDB_MAX_KEEP || daysToKeep2 > TSDB_MAX_KEEP) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_KEEP_VALUE, daysToKeep0, daysToKeep1, daysToKeep2, + int32_t durationToKeep0 = getBigintFromValueNode(pKeep0); + int32_t durationToKeep1 = getBigintFromValueNode(pKeep1); + int32_t durationToKeep2 = getBigintFromValueNode(pKeep2); + if (durationToKeep0 < TSDB_MIN_KEEP || durationToKeep1 < TSDB_MIN_KEEP || durationToKeep2 < TSDB_MIN_KEEP || + durationToKeep0 > TSDB_MAX_KEEP || durationToKeep1 > TSDB_MAX_KEEP || durationToKeep2 > TSDB_MAX_KEEP) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_KEEP_VALUE, durationToKeep0, durationToKeep1, durationToKeep2, TSDB_MIN_KEEP, TSDB_MAX_KEEP); } - if (!((daysToKeep0 <= daysToKeep1) && (daysToKeep1 <= daysToKeep2))) { + if (!((durationToKeep0 <= durationToKeep1) && (durationToKeep1 <= durationToKeep2))) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_KEEP_ORDER); } @@ -1699,18 +1699,18 @@ static int32_t checkOptionsDependency(STranslateContext* pCxt, const char* pDbNa if (NULL == pOptions->pDaysPerFile && NULL == pOptions->pKeep) { return TSDB_CODE_SUCCESS; } - int64_t daysPerFile = GET_OPTION_VAL(pOptions->pDaysPerFile, alter ? -1 : TSDB_DEFAULT_DAYS_PER_FILE); - int64_t daysToKeep0 = GET_OPTION_VAL(nodesListGetNode(pOptions->pKeep, 0), alter ? -1 : TSDB_DEFAULT_KEEP); - if (alter && (-1 == daysPerFile || -1 == daysToKeep0)) { + int64_t durationPerFile = GET_OPTION_VAL(pOptions->pDaysPerFile, alter ? -1 : TSDB_DEFAULT_DURATION_PER_FILE); + int64_t durationToKeep0 = GET_OPTION_VAL(nodesListGetNode(pOptions->pKeep, 0), alter ? -1 : TSDB_DEFAULT_KEEP); + if (alter && (-1 == durationPerFile || -1 == durationToKeep0)) { SDbCfgInfo dbCfg; int32_t code = getDBCfg(pCxt, pDbName, &dbCfg); if (TSDB_CODE_SUCCESS != code) { return code; } - daysPerFile = (-1 == daysPerFile ? dbCfg.daysPerFile : daysPerFile); - daysToKeep0 = (-1 == daysPerFile ? dbCfg.daysToKeep0 : daysToKeep0); + durationPerFile = (-1 == durationPerFile ? dbCfg.durationPerFile : durationPerFile); + durationToKeep0 = (-1 == durationPerFile ? dbCfg.durationToKeep0 : durationToKeep0); } - if (daysPerFile > daysToKeep0) { + if (durationPerFile > durationToKeep0) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DAYS_VALUE); } return TSDB_CODE_SUCCESS; @@ -1719,10 +1719,10 @@ static int32_t checkOptionsDependency(STranslateContext* pCxt, const char* pDbNa static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName, SDatabaseOptions* pOptions, bool alter) { int32_t code = - checkRangeOption(pCxt, "totalBlocks", pOptions->pNumOfBlocks, TSDB_MIN_TOTAL_BLOCKS, TSDB_MAX_TOTAL_BLOCKS); + checkRangeOption(pCxt, "totalBlocks", pOptions->pNumOfBlocks, TSDB_MIN_TOTAL_PAGES, TSDB_MAX_TOTAL_PAGES); if (TSDB_CODE_SUCCESS == code) { - code = checkRangeOption(pCxt, "cacheBlockSize", pOptions->pCacheBlockSize, TSDB_MIN_CACHE_BLOCK_SIZE, - TSDB_MAX_CACHE_BLOCK_SIZE); + code = checkRangeOption(pCxt, "cacheBlockSize", pOptions->pCacheBlockSize, TSDB_MIN_BUFFER_SIZE, + TSDB_MAX_BUFFER_SIZE); } if (TSDB_CODE_SUCCESS == code) { code = checkRangeOption(pCxt, "cacheLast", pOptions->pCachelast, TSDB_MIN_DB_CACHE_LAST_ROW, @@ -1733,7 +1733,7 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName } if (TSDB_CODE_SUCCESS == code) { code = - checkRangeOption(pCxt, "daysPerFile", pOptions->pDaysPerFile, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE); + checkRangeOption(pCxt, "durationPerFile", pOptions->pDaysPerFile, TSDB_MIN_DURATION_PER_FILE, TSDB_MAX_DURATION_PER_FILE); } if (TSDB_CODE_SUCCESS == code) { code = checkRangeOption(pCxt, "fsyncPeriod", pOptions->pFsyncPeriod, TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD); @@ -1836,10 +1836,10 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt, SName name = {0}; tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameGetFullDbName(&name, pReq->db); - pReq->totalBlocks = GET_OPTION_VAL(pStmt->pOptions->pNumOfBlocks, -1); - pReq->daysToKeep0 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 0), -1); - pReq->daysToKeep1 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 1), -1); - pReq->daysToKeep2 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 2), -1); + pReq->buffer = GET_OPTION_VAL(pStmt->pOptions->pNumOfBlocks, -1); + pReq->durationToKeep0 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 0), -1); + pReq->durationToKeep1 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 1), -1); + pReq->durationToKeep2 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 2), -1); pReq->fsyncPeriod = GET_OPTION_VAL(pStmt->pOptions->pFsyncPeriod, -1); pReq->walLevel = GET_OPTION_VAL(pStmt->pOptions->pWalLevel, -1); pReq->strict = GET_OPTION_VAL(pStmt->pOptions->pQuorum, -1);