Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
54b033bb
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
未验证
提交
54b033bb
编写于
6月 24, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
6月 24, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2443 from taosdata/hotfix/crash
crash while drop stable
上级
e3f10342
47c15a9e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
63 addition
and
42 deletion
+63
-42
src/inc/mnode.h
src/inc/mnode.h
+1
-0
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+14
-5
src/mnode/src/mnodeInt.c
src/mnode/src/mnodeInt.c
+1
-0
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+30
-25
tests/script/general/parser/nchar.sim
tests/script/general/parser/nchar.sim
+10
-10
tests/script/loop.sh
tests/script/loop.sh
+7
-2
未找到文件。
src/inc/mnode.h
浏览文件 @
54b033bb
...
...
@@ -48,6 +48,7 @@ typedef struct SMnodeMsg {
struct
SDbObj
*
pDb
;
struct
SVgObj
*
pVgroup
;
struct
STableObj
*
pTable
;
struct
SSuperTableObj
*
pSTable
;
}
SMnodeMsg
;
void
mnodeCreateMsg
(
SMnodeMsg
*
pMsg
,
SRpcMsg
*
rpcMsg
);
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
54b033bb
...
...
@@ -311,6 +311,15 @@ static void mnodeSetDefaultDbCfg(SDbCfg *pCfg) {
if
(
pCfg
->
replications
<
0
)
pCfg
->
replications
=
tsReplications
;
}
static
int32_t
mnodeCreateDbCb
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
SDbObj
*
pDb
=
pMsg
->
pDb
;
if
(
pDb
!=
NULL
)
{
mLPrint
(
"db:%s, is created by %s"
,
pDb
->
name
,
mnodeGetUserFromMsg
(
pMsg
));
}
return
code
;
}
static
int32_t
mnodeCreateDb
(
SAcctObj
*
pAcct
,
SCMCreateDbMsg
*
pCreate
,
void
*
pMsg
)
{
int32_t
code
=
acctCheck
(
pAcct
,
ACCT_GRANT_DB
);
if
(
code
!=
0
)
return
code
;
...
...
@@ -364,18 +373,18 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMs
.
table
=
tsDbSdb
,
.
pObj
=
pDb
,
.
rowSize
=
sizeof
(
SDbObj
),
.
pMsg
=
pMsg
.
pMsg
=
pMsg
,
.
cb
=
mnodeCreateDbCb
};
code
=
sdbInsertRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pDb
);
mLPrint
(
"db:%s, failed to create, reason:%s"
,
pDb
->
name
,
tstrerror
(
code
));
return
code
;
}
else
{
mLPrint
(
"db:%s, is created by %s"
,
pDb
->
name
,
mnodeGetUserFromMsg
(
pMsg
));
if
(
pMsg
!=
NULL
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
return
code
;
}
bool
mnodeCheckIsMonitorDB
(
char
*
db
,
char
*
monitordb
)
{
...
...
src/mnode/src/mnodeInt.c
浏览文件 @
54b033bb
...
...
@@ -54,6 +54,7 @@ void mnodeCleanupMsg(SMnodeMsg *pMsg) {
if
(
pMsg
->
pDb
)
mnodeDecDbRef
(
pMsg
->
pDb
);
if
(
pMsg
->
pVgroup
)
mnodeDecVgroupRef
(
pMsg
->
pVgroup
);
if
(
pMsg
->
pTable
)
mnodeDecTableRef
(
pMsg
->
pTable
);
if
(
pMsg
->
pSTable
)
mnodeDecTableRef
(
pMsg
->
pSTable
);
if
(
pMsg
->
pAcct
)
mnodeDecAcctRef
(
pMsg
->
pAcct
);
if
(
pMsg
->
pDnode
)
mnodeDecDnodeRef
(
pMsg
->
pDnode
);
}
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
54b033bb
...
...
@@ -783,7 +783,7 @@ static int32_t mnodeProcessTableMetaMsg(SMnodeMsg *pMsg) {
static
int32_t
mnodeCreateSuperTableCb
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
SSuperTableObj
*
pTable
=
(
SSuperTableObj
*
)
pMsg
->
pTable
;
if
(
pTable
!=
NULL
)
{
mLPrint
(
"app:%p:%p, stable:%s,
create
result:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
mLPrint
(
"app:%p:%p, stable:%s,
is created in sdb,
result:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
tstrerror
(
code
));
}
...
...
@@ -852,6 +852,15 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
}
}
static
int32_t
mnodeDropSuperTableCb
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
SSuperTableObj
*
pTable
=
(
SSuperTableObj
*
)
pMsg
->
pTable
;
if
(
pTable
!=
NULL
)
{
mLPrint
(
"app:%p:%p, stable:%s, is dropped from sdb, result:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
tstrerror
(
code
));
}
return
code
;
}
static
int32_t
mnodeProcessDropSuperTableMsg
(
SMnodeMsg
*
pMsg
)
{
if
(
pMsg
==
NULL
)
return
TSDB_CODE_MND_APP_ERROR
;
...
...
@@ -882,19 +891,20 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
}
SSdbOper
oper
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
type
=
SDB_OPER_GLOBAL
,
.
table
=
tsSuperTableSdb
,
.
pObj
=
pStable
,
.
pMsg
=
pMsg
.
pObj
=
pStable
,
.
pMsg
=
pMsg
,
.
cb
=
mnodeDropSuperTableCb
};
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
mLPrint
(
"stable:%s, is dropped from sdb, result:%s"
,
pStable
->
info
.
tableId
,
tstrerror
(
code
));
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"app:%p:%p, table:%s, failed to drop, sdb error"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pStable
->
info
.
tableId
);
return
code
;
}
else
{
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
return
code
;
}
static
int32_t
mnodeFindSuperTableTagIndex
(
SSuperTableObj
*
pStable
,
const
char
*
tagName
)
{
...
...
@@ -1596,19 +1606,18 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
STagData
*
pTagData
=
(
STagData
*
)
pCreate
->
schema
;
// it is a tag key
SSuperTableObj
*
pSuper
Table
=
mnodeGetSuperTable
(
pTagData
->
name
);
if
(
p
Super
Table
==
NULL
)
{
if
(
pMsg
->
pSTable
==
NULL
)
pMsg
->
pS
Table
=
mnodeGetSuperTable
(
pTagData
->
name
);
if
(
p
Msg
->
pS
Table
==
NULL
)
{
mError
(
"app:%p:%p, table:%s, corresponding super table:%s does not exist"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pCreate
->
tableId
,
pTagData
->
name
);
mnodeDestroyChildTable
(
pTable
);
return
TSDB_CODE_MND_INVALID_TABLE_NAME
;
}
mnodeDecTableRef
(
pSuperTable
);
pTable
->
suid
=
pSuperTable
->
uid
;
pTable
->
suid
=
pMsg
->
pSTable
->
uid
;
pTable
->
uid
=
(((
uint64_t
)
pTable
->
vgId
)
<<
40
)
+
((((
uint64_t
)
pTable
->
sid
)
&
((
1ul
<<
24
)
-
1ul
))
<<
16
)
+
(
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
));
pTable
->
superTable
=
p
Super
Table
;
pTable
->
superTable
=
p
Msg
->
pS
Table
;
}
else
{
pTable
->
uid
=
(((
uint64_t
)
pTable
->
createdTime
)
<<
16
)
+
(
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
));
pTable
->
sversion
=
0
;
...
...
@@ -1661,9 +1670,10 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
pMsg
->
pTable
=
NULL
;
mError
(
"app:%p:%p, table:%s, update sdb error, reason:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pCreate
->
tableId
,
tstrerror
(
code
));
}
return
code
;
return
code
;
}
else
{
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
}
static
int32_t
mnodeProcessCreateChildTableMsg
(
SMnodeMsg
*
pMsg
)
{
...
...
@@ -1698,12 +1708,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
mTrace
(
"app:%p:%p, table:%s, create table in vgroup, vgId:%d sid:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pCreate
->
tableId
,
pVgroup
->
vgId
,
sid
);
code
=
mnodeDoCreateChildTable
(
pMsg
,
sid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
else
{
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
return
mnodeDoCreateChildTable
(
pMsg
,
sid
);
}
}
else
{
if
(
pMsg
->
pTable
==
NULL
)
pMsg
->
pTable
=
mnodeGetTable
(
pCreate
->
tableId
);
...
...
tests/script/general/parser/nchar.sim
浏览文件 @
54b033bb
...
...
@@ -76,7 +76,7 @@ endi
# insert nchar data with a pair of single quotes
$col = 'NCHAR'
$col_ = NCHAR
sql insert into $tb values (now, $col )
sql insert into $tb values (now
+1s
, $col )
sql select * from $tb order by ts desc
print expected: $col_
print returned: $data01
...
...
@@ -87,7 +87,7 @@ endi
# insert nchar data with a pair of double quotes
$col = "NCHAR"
$col_ = NCHAR
sql insert into $tb values (now, $col )
sql insert into $tb values (now
+2s
, $col )
sql select * from $tb order by ts desc
print expected: $col_
print returned: $data01
...
...
@@ -98,7 +98,7 @@ endi
# insert nchar data without quotes
$col = NCHAR
$col_ = nchar
sql_error insert into $tb values (now, $col )
sql_error insert into $tb values (now
+3s
, $col )
sql select * from $tb order by ts desc
#print expected: $col_
#print returned: $data01
...
...
@@ -107,10 +107,10 @@ sql select * from $tb order by ts desc
#endi
# insert nchar data with space and no quotes
sql_error insert into $tb values (now, n char )
sql_error insert into $tb values (now
+4s
, n char )
# insert nchar data with space and a pair of single quotes
sql insert into $tb values (now, 'NCHAR' )
sql insert into $tb values (now
+5s
, 'NCHAR' )
sql select * from $tb order by ts desc
print expected: NCHAR
print returned: $data01
...
...
@@ -126,7 +126,7 @@ endi
label1:
# insert nchar data with space and a pair of double quotes
sql insert into $tb values (now, "NCHAR" )
sql insert into $tb values (now
+6s
, "NCHAR" )
sql select * from $tb order by ts desc
print expected: N CHAR
print returned: $data01
...
...
@@ -141,7 +141,7 @@ else
endi
label2:
sql insert into $tb values (now, "涛思" )
sql insert into $tb values (now
+7s
, "涛思" )
sql select * from $tb order by ts desc
print expected: 涛思
print returned: $data01
...
...
@@ -150,9 +150,9 @@ if $data01 != 涛思 then
endi
# insert nchar data with a single quote and a double quote
#sql insert into $tb values (now, 'NCHAR")
sql_error insert into $tb values (now, 'NCHAR")
sql_error insert into $tb values (now, 'NCHAR])
#sql insert into $tb values (now
+8s
, 'NCHAR")
sql_error insert into $tb values (now
+9s
, 'NCHAR")
sql_error insert into $tb values (now
+10s
, 'NCHAR])
sql drop table $tb
sql drop table $mt
...
...
tests/script/loop.sh
浏览文件 @
54b033bb
...
...
@@ -30,10 +30,15 @@ done
echo
LOOP_TIMES
${
LOOP_TIMES
}
echo
CMD_NAME
${
CMD_NAME
}
GREEN
=
'\033[1;32m'
GREEN_DARK
=
'\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
for
((
i
=
0
;
i<
$LOOP_TIMES
;
i++
))
do
echo
loop
$i
echo
cmd
$CMD_NAME
echo
-e
$GREEN
loop
$i
$NC
echo
-e
$GREEN
cmd
$CMD_NAME
$NC
$CMD_NAME
sleep
2
done
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录