Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d2f99132
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看板
提交
d2f99132
编写于
11月 13, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get account error while read sdb file
上级
f7908813
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
35 addition
and
29 deletion
+35
-29
include/dnode/mnode/sdb/sdb.h
include/dnode/mnode/sdb/sdb.h
+4
-4
source/dnode/mgmt/src/dnodeMnode.c
source/dnode/mgmt/src/dnodeMnode.c
+1
-1
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+1
-1
source/dnode/mnode/sdb/src/sdb.c
source/dnode/mnode/sdb/src/sdb.c
+0
-4
source/dnode/mnode/sdb/src/sdbFile.c
source/dnode/mnode/sdb/src/sdbFile.c
+15
-5
source/dnode/mnode/sdb/src/sdbHash.c
source/dnode/mnode/sdb/src/sdbHash.c
+14
-14
未找到文件。
include/dnode/mnode/sdb/sdb.h
浏览文件 @
d2f99132
...
...
@@ -116,9 +116,9 @@ typedef enum {
SDB_CLUSTER
=
2
,
SDB_DNODE
=
3
,
SDB_MNODE
=
4
,
SDB_
ACCT
=
5
,
SDB_
USER
=
5
,
SDB_AUTH
=
6
,
SDB_
USER
=
7
,
SDB_
ACCT
=
7
,
SDB_DB
=
8
,
SDB_VGROUP
=
9
,
SDB_STABLE
=
10
,
...
...
@@ -148,9 +148,9 @@ int32_t sdbInit();
void
sdbCleanup
();
void
sdbSetTable
(
SSdbTable
table
);
int32_t
sdbRead
();
int32_t
sdbOpen
();
void
sdbClose
();
int32_t
sdbWrite
(
SSdbRaw
*
pRaw
);
int32_t
sdbCommit
();
int32_t
sdbDeploy
();
void
sdbUnDeploy
();
...
...
source/dnode/mgmt/src/dnodeMnode.c
浏览文件 @
d2f99132
...
...
@@ -536,7 +536,7 @@ static int32_t dnodeOpenMnode() {
SMnodeCfg
cfg
=
{.
replica
=
1
};
cfg
.
replicas
[
0
].
port
=
tsServerPort
;
tstrncpy
(
cfg
.
replicas
[
0
].
fqdn
,
tsLocalFqdn
,
TSDB_FQDN_LEN
);
return
dnodeDeployMnode
(
&
cfg
);
code
=
dnodeDeployMnode
(
&
cfg
);
}
else
{
dInfo
(
"start to open mnode"
);
return
dnodeStartMnode
();
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
d2f99132
...
...
@@ -138,7 +138,7 @@ static int32_t mnodeAllocStartSteps() {
if
(
steps
==
NULL
)
return
-
1
;
taosStepAdd
(
steps
,
"mnode-timer"
,
mnodeInitTimer
,
NULL
);
taosStepAdd
(
steps
,
"mnode-sdb-file"
,
sdb
Read
,
(
CleanupFp
)
sdbCommit
);
taosStepAdd
(
steps
,
"mnode-sdb-file"
,
sdb
Open
,
sdbClose
);
taosStepAdd
(
steps
,
"mnode-balance"
,
mnodeInitBalance
,
mnodeCleanupBalance
);
taosStepAdd
(
steps
,
"mnode-profile"
,
mnodeInitProfile
,
mnodeCleanupProfile
);
taosStepAdd
(
steps
,
"mnode-show"
,
mnodeInitShow
,
mnodeCleanUpShow
);
...
...
source/dnode/mnode/sdb/src/sdb.c
浏览文件 @
d2f99132
...
...
@@ -58,10 +58,6 @@ int32_t sdbInit() {
}
void
sdbCleanup
()
{
if
(
tsSdb
.
curVer
!=
tsSdb
.
lastCommitVer
)
{
sdbCommit
();
}
if
(
tsSdb
.
currDir
!=
NULL
)
{
tfree
(
tsSdb
.
currDir
);
}
...
...
source/dnode/mnode/sdb/src/sdbFile.c
浏览文件 @
d2f99132
...
...
@@ -211,7 +211,7 @@ static int32_t sdbWriteDataFile() {
return
code
;
}
int32_t
sdb
Read
()
{
int32_t
sdb
Open
()
{
mDebug
(
"start to read mnode file"
);
if
(
sdbReadDataFile
()
!=
0
)
{
...
...
@@ -221,9 +221,18 @@ int32_t sdbRead() {
return
0
;
}
int32_t
sdbCommit
()
{
mDebug
(
"start to write mnode file"
);
return
sdbWriteDataFile
();
void
sdbClose
()
{
if
(
tsSdb
.
curVer
!=
tsSdb
.
lastCommitVer
)
{
mDebug
(
"start to write mnode file"
);
sdbWriteDataFile
();
}
for
(
int32_t
i
=
0
;
i
<
SDB_MAX
;
++
i
)
{
SHashObj
*
hash
=
tsSdb
.
hashObjs
[
i
];
if
(
hash
!=
NULL
)
{
taosHashClear
(
hash
);
}
}
}
int32_t
sdbDeploy
()
{
...
...
@@ -235,10 +244,11 @@ int32_t sdbDeploy() {
return
-
1
;
}
if
(
sdb
Commit
()
!=
0
)
{
if
(
sdb
WriteDataFile
()
!=
0
)
{
return
-
1
;
}
sdbClose
();
return
0
;
}
...
...
source/dnode/mnode/sdb/src/sdbHash.c
浏览文件 @
d2f99132
...
...
@@ -55,6 +55,7 @@ static int32_t sdbInsertRow(SHashObj *hash, SSdbRaw *pRaw, SSdbRow *pRow, int32_
if
(
pDstRow
!=
NULL
)
{
terrno
=
TSDB_CODE_SDB_OBJ_ALREADY_THERE
;
taosWUnLockLatch
(
pLock
);
sdbFreeRow
(
pRow
);
return
-
1
;
}
...
...
@@ -64,6 +65,7 @@ static int32_t sdbInsertRow(SHashObj *hash, SSdbRaw *pRaw, SSdbRow *pRow, int32_
if
(
taosHashPut
(
hash
,
pRow
->
pObj
,
keySize
,
&
pRow
,
sizeof
(
void
*
))
!=
0
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
taosWUnLockLatch
(
pLock
);
sdbFreeRow
(
pRow
);
return
-
1
;
}
...
...
@@ -75,6 +77,7 @@ static int32_t sdbInsertRow(SHashObj *hash, SSdbRaw *pRaw, SSdbRow *pRow, int32_
taosWLockLatch
(
pLock
);
taosHashRemove
(
hash
,
pRow
->
pObj
,
keySize
);
taosWUnLockLatch
(
pLock
);
sdbFreeRow
(
pRow
);
return
-
1
;
}
}
...
...
@@ -98,11 +101,10 @@ static int32_t sdbUpdateRow(SHashObj *hash, SSdbRaw *pRaw, SSdbRow *pRow, int32_
SdbUpdateFp
updateFp
=
tsSdb
.
updateFps
[
pRow
->
sdb
];
if
(
updateFp
!=
NULL
)
{
if
((
*
updateFp
)(
pRow
->
pObj
,
pDstRow
->
pObj
)
!=
0
)
{
return
-
1
;
}
(
*
updateFp
)(
pRow
->
pObj
,
pDstRow
->
pObj
);
}
sdbFreeRow
(
pRow
);
return
0
;
}
...
...
@@ -111,23 +113,25 @@ static int32_t sdbDeleteRow(SHashObj *hash, SSdbRaw *pRaw, SSdbRow *pRow, int32_
taosWLockLatch
(
pLock
);
SSdbRow
**
ppDstRow
=
taosHashGet
(
hash
,
pRow
->
pObj
,
keySize
);
if
(
ppDstRow
==
NULL
||
*
ppDstRow
)
{
if
(
ppDstRow
==
NULL
||
*
ppDstRow
==
NULL
)
{
terrno
=
TSDB_CODE_SDB_OBJ_NOT_THERE
;
taosWUnLockLatch
(
pLock
);
sdbFreeRow
(
pRow
);
return
-
1
;
}
SSdbRow
*
pDstRow
=
*
ppDstRow
;
pRow
->
status
=
pRaw
->
status
;
taosHashRemove
(
hash
,
pRow
->
pObj
,
keySize
);
p
Dst
Row
->
status
=
pRaw
->
status
;
taosHashRemove
(
hash
,
p
Dst
Row
->
pObj
,
keySize
);
taosWUnLockLatch
(
pLock
);
SdbDeleteFp
deleteFp
=
tsSdb
.
deleteFps
[
pRow
->
sdb
];
SdbDeleteFp
deleteFp
=
tsSdb
.
deleteFps
[
p
Dst
Row
->
sdb
];
if
(
deleteFp
!=
NULL
)
{
(
void
)(
*
deleteFp
)(
pRow
->
pObj
);
(
void
)(
*
deleteFp
)(
p
Dst
Row
->
pObj
);
}
sdbRelease
(
pRow
->
pObj
);
sdbRelease
(
pDstRow
->
pObj
);
sdbFreeRow
(
pRow
);
return
0
;
}
...
...
@@ -163,11 +167,7 @@ int32_t sdbWriteImp(SSdbRaw *pRaw) {
break
;
}
if
(
code
!=
0
)
{
sdbFreeRow
(
pRow
);
}
return
0
;
return
code
;
}
int32_t
sdbWrite
(
SSdbRaw
*
pRaw
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录