Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
089c7c0a
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,体验更适合开发者的 AI 搜索 >>
提交
089c7c0a
编写于
2月 25, 2016
作者:
A
Abhijit Subramanya
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup some leftover changes in gpMgmt from error tables removal.
上级
ef145fe3
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
19 addition
and
108 deletion
+19
-108
gpMgmt/bin/gpload.py
gpMgmt/bin/gpload.py
+15
-30
gpMgmt/bin/gppylib/test/behave/mgmt_utils/gpload.feature
gpMgmt/bin/gppylib/test/behave/mgmt_utils/gpload.feature
+0
-12
gpMgmt/bin/gppylib/test/behave/mgmt_utils/steps/data/gpload_reuse_ext_errtbl_1.yml
...ehave/mgmt_utils/steps/data/gpload_reuse_ext_errtbl_1.yml
+0
-29
gpMgmt/bin/gppylib/test/behave/mgmt_utils/steps/data/gpload_reuse_ext_errtbl_2.yml
...ehave/mgmt_utils/steps/data/gpload_reuse_ext_errtbl_2.yml
+0
-29
gpMgmt/bin/gppylib/test/unit/test_unit_gpload.py
gpMgmt/bin/gppylib/test/unit/test_unit_gpload.py
+1
-5
gpMgmt/demo/gpfdist_transform/1_dblp.yaml
gpMgmt/demo/gpfdist_transform/1_dblp.yaml
+1
-1
gpMgmt/demo/gpfdist_transform/2_mef.yaml
gpMgmt/demo/gpfdist_transform/2_mef.yaml
+1
-1
gpMgmt/demo/gpfdist_transform/3_rig.yaml
gpMgmt/demo/gpfdist_transform/3_rig.yaml
+1
-1
未找到文件。
gpMgmt/bin/gpload.py
浏览文件 @
089c7c0a
...
...
@@ -1447,6 +1447,8 @@ class gpload:
# like libpq, just inherit USER
self
.
options
.
d
=
self
.
options
.
U
if
self
.
getconfig
(
'gpload:input:error_table'
,
unicode
,
None
):
self
.
control_file_error
(
"ERROR_TABLE is not supported. Please use LOG_ERRORS instead."
)
def
gpfdist_port_options
(
self
,
name
,
availablePorts
,
popenList
):
"""
...
...
@@ -1965,7 +1967,7 @@ class gpload:
# This function will return the SQL to run in order to find out whether
# such a table exists.
#
def
get_reuse_exttable_query
(
self
,
formatType
,
formatOpts
,
limitStr
,
errorTableOid
,
from_cols
,
schemaName
,
log_errors
):
def
get_reuse_exttable_query
(
self
,
formatType
,
formatOpts
,
limitStr
,
from_cols
,
schemaName
,
log_errors
):
sqlFormat
=
"""select attrelid::regclass
from (
select
...
...
@@ -2008,9 +2010,7 @@ class gpload:
sql
=
sqlFormat
%
(
joinStr
,
conditionStr
)
if
errorTableOid
:
sql
+=
" WHERE pgext.fmterrtbl = %d
\n
"
%
errorTableOid
elif
log_errors
:
if
log_errors
:
sql
+=
" WHERE pgext.fmterrtbl = pgext.reloid "
else
:
sql
+=
" WHERE pgext.fmterrtbl IS NULL "
...
...
@@ -2174,9 +2174,6 @@ class gpload:
encodingStr
=
self
.
getconfig
(
'gpload:input:encoding'
,
unicode
,
None
)
limitStr
=
self
.
getconfig
(
'gpload:input:error_limit'
,
int
,
None
)
if
self
.
error_table
and
not
limitStr
:
self
.
control_file_error
(
"gpload:input:error_table requires "
+
"gpload:input:error_limit to be specified"
)
if
self
.
log_errors
and
not
limitStr
:
self
.
control_file_error
(
"gpload:input:log_errors requires "
+
"gpload:input:error_limit to be specified"
)
...
...
@@ -2198,17 +2195,15 @@ class gpload:
# the one that we need to use. It must have identical attributes,
# external location, format, and encoding specifications.
if
self
.
reuse_tables
==
True
:
if
(
not
self
.
error_table
or
self
.
error_table_oid
):
sql
=
self
.
get_reuse_exttable_query
(
formatType
,
formatOpts
,
limitStr
,
self
.
error_table_oid
,
from_cols
,
self
.
extSchemaName
,
self
.
log_errors
)
resultList
=
self
.
db
.
query
(
sql
.
encode
(
'utf-8'
)).
getresult
()
if
len
(
resultList
)
>
0
:
# found an external table to reuse. no need to create one. we're done here.
self
.
extTableName
=
(
resultList
[
0
])[
0
]
self
.
extSchemaTable
=
self
.
extTableName
self
.
log
(
self
.
INFO
,
"reusing external table %s"
%
self
.
extSchemaTable
)
return
sql
=
self
.
get_reuse_exttable_query
(
formatType
,
formatOpts
,
limitStr
,
from_cols
,
self
.
extSchemaName
,
self
.
log_errors
)
resultList
=
self
.
db
.
query
(
sql
.
encode
(
'utf-8'
)).
getresult
()
if
len
(
resultList
)
>
0
:
# found an external table to reuse. no need to create one. we're done here.
self
.
extTableName
=
(
resultList
[
0
])[
0
]
self
.
extSchemaTable
=
self
.
extTableName
self
.
log
(
self
.
INFO
,
"reusing external table %s"
%
self
.
extSchemaTable
)
return
# didn't find an existing external table suitable for reuse. Format a reusable
# name and issue a CREATE EXTERNAL TABLE on it. Hopefully we can use it next time
...
...
@@ -2228,8 +2223,6 @@ class gpload:
sql
+=
"(%s) "
%
formatOpts
if
encodingStr
:
sql
+=
"encoding%s "
%
quote
(
encodingStr
)
if
self
.
error_table
:
sql
+=
"log errors into %s "
%
self
.
error_table
if
self
.
log_errors
:
sql
+=
"log errors "
...
...
@@ -2332,12 +2325,9 @@ class gpload:
def
count_errors
(
self
):
notice_processor
(
self
)
if
(
self
.
error_table
or
self
.
log_errors
)
and
not
self
.
options
.
D
and
not
self
.
reuse_tables
:
if
self
.
log_errors
and
not
self
.
options
.
D
and
not
self
.
reuse_tables
:
# make sure we only get errors for our own instance
if
self
.
error_table
:
queryStr
=
'select count(*) from '
+
self
.
error_table
+
" WHERE relname = '%s'"
%
self
.
extTableName
else
:
queryStr
=
"select count(*) from gp_read_error_log('%s')"
%
self
.
extTableName
queryStr
=
"select count(*) from gp_read_error_log('%s')"
%
pg
.
escape_string
(
self
.
extTableName
)
results
=
self
.
db
.
query
(
queryStr
.
encode
(
'utf-8'
)).
getresult
()
return
(
results
[
0
])[
0
]
return
0
...
...
@@ -2582,15 +2572,10 @@ class gpload:
# Is the table to be truncated before the load?
preload
=
self
.
getconfig
(
'gpload:preload'
,
list
,
default
=
None
)
method
=
self
.
getconfig
(
'gpload:output:mode'
,
unicode
,
'insert'
).
lower
()
self
.
error_table
=
self
.
getconfig
(
'gpload:input:error_table'
,
unicode
,
None
)
self
.
log_errors
=
self
.
getconfig
(
'gpload:input:log_errors'
,
bool
,
False
)
if
self
.
error_table
and
self
.
log_errors
:
self
.
control_file_error
(
"gpload:input:log_errors and gpload:input:error_table are not allowd to use together."
)
truncate
=
False
self
.
reuse_tables
=
False
self
.
error_table_oid
=
self
.
get_table_oid
(
self
.
error_table
)
if
not
self
.
options
.
no_auto_trans
and
not
method
==
'insert'
:
self
.
db
.
query
(
"BEGIN"
)
...
...
gpMgmt/bin/gppylib/test/behave/mgmt_utils/gpload.feature
浏览文件 @
089c7c0a
...
...
@@ -106,18 +106,6 @@ Feature: gpload tests
|
count
|
|
1
|
@gpload_reuse_errtbl
Scenario
:
gpload reuse external table as error table name is case insensitive
Given
the database is running
And
the database
"testdb"
does not exist
And
database
"testdb"
exists
When
the user runs the query
"create table tbl1 (id int, msg text) distributed by (id)"
on
"testdb"
And
the user runs command
"gpload -f gppylib/test/behave/mgmt_utils/steps/data/gpload_reuse_ext_errtbl_1.yml"
Then
the client program should print did not find an external table to reuse to stdout
When
the user runs command
"gpload -f gppylib/test/behave/mgmt_utils/steps/data/gpload_reuse_ext_errtbl_2.yml"
Then
the client program should print reusing external table to stdout
@gpload_target_not_exist
Scenario
:
gpload output error message when target table not exists
Given
the database is running
...
...
gpMgmt/bin/gppylib/test/behave/mgmt_utils/steps/data/gpload_reuse_ext_errtbl_1.yml
已删除
100644 → 0
浏览文件 @
ef145fe3
VERSION
:
1.0.0.1
DATABASE
:
testdb
GPLOAD
:
INPUT
:
-
SOURCE
:
PORT_RANGE
:
[
20000
,
30000
]
FILE
:
-
gppylib/test/behave/mgmt_utils/steps/data/gpload_reuse_ext.csv
-
COLUMNS
:
-
id
:
int
-
msg
:
text
-
FORMAT
:
csv
-
QUOTE
:
'
"'
-
ERROR_LIMIT
:
9999
-
ERROR_TABLE
:
public.eRrtAb2
OUTPUT
:
-
TABLE
:
tbl1
-
MODE
:
merge
-
MATCH_COLUMNS
:
-
id
-
UPDATE_COLUMNS
:
-
msg
-
MAPPING
:
id
:
id
msg
:
msg
PRELOAD
:
-
REUSE_TABLES
:
true
gpMgmt/bin/gppylib/test/behave/mgmt_utils/steps/data/gpload_reuse_ext_errtbl_2.yml
已删除
100644 → 0
浏览文件 @
ef145fe3
VERSION
:
1.0.0.1
DATABASE
:
testdb
GPLOAD
:
INPUT
:
-
SOURCE
:
PORT_RANGE
:
[
20000
,
30000
]
FILE
:
-
gppylib/test/behave/mgmt_utils/steps/data/gpload_reuse_ext.csv
-
COLUMNS
:
-
id
:
int
-
msg
:
text
-
FORMAT
:
csv
-
QUOTE
:
'
"'
-
ERROR_LIMIT
:
9999
-
ERROR_TABLE
:
errtab2
OUTPUT
:
-
TABLE
:
tbl1
-
MODE
:
merge
-
MATCH_COLUMNS
:
-
id
-
UPDATE_COLUMNS
:
-
msg
-
MAPPING
:
id
:
id
msg
:
msg
PRELOAD
:
-
REUSE_TABLES
:
true
gpMgmt/bin/gppylib/test/unit/test_unit_gpload.py
浏览文件 @
089c7c0a
...
...
@@ -47,12 +47,8 @@ class GpLoadTestCase(unittest.TestCase):
gploader
.
read_config
()
gploader
.
locations
=
[
'gpfdist://localhost:8080/test'
]
rejectLimit
=
'9999'
errTableOid
=
12345
sql
=
gploader
.
get_reuse_exttable_query
(
'csv'
,
'header'
,
rejectLimit
,
errTableOid
,
{},
None
,
False
)
self
.
assertTrue
(
'12345'
in
sql
)
self
.
assertTrue
(
rejectLimit
in
sql
)
sql
=
gploader
.
get_reuse_exttable_query
(
'csv'
,
'header'
,
None
,
None
,
{},
None
,
False
)
sql
=
gploader
.
get_reuse_exttable_query
(
'csv'
,
'header'
,
None
,
{},
None
,
False
)
self
.
assertTrue
(
'pgext.fmterrtbl IS NULL'
in
sql
)
self
.
assertTrue
(
'pgext.rejectlimit IS NULL'
in
sql
)
...
...
gpMgmt/demo/gpfdist_transform/1_dblp.yaml
浏览文件 @
089c7c0a
...
...
@@ -15,7 +15,7 @@ GPLOAD:
-
DELIMITER
:
'
'
# tab
-
ERROR_LIMIT
:
10
-
ERROR_TABLE
:
dblp_errortabl
e
-
LOG_ERRORS
:
Tru
e
OUTPUT
:
-
TABLE
:
dblp_thesis
...
...
gpMgmt/demo/gpfdist_transform/2_mef.yaml
浏览文件 @
089c7c0a
...
...
@@ -16,7 +16,7 @@ GPLOAD:
-
DELIMITER
:
'
|'
-
ERROR_LIMIT
:
10
-
ERROR_TABLE
:
mef_errortabl
e
-
LOG_ERRORS
:
Tru
e
OUTPUT
:
-
TABLE
:
mef_xml
...
...
gpMgmt/demo/gpfdist_transform/3_rig.yaml
浏览文件 @
089c7c0a
...
...
@@ -16,7 +16,7 @@ GPLOAD:
-
DELIMITER
:
'
|'
-
ERROR_LIMIT
:
10
-
ERROR_TABLE
:
rig_errortabl
e
-
LOG_ERRORS
:
Tru
e
OUTPUT
:
-
TABLE
:
rig_xml
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录