Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2dc7bcbe
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
2dc7bcbe
编写于
6月 18, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
show create db
上级
3599b265
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
240 addition
and
8 deletion
+240
-8
include/common/tmsg.h
include/common/tmsg.h
+17
-0
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+2
-0
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+5
-1
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+1
-1
source/libs/command/src/command.c
source/libs/command/src/command.c
+159
-2
source/libs/parser/inc/parUtil.h
source/libs/parser/inc/parUtil.h
+3
-0
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+1
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+25
-1
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+25
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+2
-2
未找到文件。
include/common/tmsg.h
浏览文件 @
2dc7bcbe
...
...
@@ -667,6 +667,23 @@ int32_t tSerializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp
int32_t
tDeserializeSQueryTableRsp
(
void
*
buf
,
int32_t
bufLen
,
SQueryTableRsp
*
pRsp
);
typedef
struct
{
char
tbName
[
TSDB_TABLE_NAME_LEN
];
char
stbName
[
TSDB_TABLE_NAME_LEN
];
char
dbFName
[
TSDB_DB_FNAME_LEN
];
int32_t
numOfTags
;
int32_t
numOfColumns
;
int8_t
tableType
;
int64_t
delay1
;
int64_t
delay2
;
int64_t
watermark1
;
int64_t
watermark2
;
int32_t
ttl
;
char
*
pAst1
;
char
*
pAst2
;
SSchema
*
pSchemas
;
}
STableCfg
;
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
int32_t
numOfVgroups
;
...
...
include/libs/catalog/catalog.h
浏览文件 @
2dc7bcbe
...
...
@@ -68,6 +68,7 @@ typedef struct SCatalogReq {
SArray
*
pIndex
;
// element is index name
SArray
*
pUser
;
// element is SUserAuthInfo
SArray
*
pTableIndex
;
// element is SNAME
SArray
*
pTableCfg
;
// element is SNAME
bool
qNodeRequired
;
// valid qnode
bool
forceUpdate
;
}
SCatalogReq
;
...
...
@@ -88,6 +89,7 @@ typedef struct SMetaData {
SArray
*
pIndex
;
// pRes = SIndexInfo*
SArray
*
pUser
;
// pRes = bool*
SArray
*
pQnodeList
;
// pRes = SQueryNodeAddr*
SArray
*
pTableCfg
;
}
SMetaData
;
typedef
struct
SCatalogCfg
{
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
2dc7bcbe
...
...
@@ -28,6 +28,10 @@ extern "C" {
#define DESCRIBE_RESULT_TYPE_LEN (20 + VARSTR_HEADER_SIZE)
#define DESCRIBE_RESULT_NOTE_LEN (8 + VARSTR_HEADER_SIZE)
#define SHOW_CREATE_DB_RESULT_COLS 2
#define SHOW_CREATE_DB_RESULT_FIELD1_LEN (TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE)
#define SHOW_CREATE_DB_RESULT_FIELD2_LEN (TSDB_MAX_BINARY_LEN + VARSTR_HEADER_SIZE)
#define PRIVILEGE_TYPE_MASK(n) (1 << n)
#define PRIVILEGE_TYPE_ALL PRIVILEGE_TYPE_MASK(0)
...
...
@@ -218,7 +222,7 @@ typedef struct SShowCreateTableStmt {
ENodeType
type
;
char
dbName
[
TSDB_DB_NAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
STableMeta
*
pMeta
;
void
*
pCfg
;
// STableCfg
}
SShowCreateTableStmt
;
typedef
enum
EIndexType
{
INDEX_TYPE_SMA
=
1
,
INDEX_TYPE_FULLTEXT
}
EIndexType
;
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
2dc7bcbe
...
...
@@ -1394,7 +1394,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
if
(
orig
)
{
origType
=
orig
->
tableType
;
if
(
origType
==
meta
->
tableType
&&
orig
->
uid
==
meta
->
uid
&&
orig
->
sversion
>=
meta
->
sversion
&&
orig
->
tversion
>=
meta
->
tversion
)
{
if
(
origType
==
meta
->
tableType
&&
orig
->
uid
==
meta
->
uid
&&
(
origType
==
TSDB_CHILD_TABLE
||
(
orig
->
sversion
>=
meta
->
sversion
&&
orig
->
tversion
>=
meta
->
tversion
))
)
{
taosMemoryFree
(
meta
);
ctgDebug
(
"ignore table %s meta update"
,
tbName
);
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/command/src/command.c
浏览文件 @
2dc7bcbe
...
...
@@ -16,6 +16,7 @@
#include "command.h"
#include "catalog.h"
#include "tdatablock.h"
#include "tglobal.h"
static
int32_t
getSchemaBytes
(
const
SSchema
*
pSchema
)
{
switch
(
pSchema
->
type
)
{
...
...
@@ -123,7 +124,163 @@ static int32_t execDescribe(SNode* pStmt, SRetrieveTableRsp** pRsp) {
static
int32_t
execResetQueryCache
()
{
return
catalogClearCache
();
}
static
int32_t
execShowCreateDatabase
(
SShowCreateDatabaseStmt
*
pStmt
)
{
return
TSDB_CODE_FAILED
;
}
static
SSDataBlock
*
buildCreateDBResultDataBlock
()
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
info
.
numOfCols
=
SHOW_CREATE_DB_RESULT_COLS
;
pBlock
->
info
.
hasVarCol
=
true
;
pBlock
->
pDataBlock
=
taosArrayInit
(
pBlock
->
info
.
numOfCols
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_CREATE_DB_RESULT_FIELD1_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_CREATE_DB_RESULT_FIELD2_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
return
pBlock
;
}
int64_t
getValOfDiffPrecision
(
int8_t
unit
,
int64_t
val
)
{
int64_t
v
=
0
;
switch
(
unit
)
{
case
's'
:
v
=
val
/
1000
;
break
;
case
'm'
:
v
=
val
/
tsTickPerMin
[
TSDB_TIME_PRECISION_MILLI
];
break
;
case
'h'
:
v
=
val
/
(
tsTickPerMin
[
TSDB_TIME_PRECISION_MILLI
]
*
60
);
break
;
case
'd'
:
v
=
val
/
(
tsTickPerMin
[
TSDB_TIME_PRECISION_MILLI
]
*
24
*
60
);
break
;
case
'w'
:
v
=
val
/
(
tsTickPerMin
[
TSDB_TIME_PRECISION_MILLI
]
*
24
*
60
*
7
);
break
;
default:
break
;
}
return
v
;
}
char
*
buildRetension
(
SArray
*
pRetension
)
{
size_t
size
=
taosArrayGetSize
(
pRetension
);
if
(
size
==
0
)
{
return
NULL
;
}
char
*
p1
=
taosMemoryCalloc
(
1
,
100
);
SRetention
*
p
=
taosArrayGet
(
pRetension
,
0
);
int32_t
len
=
0
;
int64_t
v1
=
getValOfDiffPrecision
(
p
->
freqUnit
,
p
->
freq
);
int64_t
v2
=
getValOfDiffPrecision
(
p
->
keepUnit
,
p
->
keep
);
len
+=
sprintf
(
p1
+
len
,
"%"
PRId64
"%c:%"
PRId64
"%c"
,
v1
,
p
->
freqUnit
,
v2
,
p
->
keepUnit
);
if
(
size
>
1
)
{
len
+=
sprintf
(
p1
+
len
,
","
);
p
=
taosArrayGet
(
pRetension
,
1
);
v1
=
getValOfDiffPrecision
(
p
->
freqUnit
,
p
->
freq
);
v2
=
getValOfDiffPrecision
(
p
->
keepUnit
,
p
->
keep
);
len
+=
sprintf
(
p1
+
len
,
"%"
PRId64
"%c:%"
PRId64
"%c"
,
v1
,
p
->
freqUnit
,
v2
,
p
->
keepUnit
);
}
if
(
size
>
2
)
{
len
+=
sprintf
(
p1
+
len
,
","
);
p
=
taosArrayGet
(
pRetension
,
2
);
v1
=
getValOfDiffPrecision
(
p
->
freqUnit
,
p
->
freq
);
v2
=
getValOfDiffPrecision
(
p
->
keepUnit
,
p
->
keep
);
len
+=
sprintf
(
p1
+
len
,
"%"
PRId64
"%c:%"
PRId64
"%c"
,
v1
,
p
->
freqUnit
,
v2
,
p
->
keepUnit
);
}
return
p1
;
}
static
void
setCreateDBResultIntoDataBlock
(
SSDataBlock
*
pBlock
,
char
*
dbFName
,
SDbCfgInfo
*
pCfg
)
{
blockDataEnsureCapacity
(
pBlock
,
1
);
pBlock
->
info
.
rows
=
1
;
SColumnInfoData
*
pCol1
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
char
buf1
[
SHOW_CREATE_DB_RESULT_FIELD1_LEN
]
=
{
0
};
STR_TO_VARSTR
(
buf1
,
dbFName
);
colDataAppend
(
pCol1
,
0
,
buf1
,
false
);
SColumnInfoData
*
pCol2
=
taosArrayGet
(
pBlock
->
pDataBlock
,
1
);
char
buf2
[
SHOW_CREATE_DB_RESULT_FIELD2_LEN
]
=
{
0
};
int32_t
len
=
0
;
char
*
prec
=
NULL
;
switch
(
pCfg
->
precision
)
{
case
TSDB_TIME_PRECISION_MILLI
:
prec
=
TSDB_TIME_PRECISION_MILLI_STR
;
break
;
case
TSDB_TIME_PRECISION_MICRO
:
prec
=
TSDB_TIME_PRECISION_MICRO_STR
;
break
;
case
TSDB_TIME_PRECISION_NANO
:
prec
=
TSDB_TIME_PRECISION_NANO_STR
;
break
;
default:
prec
=
"none"
;
break
;
}
char
*
retentions
=
buildRetension
(
pCfg
->
pRetensions
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE DATABASE `%s` BUFFER %d CACHELAST %d COMP %d DURATION %dm "
"FSYNC %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"STRICT %d WAL %d VGROUPS %d SINGLE_STABLE %d"
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheLastRow
,
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
fsyncPeriod
,
pCfg
->
maxRows
,
pCfg
->
minRows
,
pCfg
->
daysToKeep0
,
pCfg
->
daysToKeep1
,
pCfg
->
daysToKeep2
,
pCfg
->
pages
,
pCfg
->
pageSize
,
prec
,
pCfg
->
replications
,
pCfg
->
strict
,
pCfg
->
walLevel
,
pCfg
->
numOfVgroups
,
1
==
pCfg
->
numOfStables
);
if
(
retentions
)
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
" RETENTIONS %s"
,
retentions
);
taosMemoryFree
(
retentions
);
}
(
varDataLen
(
buf2
))
=
len
;
colDataAppend
(
pCol2
,
0
,
buf2
,
false
);
}
static
int32_t
execShowCreateDatabase
(
SShowCreateDatabaseStmt
*
pStmt
,
SRetrieveTableRsp
**
pRsp
)
{
SSDataBlock
*
pBlock
=
buildCreateDBResultDataBlock
();
setCreateDBResultIntoDataBlock
(
pBlock
,
pStmt
->
dbName
,
pStmt
->
pCfg
);
size_t
rspSize
=
sizeof
(
SRetrieveTableRsp
)
+
blockGetEncodeSize
(
pBlock
);
*
pRsp
=
taosMemoryCalloc
(
1
,
rspSize
);
if
(
NULL
==
*
pRsp
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
pRsp
)
->
useconds
=
0
;
(
*
pRsp
)
->
completed
=
1
;
(
*
pRsp
)
->
precision
=
0
;
(
*
pRsp
)
->
compressed
=
0
;
(
*
pRsp
)
->
compLen
=
0
;
(
*
pRsp
)
->
numOfRows
=
htonl
(
1
);
(
*
pRsp
)
->
numOfCols
=
htonl
(
SHOW_CREATE_DB_RESULT_COLS
);
int32_t
len
=
0
;
blockCompressEncode
(
pBlock
,
(
*
pRsp
)
->
data
,
&
len
,
SHOW_CREATE_DB_RESULT_COLS
,
false
);
ASSERT
(
len
==
rspSize
-
sizeof
(
SRetrieveTableRsp
));
blockDataDestroy
(
pBlock
);
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
execShowCreateTable
(
SShowCreateTableStmt
*
pStmt
)
{
return
TSDB_CODE_FAILED
;
}
...
...
@@ -138,7 +295,7 @@ int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) {
case
QUERY_NODE_RESET_QUERY_CACHE_STMT
:
return
execResetQueryCache
();
case
QUERY_NODE_SHOW_CREATE_DATABASE_STMT
:
return
execShowCreateDatabase
((
SShowCreateDatabaseStmt
*
)
pStmt
);
return
execShowCreateDatabase
((
SShowCreateDatabaseStmt
*
)
pStmt
,
pRsp
);
case
QUERY_NODE_SHOW_CREATE_TABLE_STMT
:
return
execShowCreateTable
((
SShowCreateTableStmt
*
)
pStmt
);
case
QUERY_NODE_SHOW_CREATE_STABLE_STMT
:
...
...
source/libs/parser/inc/parUtil.h
浏览文件 @
2dc7bcbe
...
...
@@ -47,6 +47,7 @@ typedef struct SParseMetaCache {
SHashObj
*
pUserAuth
;
// key is SUserAuthInfo serialized string, element is bool indicating whether or not to pass
SHashObj
*
pUdf
;
// key is funcName, element is SFuncInfo*
SHashObj
*
pTableIndex
;
// key is tbFName, element is SArray<STableIndexInfo>*
SHashObj
*
pTableCfg
;
// key is tbFName, element is STableMeta*
}
SParseMetaCache
;
int32_t
generateSyntaxErrMsg
(
SMsgBuf
*
pBuf
,
int32_t
errCode
,
...);
...
...
@@ -77,6 +78,7 @@ int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pD
int32_t
reserveUserAuthInCacheExt
(
const
char
*
pUser
,
const
SName
*
pName
,
AUTH_TYPE
type
,
SParseMetaCache
*
pMetaCache
);
int32_t
reserveUdfInCache
(
const
char
*
pFunc
,
SParseMetaCache
*
pMetaCache
);
int32_t
reserveTableIndexInCache
(
int32_t
acctId
,
const
char
*
pDb
,
const
char
*
pTable
,
SParseMetaCache
*
pMetaCache
);
int32_t
reserveTableCfgInCache
(
int32_t
acctId
,
const
char
*
pDb
,
const
char
*
pTable
,
SParseMetaCache
*
pMetaCache
);
int32_t
getTableMetaFromCache
(
SParseMetaCache
*
pMetaCache
,
const
SName
*
pName
,
STableMeta
**
pMeta
);
int32_t
getDbVgInfoFromCache
(
SParseMetaCache
*
pMetaCache
,
const
char
*
pDbFName
,
SArray
**
pVgInfo
);
int32_t
getTableVgroupFromCache
(
SParseMetaCache
*
pMetaCache
,
const
SName
*
pName
,
SVgroupInfo
*
pVgroup
);
...
...
@@ -87,6 +89,7 @@ int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, con
bool
*
pPass
);
int32_t
getUdfInfoFromCache
(
SParseMetaCache
*
pMetaCache
,
const
char
*
pFunc
,
SFuncInfo
*
pInfo
);
int32_t
getTableIndexFromCache
(
SParseMetaCache
*
pMetaCache
,
const
SName
*
pName
,
SArray
**
pIndexes
);
int32_t
getTableCfgFromCache
(
SParseMetaCache
*
pMetaCache
,
const
char
*
pFunc
,
STableCfg
**
pInfo
);
void
destoryParseMetaCache
(
SParseMetaCache
*
pMetaCache
);
#ifdef __cplusplus
...
...
source/libs/parser/src/parAstParser.c
浏览文件 @
2dc7bcbe
...
...
@@ -402,7 +402,7 @@ static int32_t collectMetaKeyFromShowCreateDatabase(SCollectMetaKeyCxt* pCxt, SS
}
static
int32_t
collectMetaKeyFromShowCreateTable
(
SCollectMetaKeyCxt
*
pCxt
,
SShowCreateTableStmt
*
pStmt
)
{
return
reserveTable
Meta
InCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
return
reserveTable
Cfg
InCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
}
static
int32_t
collectMetaKeyFromShowApps
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
2dc7bcbe
...
...
@@ -133,6 +133,30 @@ static int32_t getTableMeta(STranslateContext* pCxt, const char* pDbName, const
return
getTableMetaImpl
(
pCxt
,
toName
(
pCxt
->
pParseCxt
->
acctId
,
pDbName
,
pTableName
,
&
name
),
pMeta
);
}
static
int32_t
getTableCfg
(
STranslateContext
*
pCxt
,
const
SName
*
pName
,
STableCfg
**
pCfg
)
{
SParseContext
*
pParCxt
=
pCxt
->
pParseCxt
;
int32_t
code
=
collectUseDatabase
(
pName
,
pCxt
->
pDbs
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
collectUseTable
(
pName
,
pCxt
->
pTables
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
pParCxt
->
async
)
{
code
=
getTableCfgFromCache
(
pCxt
->
pMetaCache
,
pName
,
pCfg
);
}
else
{
SRequestConnInfo
conn
=
{.
pTrans
=
pParCxt
->
pTransporter
,
.
requestId
=
pParCxt
->
requestId
,
.
requestObjRefId
=
pParCxt
->
requestRid
,
.
mgmtEps
=
pParCxt
->
mgmtEpSet
};
code
=
catalogGetTableCfg
(
pParCxt
->
pCatalog
,
&
conn
,
pName
,
pCfg
);
}
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
parserError
(
"catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s"
,
tstrerror
(
code
),
pName
->
dbname
,
pName
->
tname
);
}
return
code
;
}
static
int32_t
refreshGetTableMeta
(
STranslateContext
*
pCxt
,
const
char
*
pDbName
,
const
char
*
pTableName
,
STableMeta
**
pMeta
)
{
SParseContext
*
pParCxt
=
pCxt
->
pParseCxt
;
...
...
@@ -4168,7 +4192,7 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD
}
static
int32_t
translateShowCreateTable
(
STranslateContext
*
pCxt
,
SShowCreateTableStmt
*
pStmt
)
{
return
getTable
Meta
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
pStmt
->
pMeta
);
return
getTable
Cfg
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
(
STableCfg
*
)
&
pStmt
->
pCfg
);
}
static
int32_t
translateQuery
(
STranslateContext
*
pCxt
,
SNode
*
pNode
)
{
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
2dc7bcbe
...
...
@@ -559,6 +559,9 @@ int32_t buildCatalogReq(const SParseMetaCache* pMetaCache, SCatalogReq* pCatalog
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
buildTableReq
(
pMetaCache
->
pTableIndex
,
&
pCatalogReq
->
pTableIndex
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
buildTableReq
(
pMetaCache
->
pTableCfg
,
&
pCatalogReq
->
pTableCfg
);
}
return
code
;
}
...
...
@@ -654,6 +657,9 @@ int32_t putMetaDataToCache(const SCatalogReq* pCatalogReq, const SMetaData* pMet
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
putTableDataToCache
(
pCatalogReq
->
pTableIndex
,
pMetaData
->
pTableIndex
,
&
pMetaCache
->
pTableIndex
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
putTableDataToCache
(
pCatalogReq
->
pTableCfg
,
pMetaData
->
pTableCfg
,
&
pMetaCache
->
pTableCfg
);
}
return
code
;
}
...
...
@@ -859,6 +865,10 @@ int32_t reserveTableIndexInCache(int32_t acctId, const char* pDb, const char* pT
return
reserveTableReqInCache
(
acctId
,
pDb
,
pTable
,
&
pMetaCache
->
pTableIndex
);
}
int32_t
reserveTableCfgInCache
(
int32_t
acctId
,
const
char
*
pDb
,
const
char
*
pTable
,
SParseMetaCache
*
pMetaCache
)
{
return
reserveTableReqInCache
(
acctId
,
pDb
,
pTable
,
&
pMetaCache
->
pTableCfg
);
}
int32_t
getTableIndexFromCache
(
SParseMetaCache
*
pMetaCache
,
const
SName
*
pName
,
SArray
**
pIndexes
)
{
char
fullName
[
TSDB_TABLE_FNAME_LEN
];
tNameExtractFullName
(
pName
,
fullName
);
...
...
@@ -873,6 +883,20 @@ int32_t getTableIndexFromCache(SParseMetaCache* pMetaCache, const SName* pName,
return
code
;
}
int32_t
getTableCfgFromCache
(
SParseMetaCache
*
pMetaCache
,
const
char
*
pFunc
,
STableCfg
**
pOutput
)
{
char
fullName
[
TSDB_TABLE_FNAME_LEN
];
tNameExtractFullName
(
pName
,
fullName
);
STableCfg
*
pCfg
=
NULL
;
int32_t
code
=
getMetaDataFromHash
(
fullName
,
strlen
(
fullName
),
pMetaCache
->
pTableIndex
,
(
void
**
)
&
pCfg
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pOutput
=
tableCfgDup
(
pCfg
);
if
(
NULL
==
*
pOutput
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
}
return
code
;
}
void
destoryParseMetaCache
(
SParseMetaCache
*
pMetaCache
)
{
taosHashCleanup
(
pMetaCache
->
pTableMeta
);
taosHashCleanup
(
pMetaCache
->
pDbVgroup
);
...
...
@@ -882,4 +906,5 @@ void destoryParseMetaCache(SParseMetaCache* pMetaCache) {
taosHashCleanup
(
pMetaCache
->
pUserAuth
);
taosHashCleanup
(
pMetaCache
->
pUdf
);
taosHashCleanup
(
pMetaCache
->
pTableIndex
);
taosHashCleanup
(
pMetaCache
->
pTableCfg
);
}
source/libs/sync/src/syncMain.c
浏览文件 @
2dc7bcbe
...
...
@@ -1390,7 +1390,7 @@ void syncNodeUpdateConfig(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncIndex
syncUtilU642Addr
((
pSyncNode
->
replicasId
)[
i
].
addr
,
host
,
sizeof
(
host
),
&
port
);
do
{
char
eventLog
[
128
];
char
eventLog
[
256
];
snprintf
(
eventLog
,
sizeof
(
eventLog
),
"snapshot sender reset for %lu, newIndex:%d, %s:%d, %p"
,
(
pSyncNode
->
replicasId
)[
i
].
addr
,
i
,
host
,
port
,
oldSenders
[
j
]);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
...
...
@@ -1405,7 +1405,7 @@ void syncNodeUpdateConfig(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncIndex
(
pSyncNode
->
senders
)[
i
]
->
replicaIndex
=
i
;
do
{
char
eventLog
[
128
];
char
eventLog
[
256
];
snprintf
(
eventLog
,
sizeof
(
eventLog
),
"snapshot sender udpate replicaIndex from %d to %d, %s:%d, %p, reset:%d"
,
oldreplicaIndex
,
i
,
host
,
port
,
(
pSyncNode
->
senders
)[
i
],
reset
);
syncNodeEventLog
(
pSyncNode
,
eventLog
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录