Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
92c36a45
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
92c36a45
编写于
2月 23, 2017
作者:
H
Heikki Linnakangas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move tests for gp_toolkit.__gp_ao* functions from TINC to main test suite.
上级
071d76b1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
180 addition
and
113 deletion
+180
-113
src/test/regress/expected/gp_toolkit_ao_funcs.out
src/test/regress/expected/gp_toolkit_ao_funcs.out
+125
-0
src/test/regress/greenplum_schedule
src/test/regress/greenplum_schedule
+3
-2
src/test/regress/sql/gp_toolkit_ao_funcs.sql
src/test/regress/sql/gp_toolkit_ao_funcs.sql
+52
-0
src/test/tinc/tincrepo/mpp/gpdb/tests/storage/uao/uao_udf/gptoolkit_sql/gptoolkit_setup.sql
...sts/storage/uao/uao_udf/gptoolkit_sql/gptoolkit_setup.sql
+0
-14
src/test/tinc/tincrepo/mpp/gpdb/tests/storage/uao/uao_udf/test_gptoolkit.py
...repo/mpp/gpdb/tests/storage/uao/uao_udf/test_gptoolkit.py
+0
-97
未找到文件。
src/test/regress/expected/gp_toolkit_ao_funcs.out
0 → 100644
浏览文件 @
92c36a45
-- Run some basic tests on the gp_toolkit functions that deal with AO segfiles.
-- The exact output varies depending on cluster configuration and concurrent
-- activity in the system, so for most functions, we only do count(*). That
-- at least verifies that they don't crash.
-- Create test tables
--
-- We use DISTRIBUTED BY (c), and have the same c value in all the rows, to
-- put all the rows on the same segment. That way, the test output doesn't
-- depend on the number of segments.
DROP TABLE IF EXISTS toolkit_ao_test;
CREATE TABLE toolkit_ao_test (a INT, b INT, c INT)
WITH (appendonly=true) DISTRIBUTED BY (c);
INSERT INTO toolkit_ao_test SELECT i as a, i as b, 1 FROM generate_series(1,20) AS i;
UPDATE toolkit_ao_test SET b = 0 WHERE a = 1;
DELETE FROM toolkit_ao_test WHERE a = 2;
DROP TABLE IF EXISTS toolkit_aocs_test;
CREATE TABLE toolkit_aocs_test (a INT, b INT, C INT)
WITH (appendonly=true, orientation=column) DISTRIBUTED BY (c);
INSERT INTO toolkit_aocs_test SELECT i as a, i as b FROM generate_series(1,20) AS i;
UPDATE toolkit_aocs_test SET b = 0 WHERE a = 1;
DELETE FROM toolkit_aocs_test WHERE a = 2;
-- Investigate them with the gp_toolkit functions
SELECT count(*) FROM gp_toolkit.__gp_aoseg_history('toolkit_ao_test'::regclass);
count
-------
4
(1 row)
SELECT count(*) FROM gp_toolkit.__gp_aocsseg('toolkit_aocs_test'::regclass);
count
-------
3
(1 row)
SELECT count(*) FROM gp_toolkit.__gp_aocsseg_name('toolkit_aocs_test');
count
-------
3
(1 row)
SELECT count(*) FROM gp_toolkit.__gp_aocsseg_history('toolkit_aocs_test'::regclass);
count
-------
12
(1 row)
SELECT count(*) FROM gp_toolkit.__gp_aoseg_history('toolkit_ao_test'::regclass);
count
-------
4
(1 row)
SELECT * FROM gp_toolkit.__gp_aovisimap('toolkit_ao_test'::regclass);
tid | segno | row_num
-----+-------+---------
(0 rows)
SELECT * FROM gp_toolkit.__gp_aovisimap_name('toolkit_ao_test');
tid | segno | row_num
-----+-------+---------
(0 rows)
SELECT count(*) FROM gp_toolkit.__gp_aovisimap_hidden_info('toolkit_ao_test'::regclass);
count
-------
1
(1 row)
SELECT count(*) FROM gp_toolkit.__gp_aovisimap_hidden_info_name('toolkit_ao_test');
count
-------
1
(1 row)
SELECT * FROM gp_toolkit.__gp_aovisimap_entry('toolkit_ao_test'::regclass);
segno | first_row_num | hidden_tupcount | bitmap
-------+---------------+-----------------+--------
(0 rows)
SELECT * FROM gp_toolkit.__gp_aovisimap_entry_name('toolkit_ao_test');
segno | first_row_num | hidden_tupcount | bitmap
-------+---------------+-----------------+--------
(0 rows)
SELECT count(*) FROM gp_toolkit.__gp_aoseg_name('toolkit_ao_test');
count
-------
1
(1 row)
-- The same, but on the segments.
SELECT (t).* FROM (
SELECT gp_toolkit.__gp_aovisimap('toolkit_ao_test'::regclass) AS t FROM gp_dist_random('gp_id')
) AS x;
tid | segno | row_num
------------------+-------+---------
(33554432,32769) | 1 | 1
(33554432,32770) | 1 | 2
(2 rows)
SELECT (t).* FROM (
SELECT gp_toolkit.__gp_aovisimap_name('toolkit_ao_test') AS t FROM gp_dist_random('gp_id')
) AS x;
tid | segno | row_num
------------------+-------+---------
(33554432,32769) | 1 | 1
(33554432,32770) | 1 | 2
(2 rows)
SELECT (t).segno, (t).first_row_num, (t).hidden_tupcount >= 1 as hidden_tupcount_nonzero, (t).bitmap like '01%' as bitmap_starts_with_01 FROM (
SELECT gp_toolkit.__gp_aovisimap_entry('toolkit_ao_test'::regclass) AS t FROM gp_dist_random('gp_id')
) AS x;
segno | first_row_num | hidden_tupcount_nonzero | bitmap_starts_with_01
-------+---------------+-------------------------+-----------------------
1 | 0 | t | t
(1 row)
SELECT (t).segno, (t).first_row_num, (t).hidden_tupcount >= 1 as hidden_tupcount_nonzero, (t).bitmap like '01%' as bitmap_starts_with_01 FROM (
SELECT gp_toolkit.__gp_aovisimap_entry_name('toolkit_ao_test') AS t FROM gp_dist_random('gp_id')
) AS x;
segno | first_row_num | hidden_tupcount_nonzero | bitmap_starts_with_01
-------+---------------+-------------------------+-----------------------
1 | 0 | t | t
(1 row)
src/test/regress/greenplum_schedule
浏览文件 @
92c36a45
...
...
@@ -78,14 +78,15 @@ test: partition_indexing parruleord
test: alter_table_ao ao_create_alter_valid_table subtransaction_limit oid_consistency udf_exception_blocks
ignore: icudp_full
test: resource_queue
test: resource_queue
resource_queue_function
test: wrkloadadmin
# gp_toolkit performs a vacuum and checks that it truncated the relation. That
# might not happen if other backends are holding transactions open, preventing
# vacuum from removing dead tuples.
test: gp_toolkit
test:
filespace trig auth_constraint role rle portals_updatable plpgsql_cache timeseries resource_queue_function
pg_stat_last_operation gp_numeric_agg partindex_test partition_pruning_with_fn dsp runtime_stats
test:
gp_toolkit_ao_funcs filespace trig auth_constraint role rle portals_updatable plpgsql_cache timeseries
pg_stat_last_operation gp_numeric_agg partindex_test partition_pruning_with_fn dsp runtime_stats
# direct dispatch tests
test: direct_dispatch bfv_dd bfv_dd_multicolumn bfv_dd_types
...
...
src/test/regress/sql/gp_toolkit_ao_funcs.sql
0 → 100644
浏览文件 @
92c36a45
-- Run some basic tests on the gp_toolkit functions that deal with AO segfiles.
-- The exact output varies depending on cluster configuration and concurrent
-- activity in the system, so for most functions, we only do count(*). That
-- at least verifies that they don't crash.
-- Create test tables
--
-- We use DISTRIBUTED BY (c), and have the same c value in all the rows, to
-- put all the rows on the same segment. That way, the test output doesn't
-- depend on the number of segments.
DROP
TABLE
IF
EXISTS
toolkit_ao_test
;
CREATE
TABLE
toolkit_ao_test
(
a
INT
,
b
INT
,
c
INT
)
WITH
(
appendonly
=
true
)
DISTRIBUTED
BY
(
c
);
INSERT
INTO
toolkit_ao_test
SELECT
i
as
a
,
i
as
b
,
1
FROM
generate_series
(
1
,
20
)
AS
i
;
UPDATE
toolkit_ao_test
SET
b
=
0
WHERE
a
=
1
;
DELETE
FROM
toolkit_ao_test
WHERE
a
=
2
;
DROP
TABLE
IF
EXISTS
toolkit_aocs_test
;
CREATE
TABLE
toolkit_aocs_test
(
a
INT
,
b
INT
,
C
INT
)
WITH
(
appendonly
=
true
,
orientation
=
column
)
DISTRIBUTED
BY
(
c
);
INSERT
INTO
toolkit_aocs_test
SELECT
i
as
a
,
i
as
b
FROM
generate_series
(
1
,
20
)
AS
i
;
UPDATE
toolkit_aocs_test
SET
b
=
0
WHERE
a
=
1
;
DELETE
FROM
toolkit_aocs_test
WHERE
a
=
2
;
-- Investigate them with the gp_toolkit functions
SELECT
count
(
*
)
FROM
gp_toolkit
.
__gp_aoseg_history
(
'toolkit_ao_test'
::
regclass
);
SELECT
count
(
*
)
FROM
gp_toolkit
.
__gp_aocsseg
(
'toolkit_aocs_test'
::
regclass
);
SELECT
count
(
*
)
FROM
gp_toolkit
.
__gp_aocsseg_name
(
'toolkit_aocs_test'
);
SELECT
count
(
*
)
FROM
gp_toolkit
.
__gp_aocsseg_history
(
'toolkit_aocs_test'
::
regclass
);
SELECT
count
(
*
)
FROM
gp_toolkit
.
__gp_aoseg_history
(
'toolkit_ao_test'
::
regclass
);
SELECT
*
FROM
gp_toolkit
.
__gp_aovisimap
(
'toolkit_ao_test'
::
regclass
);
SELECT
*
FROM
gp_toolkit
.
__gp_aovisimap_name
(
'toolkit_ao_test'
);
SELECT
count
(
*
)
FROM
gp_toolkit
.
__gp_aovisimap_hidden_info
(
'toolkit_ao_test'
::
regclass
);
SELECT
count
(
*
)
FROM
gp_toolkit
.
__gp_aovisimap_hidden_info_name
(
'toolkit_ao_test'
);
SELECT
*
FROM
gp_toolkit
.
__gp_aovisimap_entry
(
'toolkit_ao_test'
::
regclass
);
SELECT
*
FROM
gp_toolkit
.
__gp_aovisimap_entry_name
(
'toolkit_ao_test'
);
SELECT
count
(
*
)
FROM
gp_toolkit
.
__gp_aoseg_name
(
'toolkit_ao_test'
);
-- The same, but on the segments.
SELECT
(
t
).
*
FROM
(
SELECT
gp_toolkit
.
__gp_aovisimap
(
'toolkit_ao_test'
::
regclass
)
AS
t
FROM
gp_dist_random
(
'gp_id'
)
)
AS
x
;
SELECT
(
t
).
*
FROM
(
SELECT
gp_toolkit
.
__gp_aovisimap_name
(
'toolkit_ao_test'
)
AS
t
FROM
gp_dist_random
(
'gp_id'
)
)
AS
x
;
SELECT
(
t
).
segno
,
(
t
).
first_row_num
,
(
t
).
hidden_tupcount
>=
1
as
hidden_tupcount_nonzero
,
(
t
).
bitmap
like
'01%'
as
bitmap_starts_with_01
FROM
(
SELECT
gp_toolkit
.
__gp_aovisimap_entry
(
'toolkit_ao_test'
::
regclass
)
AS
t
FROM
gp_dist_random
(
'gp_id'
)
)
AS
x
;
SELECT
(
t
).
segno
,
(
t
).
first_row_num
,
(
t
).
hidden_tupcount
>=
1
as
hidden_tupcount_nonzero
,
(
t
).
bitmap
like
'01%'
as
bitmap_starts_with_01
FROM
(
SELECT
gp_toolkit
.
__gp_aovisimap_entry_name
(
'toolkit_ao_test'
)
AS
t
FROM
gp_dist_random
(
'gp_id'
)
)
AS
x
;
src/test/tinc/tincrepo/mpp/gpdb/tests/storage/uao/uao_udf/gptoolkit_sql/gptoolkit_setup.sql
已删除
100644 → 0
浏览文件 @
071d76b1
-- start_ignore
SET
gp_create_table_random_default_distribution
=
off
;
-- end_ignore
DROP
TABLE
IF
EXISTS
foo
;
CREATE
TABLE
foo
(
a
INT
,
b
INT
)
WITH
(
appendonly
=
true
);
INSERT
INTO
foo
SELECT
i
as
a
,
i
as
b
FROM
generate_series
(
1
,
20
)
AS
i
;
UPDATE
foo
SET
b
=
0
WHERE
a
=
1
;
DELETE
FROM
foo
WHERE
a
=
2
;
DROP
TABLE
IF
EXISTS
foocs
;
CREATE
TABLE
foocs
(
a
INT
,
b
INT
)
WITH
(
appendonly
=
true
,
orientation
=
column
);
INSERT
INTO
foocs
SELECT
i
as
a
,
i
as
b
FROM
generate_series
(
1
,
20
)
AS
i
;
UPDATE
foocs
SET
b
=
0
WHERE
a
=
1
;
DELETE
FROM
foocs
WHERE
a
=
2
;
src/test/tinc/tincrepo/mpp/gpdb/tests/storage/uao/uao_udf/test_gptoolkit.py
已删除
100644 → 0
浏览文件 @
071d76b1
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from
mpp.models
import
MPPTestCase
from
mpp.lib.PSQL
import
PSQL
import
os
import
sys
class
UAOGPToolkitTestCase
(
MPPTestCase
):
"""
Test suite to test the ao diagnostics function in there
gp_toolkit version.
"""
def
get_oid
(
self
,
table_name
):
s
=
PSQL
.
run_sql_command
(
"SELECT oid from pg_class WHERE relname = '%s'"
%
table_name
);
return
int
(
s
.
splitlines
()[
3
])
def
get_utility_mode_port
():
"""
Gets the port number/hostname combination of the
dbid with the id = name
"""
o
=
PSQL
.
run_sql_command
(
"SELECT port FROM gp_segment_configuration WHERE dbid = 2"
).
splitlines
()[
3
]
return
o
utility_port
=
get_utility_mode_port
()
def
has_zero_rows
(
self
,
sql
,
utility
=
False
):
if
not
utility
:
o
=
PSQL
.
run_sql_command
(
sql
)
else
:
o
=
PSQL
.
run_sql_command_utility_mode
(
sql
,
port
=
self
.
utility_port
)
return
o
.
find
(
"(0 rows)"
)
>=
0
def
has_rows
(
self
,
sql
,
utility
=
False
):
if
not
utility
:
o
=
PSQL
.
run_sql_command
(
sql
)
else
:
o
=
PSQL
.
run_sql_command_utility_mode
(
sql
,
port
=
self
.
utility_port
)
return
(
o
.
find
(
"rows)"
)
>=
0
and
o
.
find
(
"(0 rows)"
)
<
0
)
or
o
.
find
(
"(1 row)"
)
>=
0
def
has_zero_rows
(
self
,
sql
,
utility
=
False
):
if
not
utility
:
o
=
PSQL
.
run_sql_command
(
sql
)
else
:
o
=
PSQL
.
run_sql_command_utility_mode
(
sql
,
port
=
self
.
utility_port
)
return
o
.
find
(
"(0 rows)"
)
>=
0
def
test_ao_co_diagnostics
(
self
):
base_dir
=
os
.
path
.
dirname
(
sys
.
modules
[
self
.
__class__
.
__module__
].
__file__
)
setup_file
=
os
.
path
.
join
(
base_dir
,
"gptoolkit_sql"
,
"gptoolkit_setup.sql"
);
PSQL
.
run_sql_file
(
setup_file
)
oid
=
self
.
get_oid
(
'foo'
);
oidcs
=
self
.
get_oid
(
'foocs'
);
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aoseg_history(%s)'
%
oid
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aocsseg(%s)'
%
oidcs
))
self
.
assertTrue
(
self
.
has_rows
(
"SELECT * FROM gp_toolkit.__gp_aocsseg_name('foocs')"
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aocsseg_history(%s)'
%
oidcs
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aoseg_history(%s)'
%
oid
))
self
.
assertTrue
(
self
.
has_zero_rows
(
'SELECT * FROM gp_toolkit.__gp_aovisimap(%s)'
%
oid
))
self
.
assertTrue
(
self
.
has_zero_rows
(
"SELECT * FROM gp_toolkit.__gp_aovisimap_name('foo')"
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aovisimap_hidden_info(%s)'
%
oid
))
self
.
assertTrue
(
self
.
has_rows
(
"SELECT * FROM gp_toolkit.__gp_aovisimap_hidden_info_name('foo')"
))
self
.
assertTrue
(
self
.
has_zero_rows
(
'SELECT * FROM gp_toolkit.__gp_aovisimap_entry(%s)'
%
oid
))
self
.
assertTrue
(
self
.
has_zero_rows
(
"SELECT * FROM gp_toolkit.__gp_aovisimap_entry_name('foo')"
))
self
.
assertTrue
(
self
.
has_rows
(
"SELECT * FROM gp_toolkit.__gp_aoseg_name('foo')"
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aoseg_history(%s)'
%
oid
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aocsseg(%s)'
%
oidcs
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
"SELECT * FROM gp_toolkit.__gp_aocsseg_name('foocs')"
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aocsseg_history(%s)'
%
oidcs
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aoseg_history(%s)'
%
oid
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aovisimap(%s)'
%
oid
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
"SELECT * FROM gp_toolkit.__gp_aovisimap_name('foo')"
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aovisimap_hidden_info(%s)'
%
oid
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
"SELECT * FROM gp_toolkit.__gp_aovisimap_hidden_info_name('foo')"
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
'SELECT * FROM gp_toolkit.__gp_aovisimap_entry(%s)'
%
oid
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
"SELECT * FROM gp_toolkit.__gp_aovisimap_entry_name('foo')"
,
True
))
self
.
assertTrue
(
self
.
has_rows
(
"SELECT * FROM gp_toolkit.__gp_aoseg_name('foo')"
,
True
))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录