Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
codyshao
TDengine
提交
d90df175
T
TDengine
项目概览
codyshao
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
2
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,发现更多精彩内容 >>
提交
d90df175
编写于
3月 13, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
failed to drop vnode in dnodeMgmt
上级
6639ef6e
变更
20
显示空白变更内容
内联
并排
Showing
20 changed file
with
203 addition
and
58 deletion
+203
-58
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+7
-9
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+66
-22
src/dnode/src/dnodeRead.c
src/dnode/src/dnodeRead.c
+2
-0
src/dnode/src/dnodeWrite.c
src/dnode/src/dnodeWrite.c
+9
-5
src/inc/mnode.h
src/inc/mnode.h
+1
-1
src/mnode/src/mgmtChildTable.c
src/mnode/src/mgmtChildTable.c
+1
-1
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+1
-1
src/mnode/src/mgmtMain.c
src/mnode/src/mgmtMain.c
+5
-6
src/mnode/src/mgmtNormalTable.c
src/mnode/src/mgmtNormalTable.c
+1
-1
src/mnode/src/mgmtSuperTable.c
src/mnode/src/mgmtSuperTable.c
+1
-1
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+1
-1
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+1
-1
src/os/darwin/src/tdarwin.c
src/os/darwin/src/tdarwin.c
+1
-1
src/os/linux/src/tlinux.c
src/os/linux/src/tlinux.c
+3
-1
src/os/windows/src/twindows.c
src/os/windows/src/twindows.c
+1
-1
src/util/inc/ihash.h
src/util/inc/ihash.h
+6
-0
src/util/inc/tglobalcfg.h
src/util/inc/tglobalcfg.h
+3
-4
src/util/src/ihash.c
src/util/src/ihash.c
+91
-1
src/util/src/shash.c
src/util/src/shash.c
+1
-1
src/vnode/tsdb/inc/tsdb.h
src/vnode/tsdb/inc/tsdb.h
+1
-0
未找到文件。
src/dnode/src/dnodeMain.c
浏览文件 @
d90df175
...
...
@@ -226,20 +226,18 @@ static void dnodeCheckDataDirOpenned(char *dir) {
static
int32_t
dnodeInitStorage
()
{
struct
stat
dirstat
;
strcpy
(
tsDirectory
,
dataDir
);
if
(
stat
(
dataDir
,
&
dirstat
)
<
0
)
{
mkdir
(
dataDir
,
0755
);
}
char
fileName
[
128
];
sprintf
(
fileName
,
"%s/tsdb"
,
tsDirectory
);
mkdir
(
fileName
,
0755
);
sprintf
(
fileName
,
"%s/data"
,
tsDirectory
);
mkdir
(
fileName
,
0755
);
sprintf
(
tsMgmtDirectory
,
"%s/mgmt"
,
tsDirectory
);
sprintf
(
tsDirectory
,
"%s/tsdb"
,
dataDir
);
sprintf
(
tsMnodeDir
,
"%s/mnode"
,
dataDir
);
sprintf
(
tsVnodeDir
,
"%s/vnode"
,
dataDir
);
sprintf
(
tsDnodeDir
,
"%s/dnode"
,
dataDir
);
mkdir
(
tsMnodeDir
,
0755
);
mkdir
(
tsVnodeDir
,
0755
);
mkdir
(
tsDnodeDir
,
0755
);
dnodeCheckDataDirOpenned
(
data
Dir
);
dnodeCheckDataDirOpenned
(
tsDnode
Dir
);
dPrint
(
"storage directory is initialized"
);
return
0
;
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
d90df175
...
...
@@ -29,6 +29,7 @@
typedef
struct
{
int32_t
vgId
;
// global vnode group ID
int32_t
vnode
;
int32_t
status
;
// status: master, slave, notready, deleting
int32_t
refCount
;
// reference count
int64_t
version
;
...
...
@@ -43,7 +44,7 @@ typedef struct {
static
int32_t
dnodeOpenVnodes
();
static
void
dnodeCleanupVnodes
();
static
int32_t
dnodeOpenVnode
(
int32_t
v
gId
);
static
int32_t
dnodeOpenVnode
(
int32_t
v
node
,
char
*
rootDir
);
static
void
dnodeCleanupVnode
(
SVnodeObj
*
pVnode
);
static
int32_t
dnodeCreateVnode
(
SMDCreateVnodeMsg
*
cfg
);
static
void
dnodeDropVnode
(
SVnodeObj
*
pVnode
);
...
...
@@ -79,7 +80,21 @@ int32_t dnodeInitMgmt() {
}
taosTmrReset
(
dnodeSendStatusMsg
,
500
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
return
dnodeOpenVnodes
();
SMDCreateVnodeMsg
cfg
;
cfg
.
cfg
.
vgId
=
1
;
cfg
.
cfg
.
precision
=
0
;
cfg
.
vnode
=
1
;
cfg
.
cfg
.
maxSessions
=
1000
;
cfg
.
cfg
.
daysPerFile
=
10
;
dnodeCreateVnode
(
&
cfg
);
SVnodeObj
*
pVnode
=
dnodeGetVnode
(
cfg
.
cfg
.
vgId
);
dnodeDropVnode
(
pVnode
);
dnodeOpenVnodes
();
dnodeCleanupVnodes
();
//return dnodeOpenVnodes();
}
void
dnodeCleanupMgmt
()
{
...
...
@@ -149,28 +164,55 @@ void dnodeReleaseVnode(void *pVnode) {
}
static
int32_t
dnodeOpenVnodes
()
{
dPrint
(
"open all vnodes"
);
DIR
*
dir
=
opendir
(
tsVnodeDir
);
if
(
dir
==
NULL
)
{
return
TSDB_CODE_NO_WRITE_ACCESS
;
}
int32_t
numOfVnodes
=
0
;
struct
dirent
*
de
=
NULL
;
while
((
de
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
de
->
d_name
,
"."
)
==
0
||
strcmp
(
de
->
d_name
,
".."
)
==
0
)
continue
;
if
(
de
->
d_type
&
DT_DIR
)
{
if
(
strncmp
(
"vnode"
,
de
->
d_name
,
5
)
!=
0
)
continue
;
int32_t
vnode
=
atoi
(
de
->
d_name
+
5
);
if
(
vnode
==
0
)
continue
;
char
tsdbDir
[
TSDB_FILENAME_LEN
];
sprintf
(
tsdbDir
,
"%s/%s"
,
tsVnodeDir
,
de
->
d_name
);
int32_t
code
=
dnodeOpenVnode
(
vnode
,
tsdbDir
);
if
(
code
==
0
)
{
numOfVnodes
++
;
}
}
}
closedir
(
dir
);
dPrint
(
"all vnodes is opened, num:%d"
,
numOfVnodes
);
return
TSDB_CODE_SUCCESS
;
}
static
void
dnodeCleanupVnodes
()
{
dPrint
(
"clean all vnodes"
);
int32_t
num
=
taosGetIntHashSize
(
tsDnodeVnodesHash
);
taosCleanUpIntHashWithFp
(
tsDnodeVnodesHash
,
dnodeCleanupVnode
);
dPrint
(
"all vnodes is opened, num:%d"
,
num
);
}
static
int32_t
dnodeOpenVnode
(
int32_t
vgId
)
{
char
rootDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
rootDir
,
"%s/vnode%d"
,
tsDirectory
,
vgId
);
static
int32_t
dnodeOpenVnode
(
int32_t
vnode
,
char
*
rootDir
)
{
void
*
pTsdb
=
tsdbOpenRepo
(
rootDir
);
if
(
pTsdb
!=
NULL
)
{
if
(
pTsdb
==
NULL
)
{
dError
(
"failed to open vnode:%d in dir:%s, reason:%s"
,
vnode
,
rootDir
,
tstrerror
(
terrno
));
return
terrno
;
}
//STsdbRepoInfo *tsdbInfo = tsdbGetStatus(pTsdb);
SVnodeObj
vnodeObj
;
vnodeObj
.
vgId
=
vgId
;
vnodeObj
.
vgId
=
vnode
;
//tsdbInfo->tsdbCfg.vgId;
vnodeObj
.
vnode
=
vnode
;
//tsdbInfo->tsdbCfg.tsdbId;
vnodeObj
.
status
=
TSDB_VN_STATUS_NOT_READY
;
vnodeObj
.
refCount
=
1
;
vnodeObj
.
version
=
0
;
vnodeObj
.
version
=
version
;
vnodeObj
.
wworker
=
dnodeAllocateWriteWorker
();
vnodeObj
.
rworker
=
dnodeAllocateReadWorker
();
vnodeObj
.
wal
=
NULL
;
...
...
@@ -181,6 +223,7 @@ static int32_t dnodeOpenVnode(int32_t vgId) {
taosAddIntHash
(
tsDnodeVnodesHash
,
vnodeObj
.
vgId
,
(
char
*
)
(
&
vnodeObj
));
dTrace
(
"open vnode:%d in %s"
,
vnodeObj
.
vnode
,
rootDir
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -209,11 +252,12 @@ static void dnodeCleanupVnode(SVnodeObj *pVnode) {
pVnode
->
tsdb
=
NULL
;
}
taosDeleteIntHash
(
tsDnodeVnodesHash
,
pVnode
->
vgId
);
dTrace
(
"cleanup vnode:%d"
,
pVnode
->
vnode
);
}
static
int32_t
dnodeCreateVnode
(
SMDCreateVnodeMsg
*
pVnodeCfg
)
{
STsdbCfg
tsdbCfg
;
tsdbCfg
.
vgId
=
pVnodeCfg
->
cfg
.
vgId
;
tsdbCfg
.
precision
=
pVnodeCfg
->
cfg
.
precision
;
tsdbCfg
.
tsdbId
=
pVnodeCfg
->
vnode
;
tsdbCfg
.
maxTables
=
pVnodeCfg
->
cfg
.
maxSessions
;
...
...
@@ -224,15 +268,16 @@ static int32_t dnodeCreateVnode(SMDCreateVnodeMsg *pVnodeCfg) {
tsdbCfg
.
maxCacheSize
=
-
1
;
char
rootDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
rootDir
,
"%s/vnode%d"
,
ts
Directory
,
pVnodeCfg
->
cfg
.
vgId
);
sprintf
(
rootDir
,
"%s/vnode%d"
,
ts
VnodeDir
,
pVnodeCfg
->
cfg
.
vgId
);
void
*
pTsdb
=
tsdbCreateRepo
(
rootDir
,
&
tsdbCfg
,
NULL
);
if
(
pTsdb
!
=
NULL
)
{
if
(
pTsdb
=
=
NULL
)
{
return
terrno
;
}
SVnodeObj
vnodeObj
;
vnodeObj
.
vgId
=
pVnodeCfg
->
cfg
.
vgId
;
vnodeObj
.
vnode
=
pVnodeCfg
->
vnode
;
vnodeObj
.
status
=
TSDB_VN_STATUS_NOT_READY
;
vnodeObj
.
refCount
=
1
;
vnodeObj
.
version
=
0
;
...
...
@@ -263,6 +308,7 @@ static void dnodeDropVnode(SVnodeObj *pVnode) {
}
dnodeCleanupVnode
(
pVnode
);
taosDeleteIntHash
(
tsDnodeVnodesHash
,
pVnode
->
vgId
);
}
static
void
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
...
...
@@ -274,14 +320,13 @@ static void dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
pCreate
->
cfg
.
maxSessions
=
htonl
(
pCreate
->
cfg
.
maxSessions
);
pCreate
->
cfg
.
daysPerFile
=
htonl
(
pCreate
->
cfg
.
daysPerFile
);
//
SVnodeObj *pVnodeObj = (SVnodeObj *) taosGetIntHashData(tsDnodeVnodesHash, pCreate->cfg.vgId);
//
if (pVnodeObj != NULL) {
//
rpcRsp.code = TSDB_CODE_SUCCESS;
//
} else {
//
rpcRsp.code = dnodeCreateVnode(pCreate);
//
}
SVnodeObj
*
pVnodeObj
=
(
SVnodeObj
*
)
taosGetIntHashData
(
tsDnodeVnodesHash
,
pCreate
->
cfg
.
vgId
);
if
(
pVnodeObj
!=
NULL
)
{
rpcRsp
.
code
=
TSDB_CODE_SUCCESS
;
}
else
{
rpcRsp
.
code
=
dnodeCreateVnode
(
pCreate
);
}
rpcRsp
.
code
=
TSDB_CODE_SUCCESS
;
rpcSendResponse
(
&
rpcRsp
);
}
...
...
@@ -339,7 +384,6 @@ static void dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) {
// dnodeSendRspToMnode(pConn, msgType + 1, code, NULL, 0);
}
static
void
dnodeSendStatusMsg
(
void
*
handle
,
void
*
tmrId
)
{
taosTmrReset
(
dnodeSendStatusMsg
,
tsStatusInterval
*
1000
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
if
(
tsStatusTimer
==
NULL
)
{
...
...
src/dnode/src/dnodeRead.c
浏览文件 @
d90df175
...
...
@@ -60,11 +60,13 @@ int32_t dnodeInitRead() {
maxThreads
=
tsNumOfCores
*
tsNumOfThreadsPerCore
;
if
(
maxThreads
<=
minThreads
*
2
)
maxThreads
=
2
*
minThreads
;
dPrint
(
"dnode read is opened"
);
return
0
;
}
void
dnodeCleanupRead
()
{
taosCloseQset
(
readQset
);
dPrint
(
"dnode read is closed"
);
}
void
dnodeRead
(
SRpcMsg
*
pMsg
)
{
...
...
src/dnode/src/dnodeWrite.c
浏览文件 @
d90df175
...
...
@@ -76,11 +76,13 @@ int32_t dnodeInitWrite() {
wWorkerPool
.
writeWorker
[
i
].
workerId
=
i
;
}
dPrint
(
"dnode write is opened"
);
return
0
;
}
void
dnodeCleanupWrite
()
{
free
(
wWorkerPool
.
writeWorker
);
dPrint
(
"dnode write is closed"
);
}
void
dnodeWrite
(
SRpcMsg
*
pMsg
)
{
...
...
@@ -145,11 +147,16 @@ void dnodeWrite(SRpcMsg *pMsg) {
void
*
dnodeAllocateWriteWorker
()
{
SWriteWorker
*
pWorker
=
wWorkerPool
.
writeWorker
+
wWorkerPool
.
nextId
;
taos_queue
*
queue
=
taosOpenQueue
(
sizeof
(
SWriteMsg
));
if
(
queue
!=
NULL
)
return
queue
;
if
(
pWorker
->
qset
==
NULL
)
{
pWorker
->
qset
=
taosOpenQset
();
if
(
pWorker
->
qset
==
NULL
)
return
NULL
;
taosAddIntoQset
(
pWorker
->
qset
,
queue
);
wWorkerPool
.
nextId
=
(
wWorkerPool
.
nextId
+
1
)
%
wWorkerPool
.
max
;
pthread_attr_t
thAttr
;
pthread_attr_init
(
&
thAttr
);
pthread_attr_setdetachstate
(
&
thAttr
,
PTHREAD_CREATE_JOINABLE
);
...
...
@@ -158,10 +165,7 @@ void *dnodeAllocateWriteWorker() {
dError
(
"failed to create thread to process read queue, reason:%s"
,
strerror
(
errno
));
taosCloseQset
(
pWorker
->
qset
);
}
}
taos_queue
*
queue
=
taosOpenQueue
(
sizeof
(
SWriteMsg
));
if
(
queue
)
{
}
else
{
taosAddIntoQset
(
pWorker
->
qset
,
queue
);
wWorkerPool
.
nextId
=
(
wWorkerPool
.
nextId
+
1
)
%
wWorkerPool
.
max
;
}
...
...
src/inc/mnode.h
浏览文件 @
d90df175
...
...
@@ -263,7 +263,7 @@ void mgmtStopSystem();
extern
char
version
[];
extern
void
*
tsMgmtTmr
;
extern
char
tsM
gmtDirectory
[];
extern
char
tsM
nodeDir
[];
#ifdef __cplusplus
}
...
...
src/mnode/src/mgmtChildTable.c
浏览文件 @
d90df175
...
...
@@ -198,7 +198,7 @@ int32_t mgmtInitChildTables() {
tsChildTableUpdateSize
=
tObj
.
updateEnd
-
(
int8_t
*
)
&
tObj
;
tsChildTableSdb
=
sdbOpenTable
(
tsMaxTables
,
tsChildTableUpdateSize
,
"ctables"
,
SDB_KEYTYPE_STRING
,
tsM
gmtDirectory
,
mgmtChildTableAction
);
"ctables"
,
SDB_KEYTYPE_STRING
,
tsM
nodeDir
,
mgmtChildTableAction
);
if
(
tsChildTableSdb
==
NULL
)
{
mError
(
"failed to init child table data"
);
return
-
1
;
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
d90df175
...
...
@@ -81,7 +81,7 @@ int32_t mgmtInitDbs() {
SDbObj
tObj
;
tsDbUpdateSize
=
tObj
.
updateEnd
-
(
char
*
)
&
tObj
;
tsDbSdb
=
sdbOpenTable
(
tsMaxDbs
,
tsDbUpdateSize
,
"dbs"
,
SDB_KEYTYPE_STRING
,
tsM
gmtDirectory
,
mgmtDbAction
);
tsDbSdb
=
sdbOpenTable
(
tsMaxDbs
,
tsDbUpdateSize
,
"dbs"
,
SDB_KEYTYPE_STRING
,
tsM
nodeDir
,
mgmtDbAction
);
if
(
tsDbSdb
==
NULL
)
{
mError
(
"failed to init db data"
);
return
-
1
;
...
...
src/mnode/src/mgmtMain.c
浏览文件 @
d90df175
...
...
@@ -31,7 +31,6 @@
#include "mgmtShell.h"
static
int32_t
mgmtCheckMgmtRunning
();
char
tsMgmtDirectory
[
128
]
=
{
0
};
void
*
tsMgmtTmr
=
NULL
;
int32_t
mgmtInitSystem
()
{
...
...
@@ -41,7 +40,7 @@ int32_t mgmtInitSystem() {
}
struct
stat
dirstat
;
bool
fileExist
=
(
stat
(
tsM
gmtDirectory
,
&
dirstat
)
==
0
);
bool
fileExist
=
(
stat
(
tsM
nodeDir
,
&
dirstat
)
==
0
);
bool
asMaster
=
(
strcmp
(
tsMasterIp
,
tsPrivateIp
)
==
0
);
if
(
asMaster
||
fileExist
)
{
...
...
@@ -57,8 +56,8 @@ int32_t mgmtStartSystem() {
mPrint
(
"starting to initialize TDengine mgmt ..."
);
struct
stat
dirstat
;
if
(
stat
(
tsM
gmtDirectory
,
&
dirstat
)
<
0
)
{
mkdir
(
tsM
gmtDirectory
,
0755
);
if
(
stat
(
tsM
nodeDir
,
&
dirstat
)
<
0
)
{
mkdir
(
tsM
nodeDir
,
0755
);
}
if
(
mgmtCheckMgmtRunning
()
!=
0
)
{
...
...
@@ -110,7 +109,7 @@ int32_t mgmtStartSystem() {
return
-
1
;
}
if
(
sdbInitPeers
(
tsM
gmtDirectory
)
<
0
)
{
if
(
sdbInitPeers
(
tsM
nodeDir
)
<
0
)
{
mError
(
"failed to init peers"
);
return
-
1
;
}
...
...
@@ -132,7 +131,7 @@ void mgmtStopSystem() {
}
mgmtCleanUpSystem
();
remove
(
tsM
gmtDirectory
);
remove
(
tsM
nodeDir
);
}
void
mgmtCleanUpSystem
()
{
...
...
src/mnode/src/mgmtNormalTable.c
浏览文件 @
d90df175
...
...
@@ -224,7 +224,7 @@ int32_t mgmtInitNormalTables() {
tsNormalTableUpdateSize
=
tObj
.
updateEnd
-
(
int8_t
*
)
&
tObj
;
tsNormalTableSdb
=
sdbOpenTable
(
tsMaxTables
,
sizeof
(
SNormalTableObj
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
,
"ntables"
,
SDB_KEYTYPE_STRING
,
tsM
gmtDirectory
,
mgmtNormalTableAction
);
"ntables"
,
SDB_KEYTYPE_STRING
,
tsM
nodeDir
,
mgmtNormalTableAction
);
if
(
tsNormalTableSdb
==
NULL
)
{
mError
(
"failed to init ntables data"
);
return
-
1
;
...
...
src/mnode/src/mgmtSuperTable.c
浏览文件 @
d90df175
...
...
@@ -165,7 +165,7 @@ int32_t mgmtInitSuperTables() {
mgmtSuperTableActionInit
();
tsSuperTableSdb
=
sdbOpenTable
(
tsMaxTables
,
tsSuperTableUpdateSize
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
,
"stables"
,
SDB_KEYTYPE_STRING
,
tsM
gmtDirectory
,
mgmtSuperTableAction
);
"stables"
,
SDB_KEYTYPE_STRING
,
tsM
nodeDir
,
mgmtSuperTableAction
);
if
(
tsSuperTableSdb
==
NULL
)
{
mError
(
"failed to init stables data"
);
return
-
1
;
...
...
src/mnode/src/mgmtUser.c
浏览文件 @
d90df175
...
...
@@ -59,7 +59,7 @@ int32_t mgmtInitUsers() {
SUserObj
tObj
;
tsUserUpdateSize
=
tObj
.
updateEnd
-
(
int8_t
*
)
&
tObj
;
tsUserSdb
=
sdbOpenTable
(
tsMaxUsers
,
tsUserUpdateSize
,
"users"
,
SDB_KEYTYPE_STRING
,
tsM
gmtDirectory
,
mgmtUserAction
);
tsUserSdb
=
sdbOpenTable
(
tsMaxUsers
,
tsUserUpdateSize
,
"users"
,
SDB_KEYTYPE_STRING
,
tsM
nodeDir
,
mgmtUserAction
);
if
(
tsUserSdb
==
NULL
)
{
mError
(
"failed to init user data"
);
return
-
1
;
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
d90df175
...
...
@@ -73,7 +73,7 @@ int32_t mgmtInitVgroups() {
mgmtVgroupActionInit
();
tsVgroupSdb
=
sdbOpenTable
(
tsMaxVGroups
,
tsVgUpdateSize
,
"vgroups"
,
SDB_KEYTYPE_AUTO
,
tsM
gmtDirectory
,
mgmtVgroupAction
);
tsVgroupSdb
=
sdbOpenTable
(
tsMaxVGroups
,
tsVgUpdateSize
,
"vgroups"
,
SDB_KEYTYPE_AUTO
,
tsM
nodeDir
,
mgmtVgroupAction
);
if
(
tsVgroupSdb
==
NULL
)
{
mError
(
"failed to init vgroups data"
);
return
-
1
;
...
...
src/os/darwin/src/tdarwin.c
浏览文件 @
d90df175
...
...
@@ -34,7 +34,7 @@
#include "tutil.h"
char
configDir
[
TSDB_FILENAME_LEN
]
=
"/etc/taos"
;
char
ts
Directory
[
TSDB_FILENAME_LEN
]
=
"/var/lib/taos"
;
char
ts
VnodeDir
[
TSDB_FILENAME_LEN
]
=
"/var/lib/taos"
;
char
dataDir
[
TSDB_FILENAME_LEN
]
=
"/var/lib/taos"
;
char
logDir
[
TSDB_FILENAME_LEN
]
=
"~/TDengineLog"
;
char
scriptDir
[
TSDB_FILENAME_LEN
]
=
"/etc/taos"
;
...
...
src/os/linux/src/tlinux.c
浏览文件 @
d90df175
...
...
@@ -35,7 +35,9 @@
#include "ttimer.h"
char
configDir
[
TSDB_FILENAME_LEN
]
=
"/etc/taos"
;
char
tsDirectory
[
TSDB_FILENAME_LEN
]
=
"/var/lib/taos"
;
char
tsVnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsDnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsMnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
dataDir
[
TSDB_FILENAME_LEN
]
=
"/var/lib/taos"
;
char
logDir
[
TSDB_FILENAME_LEN
]
=
"/var/log/taos"
;
char
scriptDir
[
TSDB_FILENAME_LEN
]
=
"/etc/taos"
;
...
...
src/os/windows/src/twindows.c
浏览文件 @
d90df175
...
...
@@ -33,7 +33,7 @@
#include <Winsock2.h>
char
configDir
[
TSDB_FILENAME_LEN
]
=
"C:/TDengine/cfg"
;
char
ts
Directory
[
TSDB_FILENAME_LEN
]
=
"C:/TDengine/data"
;
char
ts
VnodeDir
[
TSDB_FILENAME_LEN
]
=
"C:/TDengine/data"
;
char
logDir
[
TSDB_FILENAME_LEN
]
=
"C:/TDengine/log"
;
char
dataDir
[
TSDB_FILENAME_LEN
]
=
"C:/TDengine/data"
;
char
scriptDir
[
TSDB_FILENAME_LEN
]
=
"C:/TDengine/script"
;
...
...
src/util/inc/ihash.h
浏览文件 @
d90df175
...
...
@@ -34,6 +34,12 @@ char *taosAddIntHash(void *handle, uint64_t key, char *pData);
int32_t
taosHashInt
(
void
*
handle
,
uint64_t
key
);
void
taosCleanUpIntHashWithFp
(
void
*
handle
,
void
(
*
fp
)(
char
*
));
char
*
taosVisitIntHashWithFp
(
void
*
handle
,
int
(
*
fp
)(
char
*
));
int32_t
taosGetIntHashSize
(
void
*
handle
);
#ifdef __cplusplus
}
#endif
...
...
src/util/inc/tglobalcfg.h
浏览文件 @
d90df175
...
...
@@ -50,7 +50,9 @@ extern int tscEmbedded;
extern
int64_t
tsMsPerDay
[
2
];
extern
char
configDir
[];
extern
char
tsDirectory
[];
extern
char
tsVnodeDir
[];
extern
char
tsDnodeDir
[];
extern
char
tsMnodeDir
[];
extern
char
dataDir
[];
extern
char
logDir
[];
extern
char
scriptDir
[];
...
...
@@ -263,9 +265,6 @@ SGlobalConfig *tsGetConfigOption(const char *option);
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
extern
char
tsMgmtDirectory
[];
#ifdef __cplusplus
}
#endif
...
...
src/util/src/ihash.c
浏览文件 @
d90df175
...
...
@@ -186,3 +186,93 @@ void taosCleanUpIntHash(void *handle) {
memset
(
pObj
,
0
,
sizeof
(
IHashObj
));
free
(
pObj
);
}
void
taosCleanUpIntHashWithFp
(
void
*
handle
,
void
(
*
fp
)(
char
*
))
{
IHashObj
*
pObj
;
IHashNode
*
pNode
,
*
pNext
;
pObj
=
(
IHashObj
*
)
handle
;
if
(
pObj
==
NULL
||
pObj
->
maxSessions
<=
0
)
return
;
pthread_mutex_lock
(
&
pObj
->
mutex
);
if
(
pObj
->
hashList
)
{
for
(
int
i
=
0
;
i
<
pObj
->
maxSessions
;
++
i
)
{
pNode
=
pObj
->
hashList
[
i
];
while
(
pNode
)
{
pNext
=
pNode
->
next
;
if
(
fp
!=
NULL
)
fp
(
pNode
->
data
);
free
(
pNode
);
pNode
=
pNext
;
}
}
free
(
pObj
->
hashList
);
}
pthread_mutex_unlock
(
&
pObj
->
mutex
);
pthread_mutex_destroy
(
&
pObj
->
mutex
);
memset
(
pObj
,
0
,
sizeof
(
IHashObj
));
free
(
pObj
);
}
char
*
taosVisitIntHashWithFp
(
void
*
handle
,
int
(
*
fp
)(
char
*
))
{
IHashObj
*
pObj
;
IHashNode
*
pNode
,
*
pNext
;
char
*
pData
=
NULL
;
pObj
=
(
IHashObj
*
)
handle
;
if
(
pObj
==
NULL
||
pObj
->
maxSessions
<=
0
)
return
NULL
;
pthread_mutex_lock
(
&
pObj
->
mutex
);
if
(
pObj
->
hashList
)
{
for
(
int
i
=
0
;
i
<
pObj
->
maxSessions
;
++
i
)
{
pNode
=
pObj
->
hashList
[
i
];
while
(
pNode
)
{
pNext
=
pNode
->
next
;
int
flag
=
fp
(
pNode
->
data
);
if
(
flag
)
{
pData
=
pNode
->
data
;
goto
VisitEnd
;
}
pNode
=
pNext
;
}
}
}
VisitEnd:
pthread_mutex_unlock
(
&
pObj
->
mutex
);
return
pData
;
}
int32_t
taosGetIntHashSize
(
void
*
handle
)
{
IHashObj
*
pObj
;
IHashNode
*
pNode
,
*
pNext
;
char
*
pData
=
NULL
;
int32_t
num
=
0
;
pObj
=
(
IHashObj
*
)
handle
;
if
(
pObj
==
NULL
||
pObj
->
maxSessions
<=
0
)
return
NULL
;
pthread_mutex_lock
(
&
pObj
->
mutex
);
if
(
pObj
->
hashList
)
{
for
(
int
i
=
0
;
i
<
pObj
->
maxSessions
;
++
i
)
{
pNode
=
pObj
->
hashList
[
i
];
while
(
pNode
)
{
pNext
=
pNode
->
next
;
num
++
;
pNode
=
pNext
;
}
}
}
pthread_mutex_unlock
(
&
pObj
->
mutex
);
return
num
;
}
\ No newline at end of file
src/util/src/shash.c
浏览文件 @
d90df175
src/vnode/tsdb/inc/tsdb.h
浏览文件 @
d90df175
...
...
@@ -58,6 +58,7 @@ enum { TSDB_PRECISION_MILLI, TSDB_PRECISION_MICRO, TSDB_PRECISION_NANO };
// the TSDB repository configuration
typedef
struct
{
int8_t
precision
;
int32_t
vgId
;
int32_t
tsdbId
;
int32_t
maxTables
;
// maximum number of tables this repository can have
int32_t
daysPerFile
;
// day per file sharding policy
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录