Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
3d663ad8
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看板
提交
3d663ad8
编写于
11月 19, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor more
上级
8c89576d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
27 deletion
+27
-27
src/common/inc/tdisk.h
src/common/inc/tdisk.h
+2
-2
src/common/src/tdisk.c
src/common/src/tdisk.c
+15
-15
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+2
-2
src/inc/taoserror.h
src/inc/taoserror.h
+8
-8
未找到文件。
src/common/inc/tdisk.h
浏览文件 @
3d663ad8
...
...
@@ -26,8 +26,8 @@
extern
"C"
{
#endif
int
tdInit
Tiers
(
SDiskCfg
*
pDiskCfg
,
int
ndisk
);
void
tdDestroy
Tiers
();
int
tdInit
Mount
(
SDiskCfg
*
pDiskCfg
,
int
ndisk
);
void
tdDestroy
Mount
();
int
tdUpdateDiskInfos
();
void
tdGetPrimaryPath
(
char
*
dst
);
...
...
src/common/src/tdisk.c
浏览文件 @
3d663ad8
...
...
@@ -62,7 +62,7 @@ typedef struct STiers {
static
struct
STiers
tdTiers
;
static
struct
STiers
*
pTiers
=
&
tdTiers
;
int
tdInit
Tiers
(
SDiskCfg
*
pDiskCfg
,
int
ndisk
)
{
int
tdInit
Mount
(
SDiskCfg
*
pDiskCfg
,
int
ndisk
)
{
ASSERT
(
ndisk
>
0
);
memset
((
void
*
)
pTiers
,
0
,
sizeof
(
*
pTiers
));
...
...
@@ -77,26 +77,26 @@ int tdInitTiers(SDiskCfg *pDiskCfg, int ndisk) {
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_NO_LOCK
);
if
(
pTiers
->
map
==
NULL
)
{
terrno
=
TSDB_CODE_COM_OUT_OF_MEMORY
;
tdDestroy
Tiers
();
tdDestroy
Mount
();
return
-
1
;
}
for
(
int
idisk
=
0
;
idisk
<
ndisk
;
idisk
++
)
{
if
(
tdAddDisk
(
pDiskCfg
+
idisk
)
<
0
)
{
tdDestroy
Tiers
();
tdDestroy
Mount
();
return
-
1
;
}
}
if
(
tdCheckTiers
()
<
0
)
{
tdDestroy
Tiers
();
tdDestroy
Mount
();
return
-
1
;
}
return
0
;
}
void
tdDestroy
Tiers
()
{
void
tdDestroy
Mount
()
{
taosHashCleanup
(
pTiers
->
map
);
pTiers
->
map
=
NULL
;
...
...
@@ -144,13 +144,13 @@ static SDisk *tdGetPrimaryDisk() { return DISK_AT(0, 0); }
static
int
tdCheckTiers
()
{
ASSERT
(
pTiers
->
nLevel
>
0
);
if
(
tdGetPrimaryDisk
(
pTiers
)
==
NULL
)
{
terrno
=
TSDB_CODE_
DND
_LACK_PRIMARY_DISK
;
terrno
=
TSDB_CODE_
COM
_LACK_PRIMARY_DISK
;
return
-
1
;
}
for
(
int
i
=
0
;
i
<
pTiers
->
nLevel
;
i
++
)
{
if
(
pTiers
->
tiers
[
i
].
nDisks
==
0
)
{
terrno
=
TSDB_CODE_
DND
_NO_DISK_AT_TIER
;
terrno
=
TSDB_CODE_
COM
_NO_DISK_AT_TIER
;
return
-
1
;
}
}
...
...
@@ -179,7 +179,7 @@ static SDisk *tdAssignDisk(int level) {
}
if
(
pDisk
==
NULL
)
{
terrno
=
TSDB_CODE_
DND
_NO_DISK_SPACE
;
terrno
=
TSDB_CODE_
COM
_NO_DISK_SPACE
;
tdUnLockTiers
(
pTiers
);
return
NULL
;
}
...
...
@@ -266,7 +266,7 @@ static int tdCheckDisk(char *dirName) {
if
(
S_ISDIR
(
pstat
.
st_mode
))
{
return
0
;
}
else
{
terrno
=
TSDB_CODE_
DND
_DISK_NOT_DIRECTORY
;
terrno
=
TSDB_CODE_
COM
_DISK_NOT_DIRECTORY
;
return
-
1
;
}
}
...
...
@@ -292,7 +292,7 @@ static int tdAddDisk(SDiskCfg *pCfg) {
SDisk
*
pDisk
=
NULL
;
if
(
pCfg
->
level
<
0
||
pCfg
->
level
>=
TSDB_MAX_TIERS
)
{
terrno
=
TSDB_CODE_
DND
_INVALID_DISK_TIER
;
terrno
=
TSDB_CODE_
COM
_INVALID_DISK_TIER
;
uError
(
"failed to add disk %s to tier %d level since %s"
,
pCfg
->
dir
,
pCfg
->
level
,
tstrerror
(
terrno
));
return
-
1
;
}
...
...
@@ -306,13 +306,13 @@ static int tdAddDisk(SDiskCfg *pCfg) {
diskid
.
level
=
pCfg
->
level
;
if
(
pTier
->
nDisks
>=
TSDB_MAX_DISKS_PER_TIER
)
{
terrno
=
TSDB_CODE_
DND
_TOO_MANY_DISKS
;
terrno
=
TSDB_CODE_
COM
_TOO_MANY_DISKS
;
uError
(
"failed to add disk %s to tier %d level since %s"
,
pCfg
->
dir
,
pCfg
->
level
,
tstrerror
(
terrno
));
return
-
1
;
}
if
(
tdGetDiskByName
(
dirName
)
!=
NULL
)
{
terrno
=
TSDB_CODE_
DND
_DISK_ALREADY_EXISTS
;
terrno
=
TSDB_CODE_
COM
_DISK_ALREADY_EXISTS
;
uError
(
"failed to add disk %s to tier %d level since %s"
,
pCfg
->
dir
,
pCfg
->
level
,
tstrerror
(
terrno
));
return
-
1
;
}
...
...
@@ -324,13 +324,13 @@ static int tdAddDisk(SDiskCfg *pCfg) {
if
(
pCfg
->
primary
)
{
if
(
pCfg
->
level
!=
0
)
{
terrno
=
TSDB_CODE_
DND
_INVALID_DISK_TIER
;
terrno
=
TSDB_CODE_
COM
_INVALID_DISK_TIER
;
uError
(
"failed to add disk %s to tier %d level since %s"
,
pCfg
->
dir
,
pCfg
->
level
,
tstrerror
(
terrno
));
return
-
1
;
}
if
(
tdGetPrimaryDisk
()
!=
NULL
)
{
terrno
=
TSDB_CODE_
DND
_DUPLICATE_PRIMARY_DISK
;
terrno
=
TSDB_CODE_
COM
_DUPLICATE_PRIMARY_DISK
;
uError
(
"failed to add disk %s to tier %d level since %s"
,
pCfg
->
dir
,
pCfg
->
level
,
tstrerror
(
terrno
));
return
-
1
;
}
...
...
@@ -343,7 +343,7 @@ static int tdAddDisk(SDiskCfg *pCfg) {
}
else
{
diskid
.
did
=
pTier
->
nDisks
+
1
;
if
(
diskid
.
did
>=
TSDB_MAX_DISKS_PER_TIER
)
{
terrno
=
TSDB_CODE_
DND
_TOO_MANY_DISKS
;
terrno
=
TSDB_CODE_
COM
_TOO_MANY_DISKS
;
uError
(
"failed to add disk %s to tier %d level since %s"
,
pCfg
->
dir
,
pCfg
->
level
,
tstrerror
(
terrno
));
return
-
1
;
}
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
3d663ad8
...
...
@@ -183,7 +183,7 @@ static void dnodeCheckDataDirOpenned(char *dir) {
}
static
int32_t
dnodeInitStorage
()
{
if
(
tdInit
Tiers
(
tsDiskCfg
,
tsDiskCfgNum
)
<
0
)
{
if
(
tdInit
Mount
(
tsDiskCfg
,
tsDiskCfgNum
)
<
0
)
{
dError
(
"failed to add disks to dnode tier since %s"
,
tstrerror
(
terrno
));
return
-
1
;
}
...
...
@@ -230,7 +230,7 @@ static int32_t dnodeInitStorage() {
return
0
;
}
static
void
dnodeCleanupStorage
()
{
tdDestroy
Tiers
();
}
static
void
dnodeCleanupStorage
()
{
tdDestroy
Mount
();
}
bool
dnodeIsFirstDeploy
()
{
return
strcmp
(
tsFirst
,
tsLocalEp
)
==
0
;
...
...
src/inc/taoserror.h
浏览文件 @
3d663ad8
...
...
@@ -80,6 +80,14 @@ TAOS_DEFINE_ERROR(TSDB_CODE_REF_ID_REMOVED, 0, 0x0107, "Ref ID is
TAOS_DEFINE_ERROR
(
TSDB_CODE_REF_INVALID_ID
,
0
,
0x0108
,
"Invalid Ref ID"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REF_ALREADY_EXIST
,
0
,
0x0109
,
"Ref is already there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_REF_NOT_EXIST
,
0
,
0x010A
,
"Ref is not there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_COM_INVALID_DISK_TIER
,
0
,
0x010B
,
"Invalid disk tier setting"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_COM_TOO_MANY_DISKS
,
0
,
0x010C
,
"Too many disks in one tier"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_COM_DISK_ALREADY_EXISTS
,
0
,
0x010D
,
"Disk already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_COM_DISK_NOT_DIRECTORY
,
0
,
0x010E
,
"Disk is not a directory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_COM_NO_DISK_SPACE
,
0
,
0x010F
,
"Dnode no disk space"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_COM_DUPLICATE_PRIMARY_DISK
,
0
,
0x0110
,
"Duplicate primary disk"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_COM_LACK_PRIMARY_DISK
,
0
,
0x0111
,
"Lack primary disk"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_COM_NO_DISK_AT_TIER
,
0
,
0x0112
,
"No disk at tier"
)
//client
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_SQL
,
0
,
0x0200
,
"Invalid SQL statement"
)
...
...
@@ -188,14 +196,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_DND_MSG_NOT_PROCESSED, 0, 0x0400, "Message no
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_OUT_OF_MEMORY
,
0
,
0x0401
,
"Dnode out of memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_NO_WRITE_ACCESS
,
0
,
0x0402
,
"No permission for disk files in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_INVALID_MSG_LEN
,
0
,
0x0403
,
"Invalid message length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_INVALID_DISK_TIER
,
0
,
0x0404
,
"Invalid disk tier setting"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_TOO_MANY_DISKS
,
0
,
0x0405
,
"Too many disks in one tier"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_DISK_ALREADY_EXISTS
,
0
,
0x0406
,
"Disk already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_DISK_NOT_DIRECTORY
,
0
,
0x0407
,
"Disk is not a directory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_NO_DISK_SPACE
,
0
,
0x0408
,
"Dnode no disk space"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_DUPLICATE_PRIMARY_DISK
,
0
,
0x0409
,
"Duplicate primary disk"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_LACK_PRIMARY_DISK
,
0
,
0x040A
,
"Lack primary disk"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_NO_DISK_AT_TIER
,
0
,
0x040B
,
"No disk at tier"
)
// vnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_ACTION_IN_PROGRESS
,
0
,
0x0500
,
"Action in progress"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录