Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
652600b4
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
652600b4
编写于
3月 24, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix crash
上级
eaec5027
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
54 addition
and
14 deletion
+54
-14
include/common/tmsg.h
include/common/tmsg.h
+10
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+32
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+9
-13
source/dnode/mnode/impl/test/sma/sma.cpp
source/dnode/mnode/impl/test/sma/sma.cpp
+2
-1
tests/script/tsim/db/basic7.sim
tests/script/tsim/db/basic7.sim
+1
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
652600b4
...
@@ -184,6 +184,13 @@ typedef struct SField {
...
@@ -184,6 +184,13 @@ typedef struct SField {
int32_t
bytes
;
int32_t
bytes
;
}
SField
;
}
SField
;
typedef
struct
SRetention
{
int32_t
first
;
int32_t
second
;
int8_t
firstUnit
;
int8_t
secondUnit
;
}
SRetention
;
#pragma pack(push, 1)
#pragma pack(push, 1)
// null-terminated string instead of char array to avoid too many memory consumption in case of more than 1M tableMeta
// null-terminated string instead of char array to avoid too many memory consumption in case of more than 1M tableMeta
...
@@ -506,10 +513,13 @@ typedef struct {
...
@@ -506,10 +513,13 @@ typedef struct {
int8_t
cacheLastRow
;
int8_t
cacheLastRow
;
int8_t
ignoreExist
;
int8_t
ignoreExist
;
int8_t
streamMode
;
int8_t
streamMode
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
// SRetention
}
SCreateDbReq
;
}
SCreateDbReq
;
int32_t
tSerializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
);
int32_t
tSerializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
);
int32_t
tDeserializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
);
int32_t
tDeserializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
);
void
tFreeSCreateDbReq
(
SCreateDbReq
*
pReq
);
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
...
...
source/common/src/tmsg.c
浏览文件 @
652600b4
...
@@ -1542,6 +1542,14 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
...
@@ -1542,6 +1542,14 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
ignoreExist
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
ignoreExist
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
streamMode
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
streamMode
)
<
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
);
if
(
tEncodeI32
(
&
encoder
,
pRetension
->
first
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRetension
->
second
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
firstUnit
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
secondUnit
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
...
@@ -1575,12 +1583,36 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
...
@@ -1575,12 +1583,36 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
ignoreExist
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
ignoreExist
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
streamMode
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
streamMode
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfRetensions
)
<
0
)
return
-
1
;
pReq
->
pRetensions
=
taosArrayInit
(
pReq
->
numOfRetensions
,
sizeof
(
SRetention
));
if
(
pReq
->
pRetensions
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
pReq
->
numOfRetensions
;
++
i
)
{
SRetention
rentension
=
{
0
};
if
(
tDecodeI32
(
&
decoder
,
&
rentension
.
first
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
rentension
.
second
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
rentension
.
firstUnit
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
rentension
.
secondUnit
)
<
0
)
return
-
1
;
if
(
taosArrayPush
(
pReq
->
pRetensions
,
&
rentension
)
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
void
tFreeSCreateDbReq
(
SCreateDbReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
pRetensions
);
pReq
->
pRetensions
=
NULL
;
}
int32_t
tSerializeSAlterDbReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterDbReq
*
pReq
)
{
int32_t
tSerializeSAlterDbReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterDbReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
652600b4
...
@@ -1587,15 +1587,11 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
...
@@ -1587,15 +1587,11 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
if
(
pDb
==
NULL
)
return
0
;
if
(
pDb
==
NULL
)
return
0
;
}
}
tstrncpy
(
prefix
,
pShow
->
db
,
TSDB_DB_FNAME_LEN
);
strcat
(
prefix
,
TS_PATH_DELIMITER
);
int32_t
prefixLen
=
(
int32_t
)
strlen
(
prefix
);
while
(
numOfRows
<
rows
)
{
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_STB
,
pShow
->
pIter
,
(
void
**
)
&
pStb
);
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_STB
,
pShow
->
pIter
,
(
void
**
)
&
pStb
);
if
(
pShow
->
pIter
==
NULL
)
break
;
if
(
pShow
->
pIter
==
NULL
)
break
;
if
(
pStb
->
dbUid
!=
pDb
->
uid
)
{
if
(
p
Db
!=
NULL
&&
p
Stb
->
dbUid
!=
pDb
->
uid
)
{
sdbRelease
(
pSdb
,
pStb
);
sdbRelease
(
pSdb
,
pStb
);
continue
;
continue
;
}
}
...
@@ -1609,12 +1605,12 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
...
@@ -1609,12 +1605,12 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
STR_TO_VARSTR
(
pWrite
,
stbName
);
STR_TO_VARSTR
(
pWrite
,
stbName
);
cols
++
;
cols
++
;
//
char db[TSDB_DB_NAME_LEN] = {0};
char
db
[
TSDB_DB_NAME_LEN
]
=
{
0
};
//
tNameFromString(&name, pStb->db, T_NAME_ACCT|T_NAME_DB);
tNameFromString
(
&
name
,
pStb
->
db
,
T_NAME_ACCT
|
T_NAME_DB
);
//
tNameGetDbName(&name, db);
tNameGetDbName
(
&
name
,
db
);
//
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
//
STR_TO_VARSTR(pWrite, db);
STR_TO_VARSTR
(
pWrite
,
db
);
//
cols++;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
pStb
->
createdTime
;
*
(
int64_t
*
)
pWrite
=
pStb
->
createdTime
;
...
@@ -1627,7 +1623,7 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
...
@@ -1627,7 +1623,7 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
pStb
->
numOfTags
;
*
(
int32_t
*
)
pWrite
=
pStb
->
numOfTags
;
cols
++
;
cols
++
;
#if 0
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
0
;
// number of tables
*
(
int32_t
*
)
pWrite
=
0
;
// number of tables
cols
++
;
cols
++
;
...
@@ -1643,7 +1639,7 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
...
@@ -1643,7 +1639,7 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
STR_TO_VARSTR
(
pWrite
,
""
);
STR_TO_VARSTR
(
pWrite
,
""
);
}
}
cols
++
;
cols
++
;
#endif
numOfRows
++
;
numOfRows
++
;
sdbRelease
(
pSdb
,
pStb
);
sdbRelease
(
pSdb
,
pStb
);
}
}
...
...
source/dnode/mnode/impl/test/sma/sma.cpp
浏览文件 @
652600b4
...
@@ -189,6 +189,7 @@ void* MndTestSma::BuildDropTSmaReq(const char* smaname, int8_t igNotExists, int3
...
@@ -189,6 +189,7 @@ void* MndTestSma::BuildDropTSmaReq(const char* smaname, int8_t igNotExists, int3
}
}
TEST_F
(
MndTestSma
,
01
_Create_Show_Meta_Drop_Restart_Stb
)
{
TEST_F
(
MndTestSma
,
01
_Create_Show_Meta_Drop_Restart_Stb
)
{
#if 0
const char* dbname = "1.d1";
const char* dbname = "1.d1";
const char* stbname = "1.d1.stb";
const char* stbname = "1.d1.stb";
const char* smaname = "1.d1.sma";
const char* smaname = "1.d1.sma";
...
@@ -210,7 +211,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) {
...
@@ -210,7 +211,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) {
test.SendShowRetrieveReq();
test.SendShowRetrieveReq();
EXPECT_EQ(test.GetShowRows(), 1);
EXPECT_EQ(test.GetShowRows(), 1);
}
}
#if 0
{
{
pReq = BuildCreateTSmaReq(smaname, stbname, 0, "expr", "tagsFilter", "sql", "ast", &contLen);
pReq = BuildCreateTSmaReq(smaname, stbname, 0, "expr", "tagsFilter", "sql", "ast", &contLen);
pRsp = test.SendReq(TDMT_MND_CREATE_SMA, pReq, contLen);
pRsp = test.SendReq(TDMT_MND_CREATE_SMA, pReq, contLen);
...
...
tests/script/tsim/db/basic7.sim
浏览文件 @
652600b4
...
@@ -14,6 +14,7 @@ sql insert into tb1 values (now, 1);
...
@@ -14,6 +14,7 @@ sql insert into tb1 values (now, 1);
sql show stables
sql show stables
if $rows != 1 then
if $rows != 1 then
print $rows
return -1
return -1
endi
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录