Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
97a20ee8
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看板
提交
97a20ee8
编写于
5月 18, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update meta based on sversion
上级
0c382080
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
123 addition
and
10 deletion
+123
-10
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+2
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+11
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+6
-10
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+2
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+3
-0
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+99
-0
未找到文件。
include/libs/catalog/catalog.h
浏览文件 @
97a20ee8
...
...
@@ -170,6 +170,8 @@ int32_t catalogUpdateSTableMeta(SCatalog* pCatalog, STableMetaRsp *rspMsg);
*/
int32_t
catalogRefreshDBVgInfo
(
SCatalog
*
pCtg
,
void
*
pTrans
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbFName
);
int32_t
catalogChkTbMetaVersion
(
SCatalog
*
pCtg
,
void
*
pTrans
,
const
SEpSet
*
pMgmtEps
,
SArray
*
pTables
);
/**
* Force refresh a table's local cached meta data.
* @param pCatalog (input, got with catalogGetHandle)
...
...
source/client/src/clientImpl.c
浏览文件 @
97a20ee8
...
...
@@ -361,6 +361,17 @@ _return:
return
code
;
}
void
freeRequestRes
(
SRequestObj
*
pRequest
,
void
*
res
)
{
if
(
NULL
==
res
)
{
return
;
}
if
(
TDMT_VND_SUBMIT
==
pRequest
->
type
)
{
tFreeSSubmitRsp
((
SSubmitRsp
*
)
res
);
}
else
if
(
TDMT_VND_QUERY
==
pRequest
->
type
)
{
}
}
SRequestObj
*
launchQueryImpl
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
int32_t
code
,
bool
keepQuery
,
void
**
res
)
{
void
*
pRes
=
NULL
;
...
...
source/common/src/tmsg.c
浏览文件 @
97a20ee8
...
...
@@ -4087,10 +4087,8 @@ static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBl
if
(
tEncodeI32
(
pEncoder
,
pBlock
->
code
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pBlock
->
hashMeta
)
<
0
)
return
-
1
;
if
(
pBlock
->
hashMeta
)
{
if
(
tEncodeI64
(
pEncoder
,
pBlock
->
uid
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pBlock
->
tblFName
)
<
0
)
return
-
1
;
}
if
(
tEncodeI64
(
pEncoder
,
pBlock
->
uid
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pBlock
->
tblFName
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pBlock
->
numOfRows
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pBlock
->
affectedRows
)
<
0
)
return
-
1
;
if
(
tEncodeI64v
(
pEncoder
,
pBlock
->
sver
)
<
0
)
return
-
1
;
...
...
@@ -4104,12 +4102,10 @@ static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) {
if
(
tDecodeI32
(
pDecoder
,
&
pBlock
->
code
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pBlock
->
hashMeta
)
<
0
)
return
-
1
;
if
(
pBlock
->
hashMeta
)
{
if
(
tDecodeI64
(
pDecoder
,
&
pBlock
->
uid
)
<
0
)
return
-
1
;
pBlock
->
tblFName
=
taosMemoryCalloc
(
TSDB_TABLE_FNAME_LEN
,
1
);
if
(
NULL
==
pBlock
->
tblFName
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pBlock
->
tblFName
)
<
0
)
return
-
1
;
}
if
(
tDecodeI64
(
pDecoder
,
&
pBlock
->
uid
)
<
0
)
return
-
1
;
pBlock
->
tblFName
=
taosMemoryCalloc
(
TSDB_TABLE_FNAME_LEN
,
1
);
if
(
NULL
==
pBlock
->
tblFName
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pBlock
->
tblFName
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pBlock
->
numOfRows
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pBlock
->
affectedRows
)
<
0
)
return
-
1
;
if
(
tDecodeI64v
(
pDecoder
,
&
pBlock
->
sver
)
<
0
)
return
-
1
;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
97a20ee8
...
...
@@ -320,6 +320,8 @@ int tsdbInsertTableData(STsdb *pTsdb, SSubmitMsgIter *pMsgIter, SSubmitBlk *pBlo
terrno
=
TSDB_CODE_PAR_TABLE_NOT_EXIST
;
return
-
1
;
}
strcat
(
pRsp
->
tblFName
,
mr
.
me
.
name
);
if
(
mr
.
me
.
type
==
TSDB_NORMAL_TABLE
)
{
sverNew
=
mr
.
me
.
ntbEntry
.
schema
.
sver
;
}
else
{
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
97a20ee8
...
...
@@ -676,6 +676,9 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
vnodeDebugPrintSingleSubmitMsg
(
pVnode
->
pMeta
,
pBlock
,
&
msgIter
,
"real uid"
);
tDecoderClear
(
&
decoder
);
}
else
{
submitBlkRsp
.
tblFName
=
taosMemoryMalloc
(
TSDB_TABLE_FNAME_LEN
);
sprintf
(
submitBlkRsp
.
tblFName
,
"%s."
,
pVnode
->
config
.
dbname
);
}
if
(
tsdbInsertTableData
(
pVnode
->
pTsdb
,
&
msgIter
,
pBlock
,
&
submitBlkRsp
)
<
0
)
{
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
97a20ee8
...
...
@@ -2883,8 +2883,107 @@ _return:
CTG_API_LEAVE
(
code
);
}
int32_t
ctgGetTbSverFromCache
(
SCatalog
*
pCtg
,
const
SName
*
pTableName
,
int32_t
*
sver
)
{
*
sver
=
-
1
;
if
(
NULL
==
pCtg
->
dbCache
)
{
ctgDebug
(
"empty tbmeta cache, tbName:%s"
,
pTableName
->
tname
);
return
TSDB_CODE_SUCCESS
;
}
SCtgDBCache
*
dbCache
=
NULL
;
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
pTableName
,
dbFName
);
ctgAcquireDBCache
(
pCtg
,
dbFName
,
&
dbCache
);
if
(
NULL
==
dbCache
)
{
ctgDebug
(
"db %s not in cache"
,
pTableName
->
tname
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
tbType
=
0
;
uint64_t
suid
=
0
;
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
STableMeta
*
tbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
metaCache
,
pTableName
->
tname
,
strlen
(
pTableName
->
tname
));
if
(
tbMeta
)
{
tbType
=
tbMeta
->
tableType
;
suid
=
tbMeta
->
suid
;
if
(
tbType
!=
TSDB_CHILD_TABLE
)
{
*
sver
=
tbMeta
->
sversion
;
}
}
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
if
(
NULL
==
tbMeta
)
{
ctgReleaseDBCache
(
pCtg
,
dbCache
);
return
TSDB_CODE_SUCCESS
;
}
if
(
tbType
!=
TSDB_CHILD_TABLE
)
{
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"Got sver %d from cache, type:%d, dbFName:%s, tbName:%s"
,
*
sver
,
tbType
,
dbFName
,
pTableName
->
tname
);
return
TSDB_CODE_SUCCESS
;
}
ctgDebug
(
"Got subtable meta from cache, dbFName:%s, tbName:%s, suid:%"
PRIx64
,
dbFName
,
pTableName
->
tname
,
suid
);
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
STableMeta
**
stbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
stbCache
,
&
suid
,
sizeof
(
suid
));
if
(
NULL
==
stbMeta
||
NULL
==
*
stbMeta
)
{
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"stb not in stbCache, suid:%"
PRIx64
,
suid
);
return
TSDB_CODE_SUCCESS
;
}
if
((
*
stbMeta
)
->
suid
!=
suid
)
{
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgError
(
"stable suid in stbCache mis-match, expected suid:%"
PRIx64
",actual suid:%"
PRIx64
,
suid
,
(
*
stbMeta
)
->
suid
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
*
sver
=
(
*
stbMeta
)
->
sversion
;
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"Got sver %d from cache, type:%d, dbFName:%s, tbName:%s"
,
*
sver
,
tbType
,
dbFName
,
pTableName
->
tname
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
catalogChkTbMetaVersion
(
SCatalog
*
pCtg
,
void
*
pTrans
,
const
SEpSet
*
pMgmtEps
,
SArray
*
pTables
)
{
CTG_API_ENTER
();
if
(
NULL
==
pCtg
||
NULL
==
pTrans
||
NULL
==
pMgmtEps
||
NULL
==
pTables
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
SName
name
;
int32_t
sver
=
0
;
int32_t
tbNum
=
taosArrayGetSize
(
pTables
);
for
(
int32_t
i
=
0
;
i
<
tbNum
;
++
i
)
{
STbSVersion
*
pTb
=
(
STbSVersion
*
)
taosArrayGet
(
pTables
,
i
);
tNameFromString
(
&
name
,
pTb
->
tbFName
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
if
(
CTG_IS_SYS_DBNAME
(
name
.
dbname
))
{
continue
;
}
ctgGetTbSverFromCache
(
pCtg
,
&
name
,
&
sver
);
if
(
sver
>=
0
&&
sver
<
pTb
->
sver
)
{
catalogRemoveTableMeta
(
pCtg
,
&
name
);
//TODO REMOVE STB FROM CACHE
}
}
CTG_API_LEAVE
(
TSDB_CODE_SUCCESS
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录