From 66cb3e1576e72814bfea3989b5d51f65ae6b7094 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Mon, 3 Jun 2024 11:38:05 +0000 Subject: [PATCH 1/3] fix invalid read --- source/libs/transport/src/transCli.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 9a29444d2d..d12061e824 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -348,6 +348,7 @@ bool cliConnSendSeqMsg(int64_t refId, SCliConn* conn) { taosWLockLatch(&exh->latch); if (exh->handle == NULL) exh->handle = conn; exh->inited = 1; + exh->pThrd = conn->hostThrd; if (!QUEUE_IS_EMPTY(&exh->q)) { queue* h = QUEUE_HEAD(&exh->q); QUEUE_REMOVE(h); @@ -2514,7 +2515,7 @@ static FORCE_INLINE SCliThrd* transGetWorkThrdFromHandle(STrans* trans, int64_t if (exh == NULL) { return NULL; } - + taosWLockLatch(&exh->latch); if (exh->pThrd == NULL && trans != NULL) { int idx = cliRBChoseIdx(trans); if (idx < 0) return NULL; @@ -2522,7 +2523,9 @@ static FORCE_INLINE SCliThrd* transGetWorkThrdFromHandle(STrans* trans, int64_t } pThrd = exh->pThrd; + taosWUnLockLatch(&exh->latch); transReleaseExHandle(transGetRefMgt(), handle); + return pThrd; } SCliThrd* transGetWorkThrd(STrans* trans, int64_t handle) { From e66482c8a544f8a16eb93b911753d7b05f0dbf11 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Thu, 6 Jun 2024 18:28:22 +0800 Subject: [PATCH 2/3] fix: case coverage add column --- tests/army/storage/compressBasic.py | 50 +++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/tests/army/storage/compressBasic.py b/tests/army/storage/compressBasic.py index 48254fe3ac..64d0d4148f 100644 --- a/tests/army/storage/compressBasic.py +++ b/tests/army/storage/compressBasic.py @@ -48,6 +48,15 @@ class TDTestCase(TBase): "bigint","bigint unsigned","timestamp","bool","float","double","binary(16)","nchar(16)", "varchar(16)","varbinary(16)"] + # encode + encodes = [ + [["tinyint","tinyint unsigned","smallint","smallint unsigned","int","int unsigned","bigint","bigint unsigned"], ["simple8B"]], + [["timestamp","bigint","bigint unsigned"], ["Delta-i"]], + [["bool"], ["Bit-packing"]], + [["float","double"], ["Delta-d"]] + ] + + def combineValid(self, datatype, encode, compress): if datatype != "float" and datatype != "double": if compress == "tsz": @@ -55,13 +64,6 @@ class TDTestCase(TBase): return True def genAllSqls(self, stbName, max): - # encode - encodes = [ - [["tinyint","tinyint unsigned","smallint","smallint unsigned","int","int unsigned","bigint","bigint unsigned"], ["simple8B"]], - [["timestamp","bigint","bigint unsigned"], ["Delta-i"]], - [["bool"], ["Bit-packing"]], - [["float","double"], ["Delta-d"]] - ] c = 0 # column number t = 0 # table number @@ -70,7 +72,7 @@ class TDTestCase(TBase): sql = "" # loop append sqls - for lines in encodes: + for lines in self.encodes: for datatype in lines[0]: for encode in lines[1]: for compress in self.compresses: @@ -217,7 +219,34 @@ class TDTestCase(TBase): "alter table db.errstb modify column c3 compress 'xz';" ] tdSql.errors(sqls) - + + # add column + def checkAddColumn(self): + c = 0 + tbname = f"{self.db}.tbadd" + sql = f"create table {tbname}(ts timestamp, c0 int) tags(area int);" + tdSql.execute(sql) + + # loop append sqls + for lines in self.encodes: + for datatype in lines[0]: + for encode in lines[1]: + for compress in self.compresses: + for level in self.levels: + if self.combineValid(datatype, encode, compress): + sql = f"alter table {tbname} add column col{c} {datatype} ENCODE '{encode}' COMPRESS '{compress}' LEVEL '{level}';" + tdSql.execute(sql, 3, True) + c += 1 + + # alter error + sqls = [ + f"alter table {tbname} add column a1 int ENCODE 'simple8bAA';", + f"alter table {tbname} add column a2 int COMPRESS 'AABB';", + f"alter table {tbname} add column a3 bigint LEVEL 'high1';", + f"alter table {tbname} add column a4 BINARY(12) ENCODE 'simple8b' LEVEL 'high2';", + f"alter table {tbname} add column a5 VARCHAR(16) ENCODE 'simple8b' COMPRESS 'gzip' LEVEL 'high3';" + ] + tdSql.errors(sqls) def validCreate(self): sqls = self.genAllSqls(self.stb, 50) @@ -238,6 +267,9 @@ class TDTestCase(TBase): # check alter and write self.checkAlter() + # check add column + self.checkAddColumn() + def checkCorrect(self): # check data correct tbname = f"{self.db}.{self.stb}" From fa8f1d2389712db63a5a337bd2c01ecd875b2602 Mon Sep 17 00:00:00 2001 From: kailixu Date: Fri, 7 Jun 2024 17:24:36 +0800 Subject: [PATCH 3/3] fix: compile problem for community --- source/dnode/mnode/impl/src/mndGrant.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c index 1dae6ebc81..fa4ab89875 100644 --- a/source/dnode/mnode/impl/src/mndGrant.c +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -36,7 +36,8 @@ static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl if (pShow->numOfRows < 1) { cols = 0; SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - STR_WITH_MAXSIZE_TO_VARSTR(tmp, TD_PRODUCT_NAME, 32); + const char *src = TD_PRODUCT_NAME; + STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); colDataSetVal(pColInfo, numOfRows, tmp, false); GRANT_ITEM_SHOW("unlimited");