Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
978f7339
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看板
提交
978f7339
编写于
6月 04, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(query): add retension for the results of show databases;
上级
0c94c65a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
114 addition
and
48 deletion
+114
-48
source/common/src/systable.c
source/common/src/systable.c
+4
-3
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+68
-3
tests/script/tsim/testsuit.sim
tests/script/tsim/testsuit.sim
+42
-42
未找到文件。
source/common/src/systable.c
浏览文件 @
978f7339
...
...
@@ -87,11 +87,12 @@ static const SSysDbTableSchema userDBSchema[] = {
{.
name
=
"wal"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"fsync"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"comp"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"cache
last"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"cache
_model"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"precision"
,
.
bytes
=
2
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"single_stable
"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"single_stable
_model"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_BOOL
},
{.
name
=
"status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"schemaless"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"schemaless"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_BOOL
},
{.
name
=
"retension"
,
.
bytes
=
60
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
// {.name = "update", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, // disable update
};
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
978f7339
...
...
@@ -1428,6 +1428,52 @@ const char *mndGetDbStr(const char *src) {
return
pos
;
}
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
=
2
;
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
);
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
);
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
);
varDataSetLen
(
p1
,
len
);
return
p1
;
}
static
void
dumpDbInfoData
(
SSDataBlock
*
pBlock
,
SDbObj
*
pDb
,
SShowObj
*
pShow
,
int32_t
rows
,
int64_t
numOfTables
,
bool
sysDb
)
{
int32_t
cols
=
0
;
...
...
@@ -1475,7 +1521,7 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
replications
,
false
);
const
char
*
src
=
pDb
->
cfg
.
strict
?
"strict"
:
"nostrict"
;
const
char
*
src
=
pDb
->
cfg
.
strict
?
"strict"
:
"no
_
strict"
;
char
strict
[
24
]
=
{
0
};
STR_WITH_SIZE_TO_VARSTR
(
strict
,
src
,
strlen
(
src
));
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
...
...
@@ -1523,7 +1569,16 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
compression
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
cacheLastRow
,
false
);
STR_WITH_SIZE_TO_VARSTR
(
strict
,
src
,
strlen
(
src
));
char
cacheModel
[
24
]
=
{
0
};
if
(
pDb
->
cfg
.
cacheLastRow
==
0
)
{
STR_TO_VARSTR
(
cacheModel
,
"no_cache"
);
}
else
{
//
}
colDataAppend
(
pColInfo
,
rows
,
cacheModel
,
false
);
char
*
prec
=
NULL
;
switch
(
pDb
->
cfg
.
precision
)
{
...
...
@@ -1552,8 +1607,18 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
statusB
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
schemaless
,
false
);
char
*
p
=
buildRetension
(
pDb
->
cfg
.
pRetensions
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
if
(
p
==
NULL
)
{
colDataAppendNULL
(
pColInfo
,
rows
);
}
else
{
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
p
,
false
);
taosMemoryFree
(
p
);
}
}
}
...
...
tests/script/tsim/testsuit.sim
浏览文件 @
978f7339
run tsim/user/pass_alter.sim
run tsim/user/basic1.sim
run tsim/user/privilege2.sim
run tsim/user/user_len.sim
run tsim/user/privilege1.sim
run tsim/user/pass_len.sim
run tsim/table/basic1.sim
run tsim/trans/lossdata1.sim
run tsim/trans/create_db.sim
run tsim/stable/alter_metrics.sim
run tsim/stable/tag_modify.sim
run tsim/stable/alter_comment.sim
run tsim/stable/column_drop.sim
run tsim/stable/column_modify.sim
run tsim/stable/tag_rename.sim
run tsim/stable/vnode3.sim
run tsim/stable/metrics.sim
run tsim/stable/alter_insert2.sim
run tsim/stable/show.sim
run tsim/stable/alter_import.sim
run tsim/stable/tag_add.sim
run tsim/stable/tag_drop.sim
run tsim/stable/column_add.sim
run tsim/stable/alter_count.sim
run tsim/stable/values.sim
run tsim/stable/dnode3.sim
run tsim/stable/alter_insert1.sim
run tsim/stable/refcount.sim
run tsim/stable/disk.sim
run tsim/db/basic1.sim
run tsim/db/basic3.sim
run tsim/db/basic7.sim
run tsim/db/basic6.sim
run tsim/db/create_all_options.sim
run tsim/db/basic2.sim
run tsim/db/error1.sim
run tsim/db/taosdlog.sim
run tsim/db/alter_option.sim
run tsim/mnode/basic1.sim
run tsim/mnode/basic3.sim
run tsim/mnode/basic2.sim
run tsim/parser/fourArithmetic-basic.sim
#
run tsim/user/pass_alter.sim
#
run tsim/user/basic1.sim
#
run tsim/user/privilege2.sim
#
run tsim/user/user_len.sim
#
run tsim/user/privilege1.sim
##
run tsim/user/pass_len.sim
##
run tsim/table/basic1.sim
#
run tsim/trans/lossdata1.sim
#
run tsim/trans/create_db.sim
##
run tsim/stable/alter_metrics.sim
##
run tsim/stable/tag_modify.sim
##
run tsim/stable/alter_comment.sim
##
run tsim/stable/column_drop.sim
##
run tsim/stable/column_modify.sim
##
run tsim/stable/tag_rename.sim
##
run tsim/stable/vnode3.sim
##
run tsim/stable/metrics.sim
##
run tsim/stable/alter_insert2.sim
##
run tsim/stable/show.sim
##
run tsim/stable/alter_import.sim
##
run tsim/stable/tag_add.sim
##
run tsim/stable/tag_drop.sim
##
run tsim/stable/column_add.sim
##
run tsim/stable/alter_count.sim
##
run tsim/stable/values.sim
##
run tsim/stable/dnode3.sim
##
run tsim/stable/alter_insert1.sim
##
run tsim/stable/refcount.sim
##
run tsim/stable/disk.sim
#
run tsim/db/basic1.sim
#
run tsim/db/basic3.sim
##
run tsim/db/basic7.sim
#
run tsim/db/basic6.sim
#
run tsim/db/create_all_options.sim
#
run tsim/db/basic2.sim
#
run tsim/db/error1.sim
#
run tsim/db/taosdlog.sim
#
run tsim/db/alter_option.sim
#
run tsim/mnode/basic1.sim
#
run tsim/mnode/basic3.sim
#
run tsim/mnode/basic2.sim
#
run tsim/parser/fourArithmetic-basic.sim
run tsim/parser/groupby-basic.sim
run tsim/snode/basic1.sim
run tsim/query/time_process.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录