Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
78e49d6b
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看板
提交
78e49d6b
编写于
1月 26, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
3aa92dec
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
107 addition
and
36 deletion
+107
-36
include/common/tmsg.h
include/common/tmsg.h
+37
-1
source/client/src/clientHb.c
source/client/src/clientHb.c
+33
-18
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+13
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+1
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+5
-0
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+3
-2
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+1
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+12
-11
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+1
-0
source/util/src/terror.c
source/util/src/terror.c
+1
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
78e49d6b
...
@@ -1391,9 +1391,26 @@ void* tDeserializeSClientHbReq(void* buf, SClientHbReq* pReq);
...
@@ -1391,9 +1391,26 @@ void* tDeserializeSClientHbReq(void* buf, SClientHbReq* pReq);
int
tSerializeSClientHbRsp
(
void
**
buf
,
const
SClientHbRsp
*
pRsp
);
int
tSerializeSClientHbRsp
(
void
**
buf
,
const
SClientHbRsp
*
pRsp
);
void
*
tDeserializeSClientHbRsp
(
void
*
buf
,
SClientHbRsp
*
pRsp
);
void
*
tDeserializeSClientHbRsp
(
void
*
buf
,
SClientHbRsp
*
pRsp
);
static
FORCE_INLINE
void
tFreeReqKvHash
(
SHashObj
*
info
)
{
void
*
pIter
=
taosHashIterate
(
info
,
NULL
);
while
(
pIter
!=
NULL
)
{
SKv
*
kv
=
(
SKv
*
)
pIter
;
tfree
(
kv
->
value
);
pIter
=
taosHashIterate
(
info
,
pIter
);
}
}
static
FORCE_INLINE
void
tFreeClientHbReq
(
void
*
pReq
)
{
static
FORCE_INLINE
void
tFreeClientHbReq
(
void
*
pReq
)
{
SClientHbReq
*
req
=
(
SClientHbReq
*
)
pReq
;
SClientHbReq
*
req
=
(
SClientHbReq
*
)
pReq
;
if
(
req
->
info
)
taosHashCleanup
(
req
->
info
);
if
(
req
->
info
)
{
tFreeReqKvHash
(
req
->
info
);
taosHashCleanup
(
req
->
info
);
}
}
}
int
tSerializeSClientHbBatchReq
(
void
**
buf
,
const
SClientHbBatchReq
*
pReq
);
int
tSerializeSClientHbBatchReq
(
void
**
buf
,
const
SClientHbBatchReq
*
pReq
);
...
@@ -1409,6 +1426,25 @@ static FORCE_INLINE void tFreeClientHbBatchReq(void* pReq, bool deep) {
...
@@ -1409,6 +1426,25 @@ static FORCE_INLINE void tFreeClientHbBatchReq(void* pReq, bool deep) {
free
(
pReq
);
free
(
pReq
);
}
}
static
FORCE_INLINE
void
tFreeClientKv
(
void
*
pKv
)
{
SKv
*
kv
=
(
SKv
*
)
pKv
;
if
(
kv
)
{
tfree
(
kv
->
value
);
}
}
static
FORCE_INLINE
void
tFreeClientHbRsp
(
void
*
pRsp
)
{
SClientHbRsp
*
rsp
=
(
SClientHbRsp
*
)
pRsp
;
if
(
rsp
->
info
)
taosArrayDestroyEx
(
rsp
->
info
,
tFreeClientKv
);
}
static
FORCE_INLINE
void
tFreeClientHbBatchRsp
(
void
*
pRsp
)
{
SClientHbBatchRsp
*
rsp
=
(
SClientHbBatchRsp
*
)
pRsp
;
taosArrayDestroyEx
(
rsp
->
rsps
,
tFreeClientHbRsp
);
}
int
tSerializeSClientHbBatchRsp
(
void
**
buf
,
const
SClientHbBatchRsp
*
pBatchRsp
);
int
tSerializeSClientHbBatchRsp
(
void
**
buf
,
const
SClientHbBatchRsp
*
pBatchRsp
);
void
*
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
SClientHbBatchRsp
*
pBatchRsp
);
void
*
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
SClientHbBatchRsp
*
pBatchRsp
);
...
...
source/client/src/clientHb.c
浏览文件 @
78e49d6b
...
@@ -37,6 +37,8 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
...
@@ -37,6 +37,8 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
rsp
->
vgVersion
=
ntohl
(
rsp
->
vgVersion
);
rsp
->
vgVersion
=
ntohl
(
rsp
->
vgVersion
);
rsp
->
vgNum
=
ntohl
(
rsp
->
vgNum
);
rsp
->
vgNum
=
ntohl
(
rsp
->
vgNum
);
rsp
->
uid
=
be64toh
(
rsp
->
uid
);
rsp
->
uid
=
be64toh
(
rsp
->
uid
);
tscDebug
(
"hb db rsp, db:%s, vgVersion:%d, uid:%"
PRIx64
,
rsp
->
db
,
rsp
->
vgVersion
,
rsp
->
uid
);
if
(
rsp
->
vgVersion
<
0
)
{
if
(
rsp
->
vgVersion
<
0
)
{
SDbVgVersion
dbInfo
;
SDbVgVersion
dbInfo
;
...
@@ -96,6 +98,9 @@ static int32_t hbQueryHbRspHandle(struct SAppHbMgr *pAppHbMgr, SClientHbRsp* pRs
...
@@ -96,6 +98,9 @@ static int32_t hbQueryHbRspHandle(struct SAppHbMgr *pAppHbMgr, SClientHbRsp* pRs
}
}
int32_t
kvNum
=
pRsp
->
info
?
taosArrayGetSize
(
pRsp
->
info
)
:
0
;
int32_t
kvNum
=
pRsp
->
info
?
taosArrayGetSize
(
pRsp
->
info
)
:
0
;
tscDebug
(
"hb got %d rsp kv"
,
kvNum
);
for
(
int32_t
i
=
0
;
i
<
kvNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
kvNum
;
++
i
)
{
SKv
*
kv
=
taosArrayGet
(
pRsp
->
info
,
i
);
SKv
*
kv
=
taosArrayGet
(
pRsp
->
info
,
i
);
switch
(
kv
->
key
)
{
switch
(
kv
->
key
)
{
...
@@ -130,28 +135,42 @@ static int32_t hbQueryHbRspHandle(struct SAppHbMgr *pAppHbMgr, SClientHbRsp* pRs
...
@@ -130,28 +135,42 @@ static int32_t hbQueryHbRspHandle(struct SAppHbMgr *pAppHbMgr, SClientHbRsp* pRs
}
}
static
int32_t
hbMqAsyncCallBack
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
static
int32_t
hbMqAsyncCallBack
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
static
int32_t
emptyRspNum
=
0
;
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tfree
(
param
);
return
-
1
;
return
-
1
;
}
}
char
*
key
=
(
char
*
)
param
;
char
*
key
=
(
char
*
)
param
;
SClientHbBatchRsp
pRsp
=
{
0
};
SClientHbBatchRsp
pRsp
=
{
0
};
tDeserializeSClientHbBatchRsp
(
pMsg
->
pData
,
&
pRsp
);
tDeserializeSClientHbBatchRsp
(
pMsg
->
pData
,
&
pRsp
);
int32_t
r
eq
Num
=
taosArrayGetSize
(
pRsp
.
rsps
);
int32_t
r
sp
Num
=
taosArrayGetSize
(
pRsp
.
rsps
);
SAppInstInfo
**
pInst
=
taosHashGet
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
));
SAppInstInfo
**
pInst
=
taosHashGet
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
));
if
(
pInst
==
NULL
||
NULL
==
*
pInst
)
{
if
(
pInst
==
NULL
||
NULL
==
*
pInst
)
{
tscError
(
"cluster not exist, key:%s"
,
key
);
tscError
(
"cluster not exist, key:%s"
,
key
);
tfree
(
param
);
tFreeClientHbBatchRsp
(
&
pRsp
);
return
-
1
;
return
-
1
;
}
}
for
(
int32_t
i
=
0
;
i
<
reqNum
;
++
i
)
{
tfree
(
param
);
if
(
rspNum
)
{
tscDebug
(
"hb got %d rsp, %d empty rsp prior"
,
rspNum
,
atomic_val_compare_exchange_32
(
&
emptyRspNum
,
emptyRspNum
,
0
));
}
else
{
atomic_add_fetch_32
(
&
emptyRspNum
,
1
);
}
for
(
int32_t
i
=
0
;
i
<
rspNum
;
++
i
)
{
SClientHbRsp
*
rsp
=
taosArrayGet
(
pRsp
.
rsps
,
i
);
SClientHbRsp
*
rsp
=
taosArrayGet
(
pRsp
.
rsps
,
i
);
code
=
(
*
clientHbMgr
.
rspHandle
[
rsp
->
connKey
.
hbType
])((
*
pInst
)
->
pAppHbMgr
,
rsp
);
code
=
(
*
clientHbMgr
.
rspHandle
[
rsp
->
connKey
.
hbType
])((
*
pInst
)
->
pAppHbMgr
,
rsp
);
if
(
code
)
{
if
(
code
)
{
break
;
break
;
}
}
}
}
tFreeClientHbBatchRsp
(
&
pRsp
);
return
code
;
return
code
;
}
}
...
@@ -166,6 +185,10 @@ int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SCl
...
@@ -166,6 +185,10 @@ int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SCl
return
code
;
return
code
;
}
}
if
(
dbNum
<=
0
)
{
return
TSDB_CODE_SUCCESS
;
}
for
(
int32_t
i
=
0
;
i
<
dbNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
dbNum
;
++
i
)
{
SDbVgVersion
*
db
=
&
dbs
[
i
];
SDbVgVersion
*
db
=
&
dbs
[
i
];
db
->
dbId
=
htobe64
(
db
->
dbId
);
db
->
dbId
=
htobe64
(
db
->
dbId
);
...
@@ -173,6 +196,9 @@ int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SCl
...
@@ -173,6 +196,9 @@ int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SCl
}
}
SKv
kv
=
{.
key
=
HEARTBEAT_KEY_DBINFO
,
.
valueLen
=
sizeof
(
SDbVgVersion
)
*
dbNum
,
.
value
=
dbs
};
SKv
kv
=
{.
key
=
HEARTBEAT_KEY_DBINFO
,
.
valueLen
=
sizeof
(
SDbVgVersion
)
*
dbNum
,
.
value
=
dbs
};
tscDebug
(
"hb got %d expired db, valueLen:%d"
,
dbNum
,
kv
.
valueLen
);
taosHashPut
(
req
->
info
,
&
kv
.
key
,
sizeof
(
kv
.
key
),
&
kv
,
sizeof
(
kv
));
taosHashPut
(
req
->
info
,
&
kv
.
key
,
sizeof
(
kv
.
key
),
&
kv
,
sizeof
(
kv
));
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -213,21 +239,9 @@ static FORCE_INLINE void hbMgrInitHandle() {
...
@@ -213,21 +239,9 @@ static FORCE_INLINE void hbMgrInitHandle() {
hbMgrInitMqHbHandle
();
hbMgrInitMqHbHandle
();
}
}
void
hbFreeReqKvHash
(
SHashObj
*
info
)
{
void
*
pIter
=
taosHashIterate
(
info
,
NULL
);
while
(
pIter
!=
NULL
)
{
SKv
*
kv
=
pIter
;
tfree
(
kv
->
value
);
pIter
=
taosHashIterate
(
info
,
pIter
);
}
}
void
hbFreeReq
(
void
*
req
)
{
void
hbFreeReq
(
void
*
req
)
{
SClientHbReq
*
pReq
=
(
SClientHbReq
*
)
req
;
SClientHbReq
*
pReq
=
(
SClientHbReq
*
)
req
;
hb
FreeReqKvHash
(
pReq
->
info
);
t
FreeReqKvHash
(
pReq
->
info
);
}
}
...
@@ -274,7 +288,7 @@ void hbClearReqInfo(SAppHbMgr *pAppHbMgr) {
...
@@ -274,7 +288,7 @@ void hbClearReqInfo(SAppHbMgr *pAppHbMgr) {
while
(
pIter
!=
NULL
)
{
while
(
pIter
!=
NULL
)
{
SClientHbReq
*
pOneReq
=
pIter
;
SClientHbReq
*
pOneReq
=
pIter
;
hb
FreeReqKvHash
(
pOneReq
->
info
);
t
FreeReqKvHash
(
pOneReq
->
info
);
taosHashClear
(
pOneReq
->
info
);
taosHashClear
(
pOneReq
->
info
);
pIter
=
taosHashIterate
(
pAppHbMgr
->
activeInfo
,
pIter
);
pIter
=
taosHashIterate
(
pAppHbMgr
->
activeInfo
,
pIter
);
...
@@ -333,7 +347,8 @@ static void* hbThreadFunc(void* param) {
...
@@ -333,7 +347,8 @@ static void* hbThreadFunc(void* param) {
int64_t
transporterId
=
0
;
int64_t
transporterId
=
0
;
SEpSet
epSet
=
getEpSet_s
(
&
pAppInstInfo
->
mgmtEp
);
SEpSet
epSet
=
getEpSet_s
(
&
pAppInstInfo
->
mgmtEp
);
asyncSendMsgToServer
(
pAppInstInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
pInfo
);
asyncSendMsgToServer
(
pAppInstInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
pInfo
);
tFreeClientHbBatchReq
(
pReq
,
false
);
tFreeClientHbBatchReq
(
pReq
,
false
);
hbClearReqInfo
(
pAppHbMgr
);
atomic_add_fetch_32
(
&
pAppHbMgr
->
reportCnt
,
1
);
atomic_add_fetch_32
(
&
pAppHbMgr
->
reportCnt
,
1
);
}
}
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
78e49d6b
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "tname.h"
#include "tname.h"
#include "clientInt.h"
#include "clientInt.h"
#include "clientLog.h"
#include "clientLog.h"
#include "catalog.h"
int
(
*
handleRequestRspFp
[
TDMT_MAX
])(
void
*
,
const
SDataBuf
*
pMsg
,
int32_t
code
);
int
(
*
handleRequestRspFp
[
TDMT_MAX
])(
void
*
,
const
SDataBuf
*
pMsg
,
int32_t
code
);
...
@@ -287,7 +288,6 @@ int32_t processCreateTableRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -287,7 +288,6 @@ int32_t processCreateTableRsp(void* param, const SDataBuf* pMsg, int32_t code) {
}
}
int32_t
processDropDbRsp
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
int32_t
processDropDbRsp
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
// todo: Remove cache in catalog cache.
SRequestObj
*
pRequest
=
param
;
SRequestObj
*
pRequest
=
param
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
setErrno
(
pRequest
,
code
);
setErrno
(
pRequest
,
code
);
...
@@ -295,6 +295,18 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -295,6 +295,18 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
return
code
;
}
}
SDropDbReq
*
req
=
pRequest
->
body
.
requestMsg
.
pData
;
SDbVgVersion
dbVer
=
{
0
};
struct
SCatalog
*
pCatalog
=
NULL
;
strncpy
(
dbVer
.
dbName
,
req
->
db
,
sizeof
(
dbVer
.
dbName
));
dbVer
.
dbId
=
0
;
//TODO GET DBID FROM RSP
catalogGetHandle
(
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
&
pCatalog
);
catalogRemoveDBVgroup
(
pCatalog
,
&
dbVer
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
return
code
;
return
code
;
}
}
...
...
source/common/src/tmsg.c
浏览文件 @
78e49d6b
...
@@ -114,7 +114,7 @@ void *tDeserializeSClientHbReq(void *buf, SClientHbReq *pReq) {
...
@@ -114,7 +114,7 @@ void *tDeserializeSClientHbReq(void *buf, SClientHbReq *pReq) {
for
(
int
i
=
0
;
i
<
kvNum
;
i
++
)
{
for
(
int
i
=
0
;
i
<
kvNum
;
i
++
)
{
SKv
kv
;
SKv
kv
;
buf
=
taosDecodeSKv
(
buf
,
&
kv
);
buf
=
taosDecodeSKv
(
buf
,
&
kv
);
taosHashPut
(
pReq
->
info
,
&
kv
.
key
,
sizeof
(
kv
.
key
),
kv
.
value
,
kv
.
valueLen
);
taosHashPut
(
pReq
->
info
,
&
kv
.
key
,
sizeof
(
kv
.
key
),
&
kv
,
sizeof
(
kv
)
);
}
}
return
buf
;
return
buf
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
78e49d6b
...
@@ -894,6 +894,8 @@ int32_t mndValidateDBInfo(SMnode *pMnode, SDbVgVersion *dbs, int32_t num, void *
...
@@ -894,6 +894,8 @@ int32_t mndValidateDBInfo(SMnode *pMnode, SDbVgVersion *dbs, int32_t num, void *
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SDbVgVersion
*
db
=
&
dbs
[
i
];
SDbVgVersion
*
db
=
&
dbs
[
i
];
db
->
dbId
=
be64toh
(
db
->
dbId
);
db
->
vgVersion
=
ntohl
(
db
->
vgVersion
);
len
=
0
;
len
=
0
;
...
@@ -929,6 +931,9 @@ int32_t mndValidateDBInfo(SMnode *pMnode, SDbVgVersion *dbs, int32_t num, void *
...
@@ -929,6 +931,9 @@ int32_t mndValidateDBInfo(SMnode *pMnode, SDbVgVersion *dbs, int32_t num, void *
pRsp
->
vgNum
=
htonl
(
vgNum
);
pRsp
->
vgNum
=
htonl
(
vgNum
);
pRsp
->
hashMethod
=
pDb
->
hashMethod
;
pRsp
->
hashMethod
=
pDb
->
hashMethod
;
}
else
{
}
else
{
pRsp
->
uid
=
htobe64
(
db
->
dbId
);
pRsp
->
vgNum
=
htonl
(
0
);
pRsp
->
hashMethod
=
0
;
pRsp
->
vgVersion
=
htonl
(
-
1
);
pRsp
->
vgVersion
=
htonl
(
-
1
);
}
}
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
78e49d6b
...
@@ -370,8 +370,6 @@ static int32_t mndProcessHeartBeatReq(SMnodeMsg *pReq) {
...
@@ -370,8 +370,6 @@ static int32_t mndProcessHeartBeatReq(SMnodeMsg *pReq) {
if
(
rspMsg
&&
rspLen
>
0
)
{
if
(
rspMsg
&&
rspLen
>
0
)
{
SKv
kv
=
{.
key
=
HEARTBEAT_KEY_DBINFO
,
.
valueLen
=
rspLen
,
.
value
=
rspMsg
};
SKv
kv
=
{.
key
=
HEARTBEAT_KEY_DBINFO
,
.
valueLen
=
rspLen
,
.
value
=
rspMsg
};
taosArrayPush
(
hbRsp
.
info
,
&
kv
);
taosArrayPush
(
hbRsp
.
info
,
&
kv
);
taosArrayPush
(
batchRsp
.
rsps
,
&
hbRsp
);
}
}
break
;
break
;
}
}
...
@@ -380,11 +378,14 @@ static int32_t mndProcessHeartBeatReq(SMnodeMsg *pReq) {
...
@@ -380,11 +378,14 @@ static int32_t mndProcessHeartBeatReq(SMnodeMsg *pReq) {
break
;
break
;
default:
default:
mError
(
"invalid kv key:%d"
,
kv
->
key
);
mError
(
"invalid kv key:%d"
,
kv
->
key
);
hbRsp
.
status
=
TSDB_CODE_MND_APP_ERROR
;
break
;
break
;
}
}
pIter
=
taosHashIterate
(
pHbReq
->
info
,
pIter
);
pIter
=
taosHashIterate
(
pHbReq
->
info
,
pIter
);
}
}
taosArrayPush
(
batchRsp
.
rsps
,
&
hbRsp
);
}
else
if
(
pHbReq
->
connKey
.
hbType
==
HEARTBEAT_TYPE_MQ
)
{
}
else
if
(
pHbReq
->
connKey
.
hbType
==
HEARTBEAT_TYPE_MQ
)
{
SClientHbRsp
*
pRsp
=
mndMqHbBuildRsp
(
pMnode
,
pHbReq
);
SClientHbRsp
*
pRsp
=
mndMqHbBuildRsp
(
pMnode
,
pHbReq
);
if
(
pRsp
!=
NULL
)
{
if
(
pRsp
!=
NULL
)
{
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
78e49d6b
...
@@ -31,7 +31,7 @@ extern "C" {
...
@@ -31,7 +31,7 @@ extern "C" {
#define CTG_DEFAULT_RENT_SECOND 10
#define CTG_DEFAULT_RENT_SECOND 10
#define CTG_DEFAULT_RENT_SLOT_SIZE 10
#define CTG_DEFAULT_RENT_SLOT_SIZE 10
#define CTG_RENT_SLOT_SECOND
2
#define CTG_RENT_SLOT_SECOND
1.5
#define CTG_DEFAULT_INVALID_VERSION (-1)
#define CTG_DEFAULT_INVALID_VERSION (-1)
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
78e49d6b
...
@@ -443,9 +443,9 @@ int32_t ctgSTableVersionCompare(const void* key1, const void* key2) {
...
@@ -443,9 +443,9 @@ int32_t ctgSTableVersionCompare(const void* key1, const void* key2) {
}
}
int32_t
ctgDbVgVersionCompare
(
const
void
*
key1
,
const
void
*
key2
)
{
int32_t
ctgDbVgVersionCompare
(
const
void
*
key1
,
const
void
*
key2
)
{
if
(
((
SDbVgVersion
*
)
key1
)
->
dbId
<
((
SDbVgVersion
*
)
key2
)
->
dbId
)
{
if
(
*
(
int64_t
*
)
key1
<
((
SDbVgVersion
*
)
key2
)
->
dbId
)
{
return
-
1
;
return
-
1
;
}
else
if
(
((
SDbVgVersion
*
)
key1
)
->
dbId
>
((
SDbVgVersion
*
)
key2
)
->
dbId
)
{
}
else
if
(
*
(
int64_t
*
)
key1
>
((
SDbVgVersion
*
)
key2
)
->
dbId
)
{
return
1
;
return
1
;
}
else
{
}
else
{
return
0
;
return
0
;
...
@@ -652,7 +652,7 @@ int32_t ctgMetaRentGet(SMetaRentMgmt *mgmt, void **res, uint32_t *num, int32_t s
...
@@ -652,7 +652,7 @@ int32_t ctgMetaRentGet(SMetaRentMgmt *mgmt, void **res, uint32_t *num, int32_t s
int32_t
ctgUpdateTableMetaCache
(
struct
SCatalog
*
pCatalog
,
STableMetaOutput
*
output
)
{
int32_t
ctgUpdateTableMetaCache
(
struct
SCatalog
*
pCatalog
,
STableMetaOutput
*
output
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
if
(
NULL
==
output
->
tbMeta
)
{
if
(
(
!
CTG_IS_META_CTABLE
(
output
->
metaType
))
&&
NULL
==
output
->
tbMeta
)
{
ctgError
(
"no valid table meta got from meta rsp, tbName:%s"
,
output
->
tbFname
);
ctgError
(
"no valid table meta got from meta rsp, tbName:%s"
,
output
->
tbFname
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
}
...
@@ -809,20 +809,19 @@ int32_t ctgValidateAndRemoveDbInfo(struct SCatalog* pCatalog, SDbVgVersion* targ
...
@@ -809,20 +809,19 @@ int32_t ctgValidateAndRemoveDbInfo(struct SCatalog* pCatalog, SDbVgVersion* targ
}
}
CTG_LOCK
(
CTG_WRITE
,
&
info
->
lock
);
CTG_LOCK
(
CTG_WRITE
,
&
info
->
lock
);
//TODO OPEN IT
#if 0
if (info->dbId != target->dbId) {
if (info->dbId != target->dbId) {
ctgInfo("db id already updated, db:%s, dbId:%"PRIx64 ", targetId:%"PRIx64, target->dbName, info->dbId, target->dbId);
ctgInfo("db id already updated, db:%s, dbId:%"PRIx64 ", targetId:%"PRIx64, target->dbName, info->dbId, target->dbId);
CTG_UNLOCK(CTG_WRITE, &info->lock);
CTG_UNLOCK(CTG_WRITE, &info->lock);
taosHashRelease(pCatalog->dbCache.cache, info);
taosHashRelease(pCatalog->dbCache.cache, info);
return TSDB_CODE_SUCCESS;
return TSDB_CODE_SUCCESS;
}
}
#else
if
(
info
->
vgVersion
>
target
->
vgVersion
)
{
target
->
dbId
=
info
->
dbId
;
ctgInfo
(
"db vgVersion already updated, db:%s, version:%d, targetVer:%d"
,
target
->
dbName
,
info
->
vgVersion
,
target
->
vgVersion
);
#endif
CTG_UNLOCK
(
CTG_WRITE
,
&
info
->
lock
);
taosHashRelease
(
pCatalog
->
dbCache
.
cache
,
info
);
return
TSDB_CODE_SUCCESS
;
}
if
(
info
->
vgInfo
)
{
if
(
info
->
vgInfo
)
{
ctgInfo
(
"cleanup db vgInfo, db:%s"
,
target
->
dbName
);
ctgInfo
(
"cleanup db vgInfo, db:%s"
,
target
->
dbName
);
taosHashCleanup
(
info
->
vgInfo
);
taosHashCleanup
(
info
->
vgInfo
);
...
@@ -1246,6 +1245,8 @@ int32_t catalogUpdateDBVgroup(struct SCatalog* pCatalog, const char* dbName, SDB
...
@@ -1246,6 +1245,8 @@ int32_t catalogUpdateDBVgroup(struct SCatalog* pCatalog, const char* dbName, SDB
dbInfo
->
vgInfo
=
NULL
;
dbInfo
->
vgInfo
=
NULL
;
SDbVgVersion
vgVersion
=
{.
dbId
=
dbInfo
->
dbId
,
.
vgVersion
=
dbInfo
->
vgVersion
};
SDbVgVersion
vgVersion
=
{.
dbId
=
dbInfo
->
dbId
,
.
vgVersion
=
dbInfo
->
vgVersion
};
strncpy
(
vgVersion
.
dbName
,
dbName
,
sizeof
(
vgVersion
.
dbName
));
if
(
newAdded
)
{
if
(
newAdded
)
{
CTG_ERR_JRET
(
ctgMetaRentAdd
(
&
pCatalog
->
dbRent
,
&
vgVersion
,
dbInfo
->
dbId
,
sizeof
(
SDbVgVersion
)));
CTG_ERR_JRET
(
ctgMetaRentAdd
(
&
pCatalog
->
dbRent
,
&
vgVersion
,
dbInfo
->
dbId
,
sizeof
(
SDbVgVersion
)));
}
else
{
}
else
{
...
...
source/libs/executor/src/dataDispatcher.c
浏览文件 @
78e49d6b
...
@@ -186,6 +186,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int32_t* pLen, bool* pQueryE
...
@@ -186,6 +186,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int32_t* pLen, bool* pQueryE
memcpy
(
&
pDispatcher
->
nextOutput
,
pBuf
,
sizeof
(
SDataDispatchBuf
));
memcpy
(
&
pDispatcher
->
nextOutput
,
pBuf
,
sizeof
(
SDataDispatchBuf
));
taosFreeQitem
(
pBuf
);
taosFreeQitem
(
pBuf
);
*
pLen
=
((
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
))
->
dataLen
;
*
pLen
=
((
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
))
->
dataLen
;
*
pQueryEnd
=
pDispatcher
->
queryEnd
;
}
}
static
int32_t
getDataBlock
(
SDataSinkHandle
*
pHandle
,
SOutputData
*
pOutput
)
{
static
int32_t
getDataBlock
(
SDataSinkHandle
*
pHandle
,
SOutputData
*
pOutput
)
{
...
...
source/util/src/terror.c
浏览文件 @
78e49d6b
...
@@ -410,7 +410,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FS_INVLD_LEVEL, "tfs invalid level")
...
@@ -410,7 +410,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FS_INVLD_LEVEL, "tfs invalid level")
TAOS_DEFINE_ERROR
(
TSDB_CODE_FS_NO_VALID_DISK
,
"tfs no valid disk"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_FS_NO_VALID_DISK
,
"tfs no valid disk"
)
// catalog
// catalog
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_INTERNAL_ERROR
,
"catalog inter
v
al error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_INTERNAL_ERROR
,
"catalog inter
n
al error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_INVALID_INPUT
,
"invalid catalog input parameters"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_INVALID_INPUT
,
"invalid catalog input parameters"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_NOT_READY
,
"catalog is not ready"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_NOT_READY
,
"catalog is not ready"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_MEM_ERROR
,
"catalog memory error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_CTG_MEM_ERROR
,
"catalog memory error"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录