IMPALA-3577, IMPALA-3486: Partitions on multiple filesystems breaks with S3_SKIP_INSERT_STAGING

The HdfsTableSink usualy creates a HDFS connection to the filesystem
that the base table resides in. However, if we create a partition in
a FS different than that of the base table and set
S3_SKIP_INSERT_STAGING to "true", the table sink will try to write to
a different filesystem with the wrong filesystem connector.

This patch allows the table sink itself to work with different
filesystems by getting rid of a single FS connector and getting a
connector per partition.

This also reenables the multiple_filesystems test and modifies it to
use the unique_database fixture so that parallel runs on the same
bucket do not clash and end up in failures.

This patch also introduces a SECONDARY_FILESYSTEM environment variable
which will be set by the test to allow S3, Isilon and the localFS to
be used as the secondary filesystems.

All jobs with HDFS as the default filesystem need to set the
appropriate environment for S3 and Isilon, i.e. the following:
 - export AWS_SECERT_ACCESS_KEY
 - export AWS_ACCESS_KEY_ID
 - export SECONDARY_FILESYSTEM (to whatever filesystem needs to be
   tested)

TODO: SECONDARY_FILESYSTEM and FILESYSTEM_PREFIX and NAMENODE have a
lot of similarities. Need to clean them up in a following patch.

Change-Id: Ib13b610eb9efb68c83894786cea862d7eae43aa7
Reviewed-on: http://gerrit.cloudera.org:8080/3146
Reviewed-by: Sailesh Mukil <sailesh@cloudera.com>
Tested-by: Internal Jenkins
This commit is contained in:
Sailesh Mukil
2016-05-19 16:34:41 -07:00
committed by Tim Armstrong
parent c0269b23bc
commit 6f1fe4ebe7
7 changed files with 85 additions and 66 deletions

View File

@@ -3,7 +3,7 @@
# Verify various CREATE TABLE for unpartitioned tables on non-default
# filesystem (e.g. S3A).
create external table tinytable_like like functional.tinytable
location '$FILESYSTEM_PREFIX/test-warehouse/tinytable'
location '$SECONDARY_FILESYSTEM/multi_fs_tests/$DATABASE.db/tinytable'
---- RESULTS
====
---- QUERY
@@ -32,7 +32,7 @@ BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING
---- QUERY
create external table tinytable_copy (a string, b string)
row format delimited fields terminated by ','
location '$FILESYSTEM_PREFIX/test-warehouse/tinytable'
location '$SECONDARY_FILESYSTEM/multi_fs_tests/$DATABASE.db/tinytable'
---- RESULTS
====
---- QUERY
@@ -58,22 +58,22 @@ INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIM
---- QUERY
# Verify ADD PARTITION for non-default filesystem.
alter table alltypes add partition(year=2009, month=1)
location '$FILESYSTEM_PREFIX/test-warehouse/alltypes_parquet/year=2009/month=1'
location '$SECONDARY_FILESYSTEM/multi_fs_tests/$DATABASE.db/alltypes_parquet/year=2009/month=1'
---- RESULTS
====
---- QUERY
alter table alltypes add partition(year=2009, month=2)
location '$FILESYSTEM_PREFIX/test-warehouse/alltypes_parquet/year=2009/month=2'
location '$SECONDARY_FILESYSTEM/multi_fs_tests/$DATABASE.db/alltypes_parquet/year=2009/month=2'
---- RESULTS
====
---- QUERY
alter table alltypes add partition(year=2010, month=1)
location '$FILESYSTEM_PREFIX/test-warehouse/alltypes_parquet/year=2010/month=1'
location '$SECONDARY_FILESYSTEM/multi_fs_tests/$DATABASE.db/alltypes_parquet/year=2010/month=1'
---- RESULTS
====
---- QUERY
alter table alltypes add partition(year=2010, month=2)
location '$FILESYSTEM_PREFIX/test-warehouse/alltypes_parquet/year=2010/month=2'
location '$SECONDARY_FILESYSTEM/multi_fs_tests/$DATABASE.db/alltypes_parquet/year=2010/month=2'
---- RESULTS
====
---- QUERY
@@ -117,17 +117,17 @@ INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIM
====
---- QUERY
# Verify tables with partitions that span multiple filesystems.
# Note: intentionally not using $FILESYSTEM_PREFIX so that the partition points
# Note: intentionally not using $SECONDARY_FILESYSTEM so that the partition points
# to the default filesystem.
alter table alltypes add partition(year=2010, month=3)
location '/test-warehouse/multi_fs_db.db/alltypes_parquet/year=2010/month=3'
location '/test-warehouse/alltypes_parquet/year=2010/month=3'
---- RESULTS
====
---- QUERY
# Note: intentionally not using $FILESYSTEM_PREFIX so that the partition points
# Note: intentionally not using $SECONDARY_FILESYSTEM so that the partition points
# to the default filesystem.
alter table alltypes add partition(year=2010, month=4)
location '/test-warehouse/multi_fs_db.db/alltypes_parquet/year=2010/month=4'
location '/test-warehouse/alltypes_parquet/year=2010/month=4'
---- RESULTS
====
---- QUERY
@@ -173,7 +173,7 @@ drop table alltypes
---- QUERY
# Verify CREATE TABLE for partitioned table on non-default filesystem.
create external table alltypes like functional_parquet.alltypes
location '$FILESYSTEM_PREFIX/test-warehouse/multi_fs_db.db/alltypes'
location '$SECONDARY_FILESYSTEM/multi_fs_tests/$DATABASE.db/alltypes'
---- RESULTS
====
---- QUERY
@@ -184,29 +184,29 @@ INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIM
====
---- QUERY
# Verify tables with partitions that span multiple filesystems, split on the other partition.
# Note: intentionally not using $FILESYSTEM_PREFIX so that the partition points
# Note: intentionally not using $SECONDARY_FILESYSTEM so that the partition points
# to the default filesystem.
alter table alltypes add partition(year=2009, month=5)
location '/test-warehouse/multi_fs_db.db/alltypes_parquet/year=2009/month=5'
location '/test-warehouse/alltypes_parquet/year=2009/month=5'
---- RESULTS
====
---- QUERY
alter table alltypes add partition(year=2009, month=6)
location '$FILESYSTEM_PREFIX/test-warehouse/alltypes_parquet/year=2009/month=6'
location '$SECONDARY_FILESYSTEM/multi_fs_tests/$DATABASE.db/alltypes_parquet/year=2009/month=6'
---- RESULTS
====
---- QUERY
# Note: intentionally not using $FILESYSTEM_PREFIX so that the partition points
# Note: intentionally not using $SECONDARY_FILESYSTEM so that the partition points
# to the default filesystem.
alter table alltypes add partition(year=2010, month=5)
location '/test-warehouse/multi_fs_db.db/alltypes_parquet/year=2010/month=5'
location '/test-warehouse/alltypes_parquet/year=2010/month=5'
---- RESULTS
====
---- QUERY
# This partition directory was dropped earlier, so this also verifies the partition
# directory was not deleted.
alter table alltypes add partition(year=2010, month=2)
location '$FILESYSTEM_PREFIX/test-warehouse/alltypes_parquet/year=2010/month=2'
location '$SECONDARY_FILESYSTEM/multi_fs_tests/$DATABASE.db/alltypes_parquet/year=2010/month=2'
---- RESULTS
====
---- QUERY
@@ -291,7 +291,7 @@ create table alltypes_multipart_insert like functional_parquet.alltypes
---- QUERY
# ADD PARTITION on a non-default filesystem.
alter table alltypes_multipart_insert add partition(year=2009, month=1)
location '$FILESYSTEM_PREFIX/test-warehouse/alltypes_multipart_insert/year=2009/month=1'
location '$SECONDARY_FILESYSTEM/multi_fs_tests/$DATABASE.db/alltypes_multipart_insert/year=2009/month=1'
---- RESULTS
====
---- QUERY
@@ -304,8 +304,9 @@ year=2009/month=1/: 310
====
---- QUERY
# ADD PARTITION on the default filesystem.
# Point to unique database so we don't overwrite someone else's data.
alter table alltypes_multipart_insert add partition(year=2009, month=2)
location '/test-warehouse/alltypes_multipart_insert/year=2009/month=2'
location '/test-warehouse/$DATABASE.db/alltypes_multipart_insert/year=2009/month=2'
---- RESULTS
====
---- QUERY