Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
99c0648e
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,发现更多精彩内容 >>
提交
99c0648e
编写于
2月 22, 2016
作者:
C
Chumki Roy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed schema level dump with prefix option
上级
1559dba0
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
32 addition
and
4 deletion
+32
-4
gpMgmt/bin/gppylib/operations/dump.py
gpMgmt/bin/gppylib/operations/dump.py
+3
-2
gpMgmt/bin/gppylib/operations/test/unit/test_unit_dump.py
gpMgmt/bin/gppylib/operations/test/unit/test_unit_dump.py
+9
-2
gpMgmt/bin/gppylib/test/behave/mgmt_utils/backup.feature
gpMgmt/bin/gppylib/test/behave/mgmt_utils/backup.feature
+20
-0
未找到文件。
gpMgmt/bin/gppylib/operations/dump.py
浏览文件 @
99c0648e
...
...
@@ -877,6 +877,7 @@ class DumpDatabase(Operation):
These options get passed-through gp_dump to gp_dump_agent.
Commented out lines use escaping that would be reasonable, if gp_dump escaped properly.
"""
should_dump_schema
=
self
.
include_schema_file
is
not
None
if
self
.
dump_schema
:
logger
.
info
(
"Adding schema name %s"
%
self
.
dump_schema
)
dump_line
+=
" -n
\"\\\"
%s
\\\"\"
"
%
self
.
dump_schema
...
...
@@ -893,11 +894,11 @@ class DumpDatabase(Operation):
schema
,
table
=
split_fqn
(
dump_table
)
dump_line
+=
" --exclude-table=
\"\\\"
%s
\\\"\"
.
\"\\\"
%s
\\\"\"
"
%
(
schema
,
table
)
#dump_line += " --exclude-table=\"%s\".\"%s\"" % (schema, table)
if
self
.
include_dump_tables_file
is
not
None
:
if
self
.
include_dump_tables_file
is
not
None
and
not
should_dump_schema
:
dump_line
+=
" --table-file=%s"
%
self
.
include_dump_tables_file
if
self
.
exclude_dump_tables_file
is
not
None
:
dump_line
+=
" --exclude-table-file=%s"
%
self
.
exclude_dump_tables_file
if
s
elf
.
include_schema_file
is
not
None
and
not
self
.
dump_prefix
:
if
s
hould_dump_schema
:
dump_line
+=
" --schema-file=%s"
%
self
.
include_schema_file
for
opt
in
self
.
output_options
:
...
...
gpMgmt/bin/gppylib/operations/test/unit/test_unit_dump.py
浏览文件 @
99c0648e
...
...
@@ -985,9 +985,9 @@ class DumpTestCase(unittest.TestCase):
self
.
assertEqual
(
ts_key
[
0
:
8
],
DUMP_DATE
)
def
test_create_dump_line_00
(
self
):
self
.
dumper
.
include_schema_file
=
'/tmp/
foo
'
self
.
dumper
.
include_schema_file
=
'/tmp/
schema_file
'
output
=
self
.
dumper
.
create_dump_string
(
'dcddev'
,
'20121212'
,
'01234567891234'
)
expected_output
=
"""gp_dump -p 0 -U dcddev --gp-d=/data/master/p1/db_dumps/20121212 --gp-r=/data/master/p1/db_dumps/20121212 --gp-s=p --gp-k=01234567891234 --no-lock --gp-c --no-expand-children -n "
\\
"testschema
\\
"" "testdb" --
table-file=/tmp/table_list.txt --schema-file=/tmp/foo
"""
expected_output
=
"""gp_dump -p 0 -U dcddev --gp-d=/data/master/p1/db_dumps/20121212 --gp-r=/data/master/p1/db_dumps/20121212 --gp-s=p --gp-k=01234567891234 --no-lock --gp-c --no-expand-children -n "
\\
"testschema
\\
"" "testdb" --
schema-file=/tmp/schema_file
"""
self
.
assertEquals
(
output
,
expected_output
)
def
test00_create_dump_line_with_prefix
(
self
):
...
...
@@ -1019,6 +1019,13 @@ class DumpTestCase(unittest.TestCase):
expected_output
=
"""gp_dump -p 0 -U dcddev --gp-d=/data/master/p1/db_dumps/20121212 --gp-r=/data/master/p1/db_dumps/20121212 --gp-s=p --gp-k=01234567891234 --no-lock --gp-c --no-expand-children -n "
\\
"testschema
\\
"" "testdb" --netbackup-service-host=mdw --netbackup-policy=test_policy --netbackup-schedule=test_schedule"""
self
.
assertEquals
(
output
,
expected_output
)
def
test_create_dump_line_with_prefix_schema_level_dump
(
self
):
self
.
dumper
.
dump_prefix
=
'foo_'
self
.
dumper
.
include_schema_file
=
'/tmp/schema_file '
output
=
self
.
dumper
.
create_dump_string
(
'dcddev'
,
'20121212'
,
'01234567891234'
)
expected_output
=
"""gp_dump -p 0 -U dcddev --gp-d=/data/master/p1/db_dumps/20121212 --gp-r=/data/master/p1/db_dumps/20121212 --gp-s=p --gp-k=01234567891234 --no-lock --gp-c --prefix=foo_ --no-expand-children -n "
\\
"testschema
\\
"" "testdb" --schema-file=/tmp/schema_file """
self
.
assertEquals
(
output
,
expected_output
)
def
test_get_backup_dir_with_master_data_dir
(
self
):
master_datadir
=
'/foo'
backup_dir
=
None
...
...
gpMgmt/bin/gppylib/test/behave/mgmt_utils/backup.feature
浏览文件 @
99c0648e
...
...
@@ -3362,6 +3362,26 @@ Feature: Validate command line arguments
Then
gpdbrestore should print Table public.heap_table2 not found in backup to stdout
Then
gpdbrestore should not print Issue with 'ANALYZE' of restored table 'public.heap_table2' in 'bkdb' database to stdout
@backupfire
Scenario
:
Full Backup with option --schema-file with prefix option and Restore
Given
the test is initialized
And
the prefix
"foo"
is stored
And
there is schema
"schema_heap, schema_ao, testschema"
exists in
"bkdb"
And
there is a
"heap"
table
"schema_heap.heap_table"
in
"bkdb"
with data
And
there is a
"heap"
table
"testschema.heap_table"
in
"bkdb"
with data
And
there is a
"ao"
partition table
"schema_ao.ao_part_table"
in
"bkdb"
with data
And
there is a backupfile of tables
"schema_heap.heap_table, schema_ao.ao_part_table, testschema.heap_table"
in
"bkdb"
exists for validation
And
there is a file
"include_file"
with tables
"schema_heap|schema_ao"
When
the user runs
"gpcrondump -a -x bkdb --schema-file include_file --prefix=foo"
Then
gpcrondump should return a return code of 0
And
the timestamp from gpcrondump is stored
And verify that the "report" file in " " dir contains "Backup Type
:
Full"
When
the user runs gpdbrestore with the stored timestamp and options
"--prefix=foo"
Then
gpdbrestore should return a return code of 0
And
verify that there is a
"heap"
table
"schema_heap.heap_table"
in
"bkdb"
with data
And
verify that there is a
"ao"
table
"schema_ao.ao_part_table"
in
"bkdb"
with data
And
verify that there is no table
"testschema.heap_table"
in
"bkdb"
# THIS SHOULD BE THE LAST TEST
@backupfire
Scenario
:
cleanup for backup feature
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录