Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
52fb827f
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
52fb827f
编写于
7月 21, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-972]
上级
348adaa3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
21 deletion
+25
-21
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+15
-17
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+10
-4
未找到文件。
src/mnode/inc/mnodeDef.h
浏览文件 @
52fb827f
...
...
@@ -50,8 +50,8 @@ typedef struct SDnodeObj {
int8_t
alternativeRole
;
// from dnode status msg, 0-any, 1-mgmt, 2-dnode
int8_t
status
;
// set in balance function
int8_t
isMgmt
;
int8_t
reserve1
[
1
4
];
int8_t
updateEnd
[
1
];
int8_t
reserve1
[
1
1
];
int8_t
updateEnd
[
4
];
int32_t
refCount
;
uint32_t
moduleStatus
;
uint32_t
lastReboot
;
// time stamp for last reboot
...
...
@@ -68,8 +68,8 @@ typedef struct SMnodeObj {
int32_t
mnodeId
;
int8_t
reserved0
[
4
];
int64_t
createdTime
;
int8_t
reserved1
[
7
];
int8_t
updateEnd
[
1
];
int8_t
reserved1
[
4
];
int8_t
updateEnd
[
4
];
int32_t
refCount
;
int8_t
role
;
int8_t
reserved2
[
3
];
...
...
@@ -90,8 +90,7 @@ typedef struct SSuperTableObj {
int32_t
tversion
;
int32_t
numOfColumns
;
int32_t
numOfTags
;
int8_t
reserved1
[
3
];
int8_t
updateEnd
[
1
];
int8_t
updateEnd
[
4
];
int32_t
refCount
;
int32_t
numOfTables
;
SSchema
*
schema
;
...
...
@@ -111,8 +110,7 @@ typedef struct {
int32_t
sid
;
int32_t
vgId
;
int32_t
sqlLen
;
int8_t
updateEnd
[
1
];
int8_t
reserved1
[
1
];
int8_t
updateEnd
[
4
];
int32_t
refCount
;
char
*
sql
;
//used by normal table
SSchema
*
schema
;
//used by normal table
...
...
@@ -138,8 +136,8 @@ typedef struct SVgObj {
int8_t
status
;
int8_t
reserved0
[
4
];
SVnodeGid
vnodeGid
[
TSDB_MAX_REPLICA
];
int8_t
reserved1
[
7
];
int8_t
updateEnd
[
1
];
int8_t
reserved1
[
4
];
int8_t
updateEnd
[
4
];
int32_t
refCount
;
int32_t
numOfTables
;
int64_t
totalStorage
;
...
...
@@ -176,8 +174,8 @@ typedef struct SDbObj {
int32_t
cfgVersion
;
SDbCfg
cfg
;
int8_t
status
;
int8_t
reserved1
[
1
4
];
int8_t
updateEnd
[
1
];
int8_t
reserved1
[
1
1
];
int8_t
updateEnd
[
4
];
int32_t
refCount
;
int32_t
numOfVgroups
;
int32_t
numOfTables
;
...
...
@@ -196,8 +194,8 @@ typedef struct SUserObj {
int64_t
createdTime
;
int8_t
superAuth
;
int8_t
writeAuth
;
int8_t
reserved
[
1
3
];
int8_t
updateEnd
[
1
];
int8_t
reserved
[
1
0
];
int8_t
updateEnd
[
4
];
int32_t
refCount
;
struct
SAcctObj
*
pAcct
;
}
SUserObj
;
...
...
@@ -228,11 +226,11 @@ typedef struct SAcctObj {
int64_t
createdTime
;
int32_t
acctId
;
int8_t
status
;
int8_t
reserved0
[
10
];
int8_t
updateEnd
[
1
];
SAcctInfo
acctInfo
;
int8_t
reserved0
[
7
];
int8_t
updateEnd
[
4
];
int32_t
refCount
;
int8_t
reserved1
[
4
];
SAcctInfo
acctInfo
;
pthread_mutex_t
mutex
;
}
SAcctObj
;
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
52fb827f
...
...
@@ -406,7 +406,7 @@ void sdbDecRef(void *handle, void *pObj) {
int32_t
refCount
=
atomic_sub_fetch_32
(
pRefCount
,
1
);
sdbTrace
(
"def ref of table:%s record:%p:%s:%d"
,
pTable
->
tableName
,
pObj
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
int
8_t
*
updateEnd
=
pObj
+
pTable
->
refCountPos
-
1
;
int
32_t
*
updateEnd
=
pObj
+
pTable
->
refCountPos
-
4
;
if
(
refCount
<=
0
&&
*
updateEnd
)
{
sdbTrace
(
"table:%s, record:%p:%s:%d is destroyed"
,
pTable
->
tableName
,
pObj
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
SSdbOper
oper
=
{.
pObj
=
pObj
};
...
...
@@ -472,6 +472,14 @@ static int32_t sdbInsertHash(SSdbTable *pTable, SSdbOper *pOper) {
}
static
int32_t
sdbDeleteHash
(
SSdbTable
*
pTable
,
SSdbOper
*
pOper
)
{
int32_t
*
updateEnd
=
pOper
->
pObj
+
pTable
->
refCountPos
-
4
;
bool
set
=
atomic_val_compare_exchange_32
(
updateEnd
,
0
,
1
)
==
0
;
if
(
!
set
)
{
sdbError
(
"table:%s, failed to delete record:%s from hash, for it already removed"
,
pTable
->
tableName
,
sdbGetKeyStrFromObj
(
pTable
,
pOper
->
pObj
));
return
TSDB_CODE_MND_SDB_OBJ_NOT_THERE
;
}
(
*
pTable
->
deleteFp
)(
pOper
);
void
*
key
=
sdbGetObjKey
(
pTable
,
pOper
->
pObj
);
...
...
@@ -486,8 +494,6 @@ static int32_t sdbDeleteHash(SSdbTable *pTable, SSdbOper *pOper) {
sdbDebug
(
"table:%s, delete record:%s from hash, numOfRows:%"
PRId64
", msg:%p"
,
pTable
->
tableName
,
sdbGetKeyStrFromObj
(
pTable
,
pOper
->
pObj
),
pTable
->
numOfRows
,
pOper
->
pMsg
);
int8_t
*
updateEnd
=
pOper
->
pObj
+
pTable
->
refCountPos
-
1
;
*
updateEnd
=
1
;
sdbDecRef
(
pTable
,
pOper
->
pObj
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -654,7 +660,7 @@ bool sdbCheckRowDeleted(void *pTableInput, void *pRow) {
SSdbTable
*
pTable
=
pTableInput
;
if
(
pTable
==
NULL
)
return
false
;
int
8_t
*
updateEnd
=
pRow
+
pTable
->
refCountPos
-
1
;
int
32_t
*
updateEnd
=
pRow
+
pTable
->
refCountPos
-
4
;
return
(
*
updateEnd
==
1
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录