mirror of
https://github.com/apache/impala.git
synced 2025-12-23 21:08:39 -05:00
IMPALA-1878: Support INSERT and LOAD DATA on S3 and between filesystems
Previously Impala disallowed LOAD DATA and INSERT on S3. This patch functionally enables LOAD DATA and INSERT on S3 without making major changes for the sake of improving performance over S3. This patch also enables both INSERT and LOAD DATA between file systems. S3 does not support the rename operation, so the staged files in S3 are copied instead of renamed, which contributes to the slow performance on S3. The FinalizeSuccessfulInsert() function now does not make any underlying assumptions of the filesystem it is on and works across all supported filesystems. This is done by adding a full URI field to the base directory for a partition in the TInsertPartitionStatus. Also, the HdfsOp class now does not assume a single filesystem and gets connections to the filesystems based on the URI of the file it is operating on. Added a python S3 client called 'boto3' to access S3 from the python tests. A new class called S3Client is introduced which creates wrappers around the boto3 functions and have the same function signatures as PyWebHdfsClient by deriving from a base abstract class BaseFileSystem so that they can be interchangeably through a 'generic_client'. test_load.py is refactored to use this generic client. The ImpalaTestSuite setup creates a client according to the TARGET_FILESYSTEM environment variable and assigns it to the 'generic_client'. P.S: Currently, the test_load.py runs 4x slower on S3 than on HDFS. Performance needs to be improved in future patches. INSERT performance is slower than on HDFS too. This is mainly because of an extra copy that happens between staging and the final location of a file. However, larger INSERTs come closer to HDFS permformance than smaller inserts. ACLs are not taken care of for S3 in this patch. It is something that still needs to be discussed before implementing. Change-Id: I94e15ad67752dce21c9b7c1dced6e114905a942d Reviewed-on: http://gerrit.cloudera.org:8080/2574 Reviewed-by: Sailesh Mukil <sailesh@cloudera.com> Tested-by: Internal Jenkins
This commit is contained in:
committed by
Tim Armstrong
parent
99879aad47
commit
ed7f5ebf53
61
tests/util/filesystem_base.py
Normal file
61
tests/util/filesystem_base.py
Normal file
@@ -0,0 +1,61 @@
|
||||
# Copyright (c) 2016 Cloudera, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed 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.
|
||||
#
|
||||
# Filsystem access abstraction
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
class BaseFilesystem(object):
|
||||
__metaclass__ = ABCMeta
|
||||
|
||||
@abstractmethod
|
||||
def create_file(self, path, file_data, overwrite):
|
||||
"""Create a file in 'path' and populate with the string 'file_data'. If overwrite is
|
||||
True, the file is overwritten. Returns True if successful, False if the file already
|
||||
exists and throws an exception otherwise"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def make_dir(self, path, permission):
|
||||
"""Create a directory in 'path' with octal umask 'permission'.
|
||||
Returns True if successful and throws an exception otherwise"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def copy(self, src, dst):
|
||||
"""Copy a file from 'src' to 'dst'. Throws an exception if unsuccessful."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def ls(self, path):
|
||||
"""Return a list of all files/dirs/keys in path. Throws an exception if path
|
||||
is invalid."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def exists(self, path):
|
||||
"""Returns True if a particular path exists, else it returns False."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def delete_file_dir(self, path, recursive):
|
||||
"""Delete all files/dirs/keys in a path. Returns True if successful or if the file
|
||||
does not exist. Throws an exception otherwise."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_all_file_sizes(self, path):
|
||||
"""Returns a list of integers which are all the file sizes of files found under
|
||||
'path'."""
|
||||
pass
|
||||
Reference in New Issue
Block a user