From 943cdd5527aa5cad6ea7a995743f404358f3c870 Mon Sep 17 00:00:00 2001 From: Bomin Zhang Date: Thu, 11 Jun 2020 11:05:20 +0800 Subject: [PATCH] TD-459: TSDB_KEY_LEN other changes: max row length from 65536 to 65535 fix byte order issue in get super table meta --- src/common/inc/tdataformat.h | 14 +++++++------- src/inc/taosdef.h | 4 ++-- src/inc/taosmsg.h | 4 ++-- src/mnode/inc/mnodeDef.h | 2 +- src/mnode/src/mnodeTable.c | 2 +- tests/pytest/table/boundary.py | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h index 0e57c7317e..ea0eb9ff29 100644 --- a/src/common/inc/tdataformat.h +++ b/src/common/inc/tdataformat.h @@ -69,8 +69,8 @@ typedef struct { int version; // version int numOfCols; // Number of columns appended int tlen; // maximum length of a SDataRow without the header part - int16_t flen; // First part length in a SDataRow after the header part - int16_t vlen; // pure value part length, excluded the overhead + uint16_t flen; // First part length in a SDataRow after the header part + uint16_t vlen; // pure value part length, excluded the overhead STColumn columns[]; } STSchema; @@ -107,8 +107,8 @@ typedef struct { int tCols; int nCols; int tlen; - int16_t flen; - int16_t vlen; + uint16_t flen; + uint16_t vlen; int version; STColumn *columns; } STSchemaBuilder; @@ -125,16 +125,16 @@ STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder); * |<--------------------+--------------------------- len ---------------------------------->| * |<-- Head -->|<--------- flen -------------->| | * +---------------------+---------------------------------+---------------------------------+ - * | int16_t | int16_t | | | + * | uint16_t | int16_t | | | * +----------+----------+---------------------------------+---------------------------------+ * | len | sversion | First part | Second part | * +----------+----------+---------------------------------+---------------------------------+ */ typedef void *SDataRow; -#define TD_DATA_ROW_HEAD_SIZE sizeof(int16_t)*2 +#define TD_DATA_ROW_HEAD_SIZE (sizeof(uint16_t) + sizeof(int16_t)) -#define dataRowLen(r) (*(int16_t *)(r)) +#define dataRowLen(r) (*(uint16_t *)(r)) #define dataRowVersion(r) *(int16_t *)POINTER_SHIFT(r, sizeof(int16_t)) #define dataRowTuple(r) POINTER_SHIFT(r, TD_DATA_ROW_HEAD_SIZE) #define dataRowKey(r) (*(TSKEY *)(dataRowTuple(r))) diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index c0b8ba3063..e85b7f89b3 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -209,8 +209,8 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); #define TSDB_MAX_SQL_SHOW_LEN 256 #define TSDB_MAX_ALLOWED_SQL_LEN (8*1024*1024U) // sql length should be less than 8mb -#define TSDB_MAX_BYTES_PER_ROW (TSDB_MAX_COLUMNS * 64) -#define TSDB_MAX_TAGS_LEN 65536 +#define TSDB_MAX_BYTES_PER_ROW 65535 +#define TSDB_MAX_TAGS_LEN 65535 #define TSDB_MAX_TAGS 128 #define TSDB_AUTH_LEN 16 diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index b9384f75fc..b81bc72652 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -753,8 +753,8 @@ typedef struct { char user[TSDB_USER_LEN]; char spi; char encrypt; - char secret[TSDB_KEY_LEN + 1]; - char ckey[TSDB_KEY_LEN + 1]; + char secret[TSDB_KEY_LEN]; + char ckey[TSDB_KEY_LEN]; } SDMAuthMsg, SDMAuthRsp; #pragma pack(pop) diff --git a/src/mnode/inc/mnodeDef.h b/src/mnode/inc/mnodeDef.h index c60c221bcc..51785ea61e 100644 --- a/src/mnode/inc/mnodeDef.h +++ b/src/mnode/inc/mnodeDef.h @@ -204,7 +204,7 @@ typedef struct { typedef struct SAcctObj { char user[TSDB_USER_LEN]; - char pass[TSDB_KEY_LEN + 1]; + char pass[TSDB_KEY_LEN]; SAcctCfg cfg; int32_t acctId; int64_t createdTime; diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index cc747364ed..be8e1910bc 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -1251,10 +1251,10 @@ static int32_t mnodeGetSuperTableMeta(SMnodeMsg *pMsg) { pMeta->contLen = sizeof(STableMetaMsg) + mnodeSetSchemaFromSuperTable(pMeta->schema, pTable); tstrncpy(pMeta->tableId, pTable->info.tableId, sizeof(pMeta->tableId)); + pMsg->rpcRsp.len = pMeta->contLen; pMeta->contLen = htons(pMeta->contLen); pMsg->rpcRsp.rsp = pMeta; - pMsg->rpcRsp.len = pMeta->contLen; mTrace("stable:%s, uid:%" PRIu64 " table meta is retrieved", pTable->info.tableId, pTable->uid); return TSDB_CODE_SUCCESS; diff --git a/tests/pytest/table/boundary.py b/tests/pytest/table/boundary.py index d9f0490ed4..50586b72ff 100644 --- a/tests/pytest/table/boundary.py +++ b/tests/pytest/table/boundary.py @@ -141,7 +141,7 @@ class TDTestCase: tdSql.prepare() # 8 bytes for timestamp - maxRowSize = 65536 - 8 + maxRowSize = 65535 - 8 maxCols = self.getLimitFromSourceCode('TSDB_MAX_COLUMNS') - 1 # for binary cols, 2 bytes are used for length -- GitLab