Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dgr6878
TDengine
提交
115d67e0
T
TDengine
项目概览
dgr6878
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
8
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
115d67e0
编写于
1月 06, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TBASE-1442 #1025
上级
14111fbd
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
53 addition
and
47 deletion
+53
-47
src/inc/taoserror.h
src/inc/taoserror.h
+1
-1
src/inc/tstatus.h
src/inc/tstatus.h
+9
-5
src/rpc/src/tstring.c
src/rpc/src/tstring.c
+2
-2
src/system/detail/src/mgmtDnodeInt.c
src/system/detail/src/mgmtDnodeInt.c
+4
-8
src/system/detail/src/mgmtMeter.c
src/system/detail/src/mgmtMeter.c
+3
-9
src/system/detail/src/vnodeFile.c
src/system/detail/src/vnodeFile.c
+1
-1
src/system/detail/src/vnodeMeter.c
src/system/detail/src/vnodeMeter.c
+10
-4
src/system/detail/src/vnodeStore.c
src/system/detail/src/vnodeStore.c
+16
-12
src/util/src/tstatus.c
src/util/src/tstatus.c
+7
-5
未找到文件。
src/inc/taoserror.h
浏览文件 @
115d67e0
...
...
@@ -91,7 +91,7 @@ extern "C" {
#define TSDB_CODE_INVALID_QHANDLE 70
#define TSDB_CODE_RELATED_TABLES_EXIST 71
#define TSDB_CODE_MONITOR_DB_FORBEIDDEN 72
#define TSDB_CODE_
VG_COMMITLOG_INIT_FAILED
73
#define TSDB_CODE_
NO_DISK_PERMISSIONS
73
#define TSDB_CODE_VG_INIT_FAILED 74
#define TSDB_CODE_DATA_ALREADY_IMPORTED 75
#define TSDB_CODE_OPS_NOT_SUPPORT 76
...
...
src/inc/tstatus.h
浏览文件 @
115d67e0
...
...
@@ -16,16 +16,20 @@
#ifndef TDENGINE_TSTATUS_H
#define TDENGINE_TSTATUS_H
#include "taoserror.h"
#ifdef __cplusplus
extern
"C"
{
#endif
enum
_TSDB_VG_STATUS
{
TSDB_VG_STATUS_READY
,
TSDB_VG_STATUS_IN_PROGRESS
,
TSDB_VG_STATUS_COMMITLOG_INIT_FAILED
,
TSDB_VG_STATUS_INIT_FAILED
,
TSDB_VG_STATUS_FULL
TSDB_VG_STATUS_READY
=
TSDB_CODE_SUCCESS
,
TSDB_VG_STATUS_IN_PROGRESS
=
TSDB_CODE_ACTION_IN_PROGRESS
,
TSDB_VG_STATUS_NO_DISK_PERMISSIONS
=
TSDB_CODE_NO_DISK_PERMISSIONS
,
TSDB_VG_STATUS_SERVER_NO_PACE
=
TSDB_CODE_SERVER_NO_SPACE
,
TSDB_VG_STATUS_SERV_OUT_OF_MEMORY
=
TSDB_CODE_SERV_OUT_OF_MEMORY
,
TSDB_VG_STATUS_INIT_FAILED
=
TSDB_CODE_VG_INIT_FAILED
,
TSDB_VG_STATUS_FULL
=
TSDB_CODE_NO_ENOUGH_DNODES
,
};
enum
_TSDB_DB_STATUS
{
...
...
src/rpc/src/tstring.c
浏览文件 @
115d67e0
...
...
@@ -197,7 +197,7 @@ char *tsError[] = {"success",
"invalid query handle"
,
// 70
"tables related to metric exist"
,
"can't drop monitor database or tables"
,
"
commit log init failed
"
,
"
no disk permissions
"
,
"vgroup init failed"
,
"data is already imported"
,
// 75
"not supported operation"
,
...
...
@@ -234,7 +234,7 @@ char *tsError[] = {"success",
"timestamp disordered in cache block"
,
"timestamp disordered in file block"
,
"invalid commit log"
,
"
server no disk space
"
,
//110
"
no disk space on server
"
,
//110
"only super table has metric meta info"
,
"tags value not unique for join"
,
"invalid submit message"
,
...
...
src/system/detail/src/mgmtDnodeInt.c
浏览文件 @
115d67e0
...
...
@@ -152,19 +152,15 @@ int mgmtProcessVPeersRsp(char *msg, int msgLen, SDnodeObj *pObj) {
return
0
;
}
if
(
pRsp
->
code
==
0
)
{
if
(
pRsp
->
code
==
TSDB_CODE_SUCCESS
)
{
pDb
->
vgStatus
=
TSDB_VG_STATUS_READY
;
mTrace
(
"dnode:%s, db:%s vgroup is created in dnode"
,
taosIpStr
(
pObj
->
privateIp
),
pRsp
->
more
);
return
0
;
}
if
(
pRsp
->
code
==
TSDB_CODE_VG_COMMITLOG_INIT_FAILED
)
{
pDb
->
vgStatus
=
TSDB_VG_STATUS_COMMITLOG_INIT_FAILED
;
mError
(
"dnode:%s, db:%s vgroup commit log init failed, code:%d"
,
taosIpStr
(
pObj
->
privateIp
),
pRsp
->
more
,
pRsp
->
code
);
}
else
{
pDb
->
vgStatus
=
TSDB_VG_STATUS_INIT_FAILED
;
mError
(
"dnode:%s, db:%s vgroup init failed, code:%d"
,
taosIpStr
(
pObj
->
privateIp
),
pRsp
->
more
,
pRsp
->
code
);
}
pDb
->
vgStatus
=
pRsp
->
code
;
mError
(
"dnode:%s, db:%s vgroup init failed, code:%d %s"
,
taosIpStr
(
pObj
->
privateIp
),
pRsp
->
more
,
pRsp
->
code
,
taosGetVgroupStatusStr
(
pDb
->
vgStatus
));
return
0
;
}
...
...
src/system/detail/src/mgmtMeter.c
浏览文件 @
115d67e0
...
...
@@ -657,16 +657,10 @@ int mgmtCreateMeter(SDbObj *pDb, SCreateTableMsg *pCreate) {
return
TSDB_CODE_NO_ENOUGH_DNODES
;
}
if
(
pDb
->
vgStatus
==
TSDB_VG_STATUS_COMMITLOG_INIT_FAILED
)
{
if
(
pDb
->
vgStatus
<
TSDB_VG_STATUS_FULL
&&
pDb
->
vgStatus
>
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mgmtDestroyMeter
(
pMeter
);
mError
(
"table:%s, commit log init failed"
,
pCreate
->
meterId
);
return
TSDB_CODE_VG_COMMITLOG_INIT_FAILED
;
}
if
(
pDb
->
vgStatus
==
TSDB_VG_STATUS_INIT_FAILED
)
{
mgmtDestroyMeter
(
pMeter
);
mError
(
"table:%s, vgroup init failed"
,
pCreate
->
meterId
);
return
TSDB_CODE_VG_INIT_FAILED
;
mError
(
"table:%s, vgroup init failed, reason:%d %s"
,
pCreate
->
meterId
,
pDb
->
vgStatus
,
taosGetVgroupStatusStr
(
pDb
->
vgStatus
));
return
pDb
->
vgStatus
;
}
if
(
pVgroup
==
NULL
)
{
...
...
src/system/detail/src/vnodeFile.c
浏览文件 @
115d67e0
...
...
@@ -1823,7 +1823,7 @@ int vnodeUpdateFileMagic(int vnode, int fileId) {
}
int
vnodeInitFile
(
int
vnode
)
{
int
code
=
0
;
int
code
=
TSDB_CODE_SUCCESS
;
SVnodeObj
*
pVnode
=
vnodeList
+
vnode
;
pVnode
->
maxFiles
=
pVnode
->
cfg
.
daysToKeep
/
pVnode
->
cfg
.
daysPerFile
+
1
;
...
...
src/system/detail/src/vnodeMeter.c
浏览文件 @
115d67e0
...
...
@@ -79,8 +79,14 @@ int vnodeCreateMeterObjFile(int vnode) {
sprintf
(
fileName
,
"%s/vnode%d/meterObj.v%d"
,
tsDirectory
,
vnode
,
vnode
);
fp
=
fopen
(
fileName
,
"w+"
);
if
(
fp
==
NULL
)
{
dError
(
"failed to create vnode:%d file:%s"
,
vnode
,
fileName
);
return
-
1
;
dError
(
"failed to create vnode:%d file:%s, reason:%s"
,
vnode
,
fileName
,
strerror
(
errno
));
if
(
errno
==
EACCES
)
{
return
TSDB_CODE_NO_DISK_PERMISSIONS
;
}
else
if
(
errno
==
ENOSPC
)
{
return
TSDB_CODE_SERVER_NO_SPACE
;
}
else
{
return
TSDB_CODE_VG_INIT_FAILED
;
}
}
else
{
vnodeCreateFileHeader
(
fp
);
vnodeUpdateVnodeFileHeader
(
fp
,
vnodeList
+
vnode
);
...
...
@@ -95,7 +101,7 @@ int vnodeCreateMeterObjFile(int vnode) {
fclose
(
fp
);
}
return
0
;
return
TSDB_CODE_SUCCESS
;
}
FILE
*
vnodeOpenMeterObjFile
(
int
vnode
)
{
...
...
@@ -273,7 +279,7 @@ int vnodeSaveVnodeCfg(int vnode, SVnodeCfg *pCfg, SVPeerDesc *pDesc) {
/* vnodeUpdateFileCheckSum(fp); */
fclose
(
fp
);
return
0
;
return
TSDB_CODE_SUCCESS
;
}
int
vnodeSaveVnodeInfo
(
int
vnode
)
{
...
...
src/system/detail/src/vnodeStore.c
浏览文件 @
115d67e0
...
...
@@ -45,24 +45,24 @@ static int vnodeInitStoreVnode(int vnode) {
pVnode
->
pCachePool
=
vnodeOpenCachePool
(
vnode
);
if
(
pVnode
->
pCachePool
==
NULL
)
{
dError
(
"vid:%d, cache pool init failed."
,
pVnode
->
vnode
);
return
-
1
;
return
TSDB_CODE_SERV_OUT_OF_MEMORY
;
}
if
(
vnodeInitFile
(
vnode
)
<
0
)
{
if
(
vnodeInitFile
(
vnode
)
!=
TSDB_CODE_SUCCESS
)
{
dError
(
"vid:%d, files init failed."
,
pVnode
->
vnode
);
return
-
1
;
return
TSDB_CODE_VG_INIT_FAILED
;
}
if
(
vnodeInitCommit
(
vnode
)
<
0
)
{
if
(
vnodeInitCommit
(
vnode
)
!=
TSDB_CODE_SUCCESS
)
{
dError
(
"vid:%d, commit init failed."
,
pVnode
->
vnode
);
return
-
1
;
return
TSDB_CODE_VG_INIT_FAILED
;
}
pthread_mutex_init
(
&
(
pVnode
->
vmutex
),
NULL
);
dPrint
(
"vid:%d, storage initialized, version:%ld fileId:%d numOfFiles:%d"
,
vnode
,
pVnode
->
version
,
pVnode
->
fileId
,
pVnode
->
numOfFiles
);
return
0
;
return
TSDB_CODE_SUCCESS
;
}
int
vnodeOpenVnode
(
int
vnode
)
{
...
...
@@ -192,16 +192,19 @@ int vnodeCreateVnode(int vnode, SVnodeCfg *pCfg, SVPeerDesc *pDesc) {
mkdir
(
fileName
,
0755
);
vnodeList
[
vnode
].
cfg
=
*
pCfg
;
if
(
vnodeCreateMeterObjFile
(
vnode
)
!=
0
)
{
return
TSDB_CODE_VG_INIT_FAILED
;
int
code
=
vnodeCreateMeterObjFile
(
vnode
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
if
(
vnodeSaveVnodeCfg
(
vnode
,
pCfg
,
pDesc
)
!=
0
)
{
code
=
vnodeSaveVnodeCfg
(
vnode
,
pCfg
,
pDesc
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_VG_INIT_FAILED
;
}
if
(
vnodeInitStoreVnode
(
vnode
)
<
0
)
{
return
TSDB_CODE_VG_COMMITLOG_INIT_FAILED
;
code
=
vnodeInitStoreVnode
(
vnode
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
return
vnodeOpenVnode
(
vnode
);
...
...
@@ -294,7 +297,8 @@ int vnodeInitStore() {
if
(
vnodeInitInfo
()
<
0
)
return
-
1
;
for
(
vnode
=
0
;
vnode
<
TSDB_MAX_VNODES
;
++
vnode
)
{
if
(
vnodeInitStoreVnode
(
vnode
)
<
0
)
{
int
code
=
vnodeInitStoreVnode
(
vnode
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// one vnode is failed to recover from commit log, continue for remain
return
-
1
;
}
...
...
src/util/src/tstatus.c
浏览文件 @
115d67e0
...
...
@@ -19,11 +19,13 @@
const
char
*
taosGetVgroupStatusStr
(
int
vgroupStatus
)
{
switch
(
vgroupStatus
)
{
case
TSDB_VG_STATUS_READY
:
return
"ready"
;
case
TSDB_VG_STATUS_IN_PROGRESS
:
return
"inprogress"
;
case
TSDB_VG_STATUS_COMMITLOG_INIT_FAILED
:
return
"commitlog_init_failed"
;
case
TSDB_VG_STATUS_INIT_FAILED
:
return
"init_failed"
;
case
TSDB_VG_STATUS_FULL
:
return
"full"
;
case
TSDB_VG_STATUS_READY
:
return
tsError
[
vgroupStatus
];
case
TSDB_VG_STATUS_IN_PROGRESS
:
return
tsError
[
vgroupStatus
];
case
TSDB_VG_STATUS_NO_DISK_PERMISSIONS
:
return
tsError
[
vgroupStatus
];
case
TSDB_VG_STATUS_SERVER_NO_PACE
:
return
tsError
[
vgroupStatus
];
case
TSDB_VG_STATUS_SERV_OUT_OF_MEMORY
:
return
tsError
[
vgroupStatus
];
case
TSDB_VG_STATUS_INIT_FAILED
:
return
tsError
[
vgroupStatus
];
case
TSDB_VG_STATUS_FULL
:
return
tsError
[
vgroupStatus
];
default:
return
"undefined"
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录