Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
42c100df
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
42c100df
编写于
2月 23, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sim config
上级
d9bc65e5
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
64 addition
and
82 deletion
+64
-82
include/common/tep.h
include/common/tep.h
+1
-1
include/common/tglobal.h
include/common/tglobal.h
+0
-3
source/client/src/clientCfg.c
source/client/src/clientCfg.c
+7
-7
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+28
-34
source/client/src/clientMain.c
source/client/src/clientMain.c
+2
-4
source/common/src/tep.c
source/common/src/tep.c
+2
-4
source/common/src/tglobal.c
source/common/src/tglobal.c
+15
-17
source/dnode/mgmt/daemon/src/dmnCfg.c
source/dnode/mgmt/daemon/src/dmnCfg.c
+4
-11
source/dnode/mgmt/daemon/src/dmnMain.c
source/dnode/mgmt/daemon/src/dmnMain.c
+0
-0
source/dnode/mgmt/impl/src/dndMgmt.c
source/dnode/mgmt/impl/src/dndMgmt.c
+1
-1
source/util/src/tlog.c
source/util/src/tlog.c
+4
-0
未找到文件。
include/common/tep.h
浏览文件 @
42c100df
...
...
@@ -23,7 +23,7 @@ typedef struct SBlockOrderInfo {
// bool hasNull;
}
SBlockOrderInfo
;
int
taosGetFqdnPortFromEp
(
const
char
*
ep
,
SEp
*
pEp
);
int
taosGetFqdnPortFromEp
(
const
char
*
ep
,
uint16_t
defaultPort
,
SEp
*
pEp
);
void
addEpIntoEpSet
(
SEpSet
*
pEpSet
,
const
char
*
fqdn
,
uint16_t
port
);
bool
isEpsetEqual
(
const
SEpSet
*
s1
,
const
SEpSet
*
s2
);
...
...
include/common/tglobal.h
浏览文件 @
42c100df
...
...
@@ -100,13 +100,10 @@ extern uint32_t tsMaxRange;
extern
uint32_t
tsCurRange
;
extern
char
tsCompressor
[];
extern
int32_t
tsDiskCfgNum
;
extern
SDiskCfg
tsDiskCfg
[];
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
void
taosInitGlobalCfg
();
int32_t
taosCheckAndPrintCfg
();
int32_t
taosCfgDynamicOptions
(
char
*
msg
);
bool
taosCheckBalanceCfgOptions
(
const
char
*
option
,
int32_t
*
vnodeId
,
int32_t
*
dnodeId
);
void
taosAddDataDir
(
int
index
,
char
*
v1
,
int
level
,
int
primary
);
...
...
source/client/src/clientCfg.c
浏览文件 @
42c100df
...
...
@@ -21,20 +21,20 @@
SConfig
*
tscCfg
;
static
int32_t
tscLoadCfg
(
SConfig
*
pConfig
,
const
char
*
inputCfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
)
{
char
c
onfi
gDir
[
PATH_MAX
]
=
{
0
};
char
c
onfi
gFile
[
PATH_MAX
+
100
]
=
{
0
};
char
c
f
gDir
[
PATH_MAX
]
=
{
0
};
char
c
f
gFile
[
PATH_MAX
+
100
]
=
{
0
};
taosExpandDir
(
inputCfgDir
,
c
onfi
gDir
,
PATH_MAX
);
snprintf
(
c
onfigFile
,
sizeof
(
configFile
),
"%s"
TD_DIRSEP
"taos.cfg"
,
confi
gDir
);
taosExpandDir
(
inputCfgDir
,
c
f
gDir
,
PATH_MAX
);
snprintf
(
c
fgFile
,
sizeof
(
cfgFile
),
"%s"
TD_DIRSEP
"taos.cfg"
,
cf
gDir
);
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_APOLLO_URL
,
apolloUrl
)
!=
0
)
{
uError
(
"failed to load from apollo url:%s since %s
\n
"
,
apolloUrl
,
terrstr
());
return
-
1
;
}
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_CFG_FILE
,
c
onfi
gFile
)
!=
0
)
{
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_CFG_FILE
,
c
onfi
gDir
)
!=
0
)
{
uError
(
"failed to load from config file:%s since %s
\n
"
,
c
onfi
gFile
,
terrstr
());
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_CFG_FILE
,
c
f
gFile
)
!=
0
)
{
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_CFG_FILE
,
c
f
gDir
)
!=
0
)
{
uError
(
"failed to load from config file:%s since %s
\n
"
,
c
f
gFile
,
terrstr
());
return
-
1
;
}
}
...
...
source/client/src/clientImpl.c
浏览文件 @
42c100df
...
...
@@ -12,7 +12,7 @@
#include "tpagedbuf.h"
#include "tref.h"
static
int32_t
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
static
int32_t
initEpSetFromCfg
(
const
char
*
ip
,
uint16_t
port
,
SCorEpSet
*
pEpSet
);
static
SMsgSendInfo
*
buildConnectMsg
(
SRequestObj
*
pRequest
);
static
void
destroySendMsgInfo
(
SMsgSendInfo
*
pMsgBody
);
static
void
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
);
...
...
@@ -81,21 +81,7 @@ TAOS* taos_connect_internal(const char* ip, const char* user, const char* pass,
}
SCorEpSet
epSet
=
{
0
};
if
(
ip
)
{
if
(
initEpSetFromCfg
(
ip
,
NULL
,
&
epSet
)
<
0
)
{
return
NULL
;
}
if
(
port
)
{
epSet
.
epSet
.
eps
[
0
].
port
=
port
;
}
}
else
{
SConfigItem
*
pFirst
=
cfgGetItem
(
tscCfg
,
"firstEp"
);
SConfigItem
*
pSecond
=
cfgGetItem
(
tscCfg
,
"secondEp"
);
if
(
initEpSetFromCfg
(
pFirst
->
str
,
pSecond
->
str
,
&
epSet
)
<
0
)
{
return
NULL
;
}
}
initEpSetFromCfg
(
ip
,
port
,
&
epSet
);
char
*
key
=
getClusterKey
(
user
,
secretEncrypt
,
ip
,
port
);
SAppInstInfo
**
pInst
=
NULL
;
...
...
@@ -284,32 +270,40 @@ _return:
return
pRequest
;
}
int
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
)
{
pEpSet
->
version
=
0
;
int
initEpSetFromCfg
(
const
char
*
ip
,
uint16_t
port
,
SCorEpSet
*
pEpSet
)
{
SConfigItem
*
pFirst
=
cfgGetItem
(
tscCfg
,
"firstEp"
);
SConfigItem
*
pSecond
=
cfgGetItem
(
tscCfg
,
"secondEp"
);
SConfigItem
*
pPort
=
cfgGetItem
(
tscCfg
,
"serverPort"
);
// init mnode ip set
SEpSet
*
mgmtEpSet
=
&
(
pEpSet
->
epSet
);
mgmtEpSet
->
numOfEps
=
0
;
mgmtEpSet
->
inUse
=
0
;
pEpSet
->
version
=
0
;
if
(
firstEp
&&
firstEp
[
0
]
!=
0
)
{
if
(
strlen
(
firstEp
)
>=
TSDB_EP_LEN
)
{
terrno
=
TSDB_CODE_TSC_INVALID_FQDN
;
return
-
1
;
}
taosGetFqdnPortFromEp
(
firstEp
,
&
mgmtEpSet
->
eps
[
0
]);
if
(
ip
!=
NULL
)
{
taosGetFqdnPortFromEp
(
ip
,
(
uint16_t
)
pPort
->
i32
,
&
mgmtEpSet
->
eps
[
0
]);
mgmtEpSet
->
numOfEps
++
;
}
if
(
secondEp
&&
secondEp
[
0
]
!=
0
)
{
if
(
strlen
(
secondEp
)
>=
TSDB_EP_LEN
)
{
terrno
=
TSDB_CODE_TSC_INVALID_FQDN
;
return
-
1
;
if
(
port
)
{
mgmtEpSet
->
eps
[
0
].
port
=
port
;
}
}
else
{
if
(
pFirst
->
str
[
0
]
!=
0
)
{
if
(
strlen
(
pFirst
->
str
)
>=
TSDB_EP_LEN
)
{
terrno
=
TSDB_CODE_TSC_INVALID_FQDN
;
return
-
1
;
}
taosGetFqdnPortFromEp
(
pFirst
->
str
,
(
uint16_t
)
pPort
->
i32
,
&
mgmtEpSet
->
eps
[
0
]);
mgmtEpSet
->
numOfEps
++
;
}
if
(
pSecond
->
str
[
0
]
!=
0
)
{
if
(
strlen
(
pSecond
->
str
)
>=
TSDB_EP_LEN
)
{
terrno
=
TSDB_CODE_TSC_INVALID_FQDN
;
return
-
1
;
}
taosGetFqdnPortFromEp
(
pSecond
->
str
,
(
uint16_t
)
pPort
->
i32
,
&
mgmtEpSet
->
eps
[
1
]);
mgmtEpSet
->
numOfEps
++
;
}
taosGetFqdnPortFromEp
(
secondEp
,
&
mgmtEpSet
->
eps
[
mgmtEpSet
->
numOfEps
]);
mgmtEpSet
->
numOfEps
++
;
}
if
(
mgmtEpSet
->
numOfEps
==
0
)
{
...
...
source/client/src/clientMain.c
浏览文件 @
42c100df
...
...
@@ -56,9 +56,7 @@ void taos_cleanup(void) {
}
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
)
{
int32_t
p
=
(
port
!=
0
)
?
port
:
cfgGetItem
(
tscCfg
,
"serverPort"
)
->
i32
;
tscDebug
(
"try to connect to %s:%u, user:%s db:%s"
,
ip
,
p
,
user
,
db
);
tscDebug
(
"try to connect to %s:%u, user:%s db:%s"
,
ip
,
port
,
user
,
db
);
if
(
user
==
NULL
)
{
user
=
TSDB_DEFAULT_USER
;
}
...
...
@@ -67,7 +65,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
pass
=
TSDB_DEFAULT_PASS
;
}
return
taos_connect_internal
(
ip
,
user
,
pass
,
NULL
,
db
,
p
);
return
taos_connect_internal
(
ip
,
user
,
pass
,
NULL
,
db
,
p
ort
);
}
void
taos_close
(
TAOS
*
taos
)
{
...
...
source/common/src/tep.c
浏览文件 @
42c100df
...
...
@@ -4,7 +4,7 @@
#include "tglobal.h"
#include "tlockfree.h"
int
taosGetFqdnPortFromEp
(
const
char
*
ep
,
SEp
*
pEp
)
{
int
taosGetFqdnPortFromEp
(
const
char
*
ep
,
uint16_t
defaultPort
,
SEp
*
pEp
)
{
pEp
->
port
=
0
;
strcpy
(
pEp
->
fqdn
,
ep
);
...
...
@@ -14,12 +14,10 @@ int taosGetFqdnPortFromEp(const char *ep, SEp* pEp) {
pEp
->
port
=
atoi
(
temp
+
1
);
}
#if 0
if
(
pEp
->
port
==
0
)
{
pEp->port =
tsServer
Port;
pEp
->
port
=
default
Port
;
return
-
1
;
}
#endif
return
0
;
}
...
...
source/common/src/tglobal.c
浏览文件 @
42c100df
...
...
@@ -125,8 +125,6 @@ int8_t tsDeadLockKillQuery = 0;
// For backward compatibility
bool
tsdbForceKeepFile
=
false
;
int32_t
tsDiskCfgNum
=
0
;
#ifndef _STORAGE
SDiskCfg
tsDiskCfg
[
1
];
#else
...
...
@@ -257,21 +255,21 @@ void taosAddDataDir(int index, char *v1, int level, int primary) {
}
#ifndef _STORAGE
void
taosReadDataDirCfg
(
char
*
v1
,
char
*
v2
,
char
*
v3
)
{
if
(
tsDiskCfgNum
==
1
)
{
SDiskCfg
*
cfg
=
&
tsDiskCfg
[
0
];
uInfo
(
"dataDir:%s, level:%d primary:%d is replaced by %s"
,
cfg
->
dir
,
cfg
->
level
,
cfg
->
primary
,
v1
);
}
taosAddDataDir
(
0
,
v1
,
0
,
1
);
tsDiskCfgNum
=
1
;
}
void
taosPrintDataDirCfg
()
{
for
(
int
i
=
0
;
i
<
tsDiskCfgNum
;
++
i
)
{
SDiskCfg
*
cfg
=
&
tsDiskCfg
[
i
];
uInfo
(
" dataDir: %s"
,
cfg
->
dir
);
}
}
//
void taosReadDataDirCfg(char *v1, char *v2, char *v3) {
//
if (tsDiskCfgNum == 1) {
//
SDiskCfg *cfg = &tsDiskCfg[0];
//
uInfo("dataDir:%s, level:%d primary:%d is replaced by %s", cfg->dir, cfg->level, cfg->primary, v1);
//
}
//
taosAddDataDir(0, v1, 0, 1);
//
tsDiskCfgNum = 1;
//
}
//
void taosPrintDataDirCfg() {
//
for (int i = 0; i < tsDiskCfgNum; ++i) {
//
SDiskCfg *cfg = &tsDiskCfg[i];
//
uInfo(" dataDir: %s", cfg->dir);
//
}
//
}
#endif
...
...
source/dnode/mgmt/daemon/src/dmnCfg.c
浏览文件 @
42c100df
...
...
@@ -47,13 +47,6 @@ static int32_t dmnAddDirCfg(SConfig *pCfg) {
static
int32_t
dmnCheckDirCfg
(
SConfig
*
pCfg
)
{
SConfigItem
*
pItem
=
NULL
;
pItem
=
cfgGetItem
(
pCfg
,
"dataDir"
);
if
(
tsDiskCfgNum
<=
0
)
{
taosAddDataDir
(
0
,
pItem
->
str
,
0
,
1
);
tsDiskCfgNum
=
1
;
uTrace
(
"dataDir:%s, level:0 primary:1 is configured by default"
,
pItem
->
str
);
}
pItem
=
cfgGetItem
(
pCfg
,
"tmpDir"
);
if
(
taosDirExist
(
pItem
->
str
)
!=
0
)
{
return
-
1
;
...
...
@@ -204,12 +197,12 @@ SDnodeObjCfg dmnGetObjCfg(SConfig *pCfg) {
objCfg
.
ratioOfQueryCores
=
cfgGetItem
(
pCfg
,
"ratioOfQueryCores"
)
->
fval
;
objCfg
.
maxShellConns
=
cfgGetItem
(
pCfg
,
"maxShellConns"
)
->
i32
;
objCfg
.
shellActivityTimer
=
cfgGetItem
(
pCfg
,
"shellActivityTimer"
)
->
i32
;
objCfg
.
serverPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
tstrncpy
(
objCfg
.
dataDir
,
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
,
sizeof
(
objCfg
.
dataDir
));
tstrncpy
(
objCfg
.
localEp
,
cfgGetItem
(
pCfg
,
"localEp"
)
->
str
,
sizeof
(
objCfg
.
localEp
));
tstrncpy
(
objCfg
.
localFqdn
,
cfgGetItem
(
pCfg
,
"localFqdn"
)
->
str
,
sizeof
(
objCfg
.
localFqdn
,
cfgGetItem
));
tstrncpy
(
objCfg
.
firstEp
,
cfgGetItem
(
pCfg
,
"firstEp"
)
->
str
,
sizeof
(
objCfg
.
firstEp
));
tstrncpy
(
objCfg
.
secondEp
,
cfgGetItem
(
pCfg
,
"secondEp"
)
->
str
,
sizeof
(
objCfg
.
firstEp
));
objCfg
.
serverPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
tstrncpy
(
objCfg
.
localFqdn
,
cfgGetItem
(
pCfg
,
"fqdn"
)
->
str
,
sizeof
(
objCfg
.
localFqdn
,
cfgGetItem
));
snprintf
(
objCfg
.
localEp
,
sizeof
(
objCfg
.
localEp
),
"%s:%u"
,
objCfg
.
localFqdn
,
objCfg
.
serverPort
);
return
objCfg
;
}
\ No newline at end of file
source/dnode/mgmt/daemon/src/d
aemo
n.c
→
source/dnode/mgmt/daemon/src/d
mnMai
n.c
浏览文件 @
42c100df
文件已移动
source/dnode/mgmt/impl/src/dndMgmt.c
浏览文件 @
42c100df
...
...
@@ -296,7 +296,7 @@ PRASE_DNODE_OVER:
if
(
taosArrayGetSize
(
pMgmt
->
pDnodeEps
)
==
0
)
{
SDnodeEp
dnodeEp
=
{
0
};
dnodeEp
.
isMnode
=
1
;
taosGetFqdnPortFromEp
(
pDnode
->
cfg
.
firstEp
,
&
dnodeEp
.
ep
);
taosGetFqdnPortFromEp
(
pDnode
->
cfg
.
firstEp
,
pDnode
->
cfg
.
serverPort
,
&
dnodeEp
.
ep
);
taosArrayPush
(
pMgmt
->
pDnodeEps
,
&
dnodeEp
);
}
...
...
source/util/src/tlog.c
浏览文件 @
42c100df
...
...
@@ -71,6 +71,7 @@ int8_t tscEmbeddedInUtil = 0;
int32_t
tsLogKeepDays
=
0
;
bool
tsAsyncLog
=
true
;
bool
tsLogInited
=
false
;
float
tsTotalLogDirGB
=
0
;
float
tsAvailLogDirGB
=
0
;
float
tsMinimalLogDirGB
=
1
.
0
f
;
...
...
@@ -120,6 +121,8 @@ static int32_t taosStartLog() {
}
int32_t
taosInitLog
(
const
char
*
logName
,
int
maxFiles
)
{
if
(
tsLogInited
)
return
0
;
char
fullName
[
PATH_MAX
]
=
{
0
};
snprintf
(
fullName
,
PATH_MAX
,
"%s"
TD_DIRSEP
"%s"
,
tsLogDir
,
logName
);
...
...
@@ -127,6 +130,7 @@ int32_t taosInitLog(const char *logName, int maxFiles) {
if
(
tsLogObj
.
logHandle
==
NULL
)
return
-
1
;
if
(
taosOpenLogFile
(
fullName
,
tsNumOfLogLines
,
maxFiles
)
<
0
)
return
-
1
;
if
(
taosStartLog
()
<
0
)
return
-
1
;
tsLogInited
=
true
;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录