Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2a507487
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看板
提交
2a507487
编写于
3月 02, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: add missing db options in show create database result
上级
0fe9b5ca
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
44 addition
and
6 deletion
+44
-6
include/common/tmsg.h
include/common/tmsg.h
+7
-0
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+1
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+14
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+7
-0
source/libs/command/src/command.c
source/libs/command/src/command.c
+10
-6
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+5
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
2a507487
...
...
@@ -929,12 +929,19 @@ typedef struct {
int32_t
minRows
;
int32_t
maxRows
;
int32_t
walFsyncPeriod
;
int16_t
hashPrefix
;
int16_t
hashSuffix
;
int8_t
walLevel
;
int8_t
precision
;
int8_t
compression
;
int8_t
replications
;
int8_t
strict
;
int8_t
cacheLast
;
int32_t
tsdbPageSize
;
int32_t
walRetentionPeriod
;
int32_t
walRollPeriod
;
int64_t
walRetentionSize
;
int64_t
walSegmentSize
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
int8_t
schemaless
;
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
2a507487
...
...
@@ -265,6 +265,7 @@ typedef struct SShowStmt {
typedef
struct
SShowCreateDatabaseStmt
{
ENodeType
type
;
char
dbName
[
TSDB_DB_NAME_LEN
];
char
dbFName
[
TSDB_DB_FNAME_LEN
];
void
*
pCfg
;
// SDbCfgInfo
}
SShowCreateDatabaseStmt
;
...
...
source/common/src/tmsg.c
浏览文件 @
2a507487
...
...
@@ -2865,12 +2865,19 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
minRows
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
maxRows
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
walFsyncPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI16
(
&
encoder
,
pRsp
->
hashPrefix
)
<
0
)
return
-
1
;
if
(
tEncodeI16
(
&
encoder
,
pRsp
->
hashSuffix
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
walLevel
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
precision
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
compression
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
replications
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
strict
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
cacheLast
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
tsdbPageSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
walRetentionPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
walRollPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
walRetentionSize
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
walSegmentSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
numOfRetensions
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pRsp
->
numOfRetensions
;
++
i
)
{
SRetention
*
pRetension
=
taosArrayGet
(
pRsp
->
pRetensions
,
i
);
...
...
@@ -2905,12 +2912,19 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
minRows
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
maxRows
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
walFsyncPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI16
(
&
decoder
,
&
pRsp
->
hashPrefix
)
<
0
)
return
-
1
;
if
(
tDecodeI16
(
&
decoder
,
&
pRsp
->
hashSuffix
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
walLevel
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
precision
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
compression
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
replications
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
cacheLast
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
tsdbPageSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
walRetentionPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
walRollPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
walRetentionSize
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
walSegmentSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfRetensions
)
<
0
)
return
-
1
;
if
(
pRsp
->
numOfRetensions
>
0
)
{
pRsp
->
pRetensions
=
taosArrayInit
(
pRsp
->
numOfRetensions
,
sizeof
(
SRetention
));
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
2a507487
...
...
@@ -887,12 +887,19 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
cfgRsp
.
minRows
=
pDb
->
cfg
.
minRows
;
cfgRsp
.
maxRows
=
pDb
->
cfg
.
maxRows
;
cfgRsp
.
walFsyncPeriod
=
pDb
->
cfg
.
walFsyncPeriod
;
cfgRsp
.
hashPrefix
=
pDb
->
cfg
.
hashPrefix
;
cfgRsp
.
hashSuffix
=
pDb
->
cfg
.
hashSuffix
;
cfgRsp
.
walLevel
=
pDb
->
cfg
.
walLevel
;
cfgRsp
.
precision
=
pDb
->
cfg
.
precision
;
cfgRsp
.
compression
=
pDb
->
cfg
.
compression
;
cfgRsp
.
replications
=
pDb
->
cfg
.
replications
;
cfgRsp
.
strict
=
pDb
->
cfg
.
strict
;
cfgRsp
.
cacheLast
=
pDb
->
cfg
.
cacheLast
;
cfgRsp
.
tsdbPageSize
=
pDb
->
cfg
.
tsdbPageSize
;
cfgRsp
.
walRetentionPeriod
=
pDb
->
cfg
.
walRetentionPeriod
;
cfgRsp
.
walRollPeriod
=
pDb
->
cfg
.
walRollPeriod
;
cfgRsp
.
walRetentionSize
=
pDb
->
cfg
.
walRetentionSize
;
cfgRsp
.
walSegmentSize
=
pDb
->
cfg
.
walSegmentSize
;
cfgRsp
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
cfgRsp
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
cfgRsp
.
schemaless
=
pDb
->
cfg
.
schemaless
;
...
...
source/libs/command/src/command.c
浏览文件 @
2a507487
...
...
@@ -248,13 +248,13 @@ static const char* cacheModelStr(int8_t cacheModel) {
return
TSDB_CACHE_MODEL_NONE_STR
;
}
static
void
setCreateDBResultIntoDataBlock
(
SSDataBlock
*
pBlock
,
char
*
dbFName
,
SDbCfgInfo
*
pCfg
)
{
static
void
setCreateDBResultIntoDataBlock
(
SSDataBlock
*
pBlock
,
char
*
db
Name
,
char
*
db
FName
,
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
,
db
F
Name
);
STR_TO_VARSTR
(
buf1
,
dbName
);
colDataSetVal
(
pCol1
,
0
,
buf1
,
false
);
SColumnInfoData
*
pCol2
=
taosArrayGet
(
pBlock
->
pDataBlock
,
1
);
...
...
@@ -277,16 +277,20 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
}
char
*
retentions
=
buildRetension
(
pCfg
->
pRetensions
);
int32_t
dbFNameLen
=
strlen
(
dbFName
);
int32_t
hashPrefix
=
(
pCfg
->
hashPrefix
>
(
dbFNameLen
+
1
))
?
(
pCfg
->
hashPrefix
-
dbFNameLen
-
1
)
:
0
;
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d"
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheSize
,
cacheModelStr
(
pCfg
->
cacheLast
),
pCfg
->
compression
,
pCfg
->
daysPerFile
,
"WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d "
"WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %"
PRId64
" WAL_ROLL_PERIOD %d WAL_SEGMENT_SIZE %"
PRId64
,
dbName
,
pCfg
->
buffer
,
pCfg
->
cacheSize
,
cacheModelStr
(
pCfg
->
cacheLast
),
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
walFsyncPeriod
,
pCfg
->
maxRows
,
pCfg
->
minRows
,
pCfg
->
sstTrigger
,
pCfg
->
daysToKeep0
,
pCfg
->
daysToKeep1
,
pCfg
->
daysToKeep2
,
pCfg
->
pages
,
pCfg
->
pageSize
,
prec
,
pCfg
->
replications
,
pCfg
->
walLevel
,
pCfg
->
numOfVgroups
,
1
==
pCfg
->
numOfStables
);
1
==
pCfg
->
numOfStables
,
hashPrefix
,
pCfg
->
hashSuffix
,
pCfg
->
tsdbPageSize
,
pCfg
->
walRetentionPeriod
,
pCfg
->
walRetentionSize
,
pCfg
->
walRollPeriod
,
pCfg
->
walSegmentSize
);
if
(
retentions
)
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
" RETENTIONS %s"
,
retentions
);
...
...
@@ -404,7 +408,7 @@ static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveT
SSDataBlock
*
pBlock
=
NULL
;
int32_t
code
=
buildCreateDBResultDataBlock
(
&
pBlock
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
setCreateDBResultIntoDataBlock
(
pBlock
,
pStmt
->
dbName
,
pStmt
->
pCfg
);
setCreateDBResultIntoDataBlock
(
pBlock
,
pStmt
->
dbName
,
pStmt
->
dbFName
,
pStmt
->
pCfg
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
buildRetrieveTableRsp
(
pBlock
,
SHOW_CREATE_DB_RESULT_COLS
,
pRsp
);
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
2a507487
...
...
@@ -6477,6 +6477,11 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD
if
(
NULL
==
pStmt
->
pCfg
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
SName
name
;
tNameSetDbName
(
&
name
,
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
strlen
(
pStmt
->
dbName
));
tNameGetFullDbName
(
&
name
,
pStmt
->
dbFName
);
return
getDBCfg
(
pCxt
,
pStmt
->
dbName
,
(
SDbCfgInfo
*
)
pStmt
->
pCfg
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录