You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by mi...@apache.org on 2026/06/04 15:26:59 UTC
(impala) branch master updated (f0b02d8bb -> 3aca44ba5)
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
from f0b02d8bb IMPALA-15051: Fix IllegalStateException in TableEventExecutor.clear
new 469254d23 IMPALA-15064: Fix flakiness of test_query_profile_contains_query_compilation_metadata_load_events
new 3aca44ba5 IMPALA-12389: Use -skipTrash to avoid accumulating trash
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../common/etc/hadoop/conf/hdfs-site.xml.tmpl | 8 ++++++++
tests/common/file_utils.py | 4 ++--
tests/conftest.py | 18 +++++++++++-------
tests/metadata/test_hdfs_encryption.py | 11 ++++-------
tests/metadata/test_hdfs_permissions.py | 8 ++++----
tests/query_test/test_observability.py | 9 ++++++---
tests/query_test/test_scanners.py | 2 +-
tests/query_test/test_udfs.py | 2 +-
tests/util/hdfs_util.py | 4 ++--
tests/util/iceberg_metadata_util.py | 3 ++-
10 files changed, 41 insertions(+), 28 deletions(-)
(impala) 01/02: IMPALA-15064: Fix flakiness of test_query_profile_contains_query_compilation_metadata_load_events
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 469254d236917631f71e43f97ce7b5b1cc67bb68
Author: Balazs Hevele <bh...@cloudera.com>
AuthorDate: Tue Jun 2 14:26:01 2026 +0200
IMPALA-15064: Fix flakiness of test_query_profile_contains_query_compilation_metadata_load_events
This tests invalidates a table, runs a select query, and checks that
the runtime profile contains a set of static lines.
Some of these lines (e.g. CatalogFetch.RPCs.Bytes) are only included,
with local catalog, if the table is still evicted from the cache.
However, with it running parallelly with other tests, another query can
fetch the table, between the invalidate and the select query, making the
test fail.
Fixed by using a unique database in this test instead of a common one.
Change-Id: I33cad260858d393af168969679d014ab3d340e3f
Reviewed-on: http://gerrit.cloudera.org:8080/24391
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Peter Rozsa <pr...@cloudera.com>
---
tests/query_test/test_observability.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tests/query_test/test_observability.py b/tests/query_test/test_observability.py
index 421794d36..f65574da0 100644
--- a/tests/query_test/test_observability.py
+++ b/tests/query_test/test_observability.py
@@ -492,11 +492,14 @@ class TestObservability(ImpalaTestSuite):
verify_profile_event_sequence(event_regexes, runtime_profile)
def test_query_profile_contains_query_compilation_metadata_load_events(self,
- cluster_properties):
+ cluster_properties, unique_database):
"""Test that the Metadata load started and finished events appear in the query
profile when Catalog cache is evicted."""
- invalidate_query = "invalidate metadata functional.alltypes"
- select_query = "select * from functional.alltypes"
+ table_name = "%s.test_table" % unique_database
+ self.execute_query(
+ "create table %s as select * from functional.alltypestiny" % table_name)
+ invalidate_query = "invalidate metadata %s" % table_name
+ select_query = "select * from %s" % table_name
self.execute_query(invalidate_query).runtime_profile
runtime_profile = self.execute_query(select_query).runtime_profile
# Depending on whether this is a catalog-v2 cluster or not some of the metadata
(impala) 02/02: IMPALA-12389: Use -skipTrash to avoid accumulating trash
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 3aca44ba5e51f38a6850cb981ec90501cf8e0566
Author: Joe McDonnell <jo...@cloudera.com>
AuthorDate: Mon Aug 21 16:09:29 2023 -0700
IMPALA-12389: Use -skipTrash to avoid accumulating trash
The default behavior for deleting files on Hadoop is to
move them to a trash folder. The trash folder can be
aged out, but Impala's developer environment sets the
trash to live a long time. This is a problem, because the
trash contents will continue to accumulate.
This combines multiple changes to avoid accumulating trash:
1. This changes HadoopFsCommandLineClient's delete_file_dir
to use -skipTrash to avoid accumulating the trash for
this case. This helps on non-HDFS test environments.
2. This changes the unique_database fixture to delete the
database directory before dropping the database. Non-external
tables deleted as part of DROP DATABASE .. CASCADE are
moved to the trash. Deleting the database directory ourselves
avoids sending these files to the trash.
3. "hdfs dfs -expunge -immediate" can recover the disk space, but
it is very slow. This increases the dfs.block.invalidate.limit
to allow HDFS to delete more blocks in a single heartbeat.
To support this change, there were other test-only changes:
- This updates a few tests that placed tables outside of the
unique_database. In particular, Iceberg tests using
create_iceberg_table_from_directory() were putting tables
outside the database.
- TestHdfsEncryption and TestHdfsPermissions used WebHDFS-style
paths without the leading slash. This is harmless, but this
cleans them up to use normal paths. This is safe, because the
delegating client converts it internally when using the WebHDFS
client.
Testing:
- Ran tests locally and examined the trash directory
Change-Id: I2d304113596aaf70a122202a33276fc7c3d599e8
Reviewed-on: http://gerrit.cloudera.org:8080/20386
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Reviewed-by: Michael Smith <mi...@cloudera.com>
---
.../common/etc/hadoop/conf/hdfs-site.xml.tmpl | 8 ++++++++
tests/common/file_utils.py | 4 ++--
tests/conftest.py | 18 +++++++++++-------
tests/metadata/test_hdfs_encryption.py | 11 ++++-------
tests/metadata/test_hdfs_permissions.py | 8 ++++----
tests/query_test/test_scanners.py | 2 +-
tests/query_test/test_udfs.py | 2 +-
tests/util/hdfs_util.py | 4 ++--
tests/util/iceberg_metadata_util.py | 3 ++-
9 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/testdata/cluster/node_templates/common/etc/hadoop/conf/hdfs-site.xml.tmpl b/testdata/cluster/node_templates/common/etc/hadoop/conf/hdfs-site.xml.tmpl
index 06289387d..999d7da41 100644
--- a/testdata/cluster/node_templates/common/etc/hadoop/conf/hdfs-site.xml.tmpl
+++ b/testdata/cluster/node_templates/common/etc/hadoop/conf/hdfs-site.xml.tmpl
@@ -106,6 +106,14 @@
<value>${DATANODE_LOCKED_MEM}</value>
</property>
+ <!-- To make deletions of large numbers of blocks faster (e.g. expunge immediate),
+ increase the number of deletions that can be done in a single heartbeat.
+ The default was 1000. -->
+ <property>
+ <name>dfs.block.invalidate.limit</name>
+ <value>50000</value>
+ </property>
+
<!-- Increase the frequency the NN talks to the DNs to update the caching policy.
This is useful to reduce the lag between asking a path to be cached and it actually
being cached. -->
diff --git a/tests/common/file_utils.py b/tests/common/file_utils.py
index 391233fda..4a7c45651 100644
--- a/tests/common/file_utils.py
+++ b/tests/common/file_utils.py
@@ -56,11 +56,11 @@ def create_iceberg_table_from_directory(impala_client, unique_database, table_na
rewrite_metadata(warehouse_prefix, unique_database, os.path.join(local_dir, 'metadata'))
# Put the directory in the database's directory (not the table directory)
- hdfs_parent_dir = os.path.join(get_fs_path("/test-warehouse"), unique_database)
+ hdfs_parent_dir = os.path.join(get_fs_path("/test-warehouse"), unique_database + ".db")
hdfs_dir = os.path.join(hdfs_parent_dir, table_name)
# Purge existing files if any
- check_call(['hdfs', 'dfs', '-rm', '-f', '-r', hdfs_dir])
+ check_call(['hdfs', 'dfs', '-rm', '-skipTrash', '-f', '-r', hdfs_dir])
# Note: -d skips a staging copy
check_call(['hdfs', 'dfs', '-mkdir', '-p', hdfs_parent_dir])
diff --git a/tests/conftest.py b/tests/conftest.py
index 469331325..64fb98daa 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -371,6 +371,17 @@ def unique_database(request, testid_checksum):
'characters.'.format(db_name))
def cleanup_database(client, db_name, must_exist):
+ # By default, dropping a database will move the files to the trash. Since the dev
+ # environment uses a long fs.trash.interval, these files will accumulate and
+ # waste disk space. To avoid that, we blast away the database directory (skipping
+ # trash) before dropping the database.
+ #
+ # When there are external tables, the external locations are not removed by cascade.
+ # These preexisting files/directories can cause errors when tests run repeatedly or
+ # use a data snapshot (see IMPALA-9702). Deleting the database directory prevents
+ # this as well.
+ db_location = "{0}/{1}.db".format(WAREHOUSE, db_name)
+ request.instance.filesystem_client.delete_file_dir(db_location, recursive=True)
for i in range(2):
try:
result = client.execute('DROP DATABASE {0} `{1}` CASCADE'.format(
@@ -383,13 +394,6 @@ def unique_database(request, testid_checksum):
else:
raise e
assert result.success
- # The database directory may not be removed if there are external tables in the
- # database when it is dropped. The external locations are not removed by cascade.
- # These preexisting files/directories can cause errors when tests run repeatedly or
- # use a data snapshot (see IMPALA-9702), so this forces cleanup of the database
- # directory.
- db_location = "{0}/{1}.db".format(WAREHOUSE, db_name).lstrip('/')
- request.instance.filesystem_client.delete_file_dir(db_location, recursive=True)
def cleanup():
with request.instance.create_impala_client(protocol=HS2) as client:
diff --git a/tests/metadata/test_hdfs_encryption.py b/tests/metadata/test_hdfs_encryption.py
index a7b21c746..6ec4405f5 100644
--- a/tests/metadata/test_hdfs_encryption.py
+++ b/tests/metadata/test_hdfs_encryption.py
@@ -27,10 +27,7 @@ from tests.common.test_vector import ImpalaTestDimension
from tests.util.shell_util import exec_process
TEST_DB = 'test_encryption_db'
-
-# PyWebHdfs takes absolute paths without a leading slash
-PYWEBHDFS_TMP_DIR = 'tmp/test_encryption_load_data'
-TMP_DIR = '/%s' % (PYWEBHDFS_TMP_DIR)
+TMP_DIR = '/tmp/test_encryption_load_data'
@SkipIfFS.hdfs_encryption
@@ -74,12 +71,12 @@ class TestHdfsEncryption(ImpalaTestSuite):
self.__cleanup()
self.client.execute('create database if not exists %s' % TEST_DB)
self.client.execute('use %s' % TEST_DB)
- self.hdfs_client.make_dir(PYWEBHDFS_TMP_DIR)
+ self.hdfs_client.make_dir(TMP_DIR)
# Few tests depend on the .Trash directory being present. In case it doesn't
# exist, we create a random text file and delete it so that hdfs recreates
# the hierarchy of trash
if not self.hdfs_client.exists("/user/{0}/.Trash/".format(getpass.getuser())):
- self.hdfs_client.create_file("test-warehouse/random",file_data="random")
+ self.hdfs_client.create_file("/test-warehouse/random", file_data="random")
rc, stdout, stderr = exec_process("hadoop fs -rm /test-warehouse/random")
assert rc == 0, 'Error re-creating trash: %s %s' % (stdout, stderr)
@@ -102,7 +99,7 @@ class TestHdfsEncryption(ImpalaTestSuite):
self.client.execute('drop table if exists %s.tbl purge' % TEST_DB)
self.client.execute('drop table if exists %s.t1 purge' % TEST_DB)
self.cleanup_db(TEST_DB)
- self.hdfs_client.delete_file_dir(PYWEBHDFS_TMP_DIR, recursive=True)
+ self.hdfs_client.delete_file_dir(TMP_DIR, recursive=True)
def test_load_data(self, vector):
key_tbl_dir = vector.get_value('key_tbl_dir')
diff --git a/tests/metadata/test_hdfs_permissions.py b/tests/metadata/test_hdfs_permissions.py
index 4ad1fae8b..0e2213a59 100644
--- a/tests/metadata/test_hdfs_permissions.py
+++ b/tests/metadata/test_hdfs_permissions.py
@@ -41,7 +41,7 @@ class TestHdfsPermissions(ImpalaTestSuite):
def _cleanup(self):
self.client.execute('drop table if exists %s' % TEST_TBL)
- self.hdfs_client.delete_file_dir('test-warehouse/%s' % TEST_TBL, recursive=True)
+ self.hdfs_client.delete_file_dir('/test-warehouse/%s' % TEST_TBL, recursive=True)
@SkipIfCatalogV2.impala_7539()
def test_insert_into_read_only_table(self):
@@ -50,7 +50,7 @@ class TestHdfsPermissions(ImpalaTestSuite):
# In Isilon OneFS 8.0, a change was introduced that requires this. See IMPALA-3698.
permission = 544
# Create a directory that is read-only
- self.hdfs_client.make_dir('test-warehouse/%s' % TEST_TBL, permission=permission)
+ self.hdfs_client.make_dir('/test-warehouse/%s' % TEST_TBL, permission=permission)
self.client.execute("create external table %s (i int) location '%s'"
% (TEST_TBL, TBL_LOC))
try:
@@ -63,8 +63,8 @@ class TestHdfsPermissions(ImpalaTestSuite):
assert self.execute_scalar('select count(*) from %s' % TEST_TBL) == "0"
# Now re-create the directory with write privileges.
- self.hdfs_client.delete_file_dir('test-warehouse/%s' % TEST_TBL, recursive=True)
- self.hdfs_client.make_dir('test-warehouse/%s' % TEST_TBL, permission=777)
+ self.hdfs_client.delete_file_dir('/test-warehouse/%s' % TEST_TBL, recursive=True)
+ self.hdfs_client.make_dir('/test-warehouse/%s' % TEST_TBL, permission=777)
self.client.execute('refresh %s' % TEST_TBL)
self.client.execute('insert into table %s select 1' % TEST_TBL)
diff --git a/tests/query_test/test_scanners.py b/tests/query_test/test_scanners.py
index 85ed8a21f..3761c9fc3 100644
--- a/tests/query_test/test_scanners.py
+++ b/tests/query_test/test_scanners.py
@@ -1503,7 +1503,7 @@ class TestTextSplitDelimiters(ImpalaTestSuite):
options = vector.get_value('exec_option')
TABLE_NAME = "test_text_split_delimiters"
qualified_table_name = "%s.%s" % (unique_database, TABLE_NAME)
- location = get_fs_path("/test-warehouse/%s_%s" % (unique_database, TABLE_NAME))
+ location = get_fs_path("/test-warehouse/%s.db/%s" % (unique_database, TABLE_NAME))
query = "create table %s (s string) location '%s'" % (qualified_table_name, location)
self.execute_query(query, options)
diff --git a/tests/query_test/test_udfs.py b/tests/query_test/test_udfs.py
index 330aa108a..bd4cd556b 100644
--- a/tests/query_test/test_udfs.py
+++ b/tests/query_test/test_udfs.py
@@ -507,7 +507,7 @@ class TestUdfTargeted(TestUdfBase):
self.execute_query_expect_success(client, drop_fn_stmt)
self.execute_query_expect_success(client, create_fn_stmt)
# Delete the udf jar
- check_call(["hadoop", "fs", "-rm", jar_path])
+ check_call(["hadoop", "fs", "-rm", "-skipTrash", jar_path])
different_impalad = cluster.get_different_impalad(impalad)
client = different_impalad.service.create_client_from_vector(vector)
diff --git a/tests/util/hdfs_util.py b/tests/util/hdfs_util.py
index e37a64561..f7deaa187 100644
--- a/tests/util/hdfs_util.py
+++ b/tests/util/hdfs_util.py
@@ -298,9 +298,9 @@ class HadoopFsCommandLineClient(BaseFilesystem):
def delete_file_dir(self, path, recursive=False):
"""Delete the file or directory given by the specified path. Recursive must be true
for directories."""
- rm_command = ['-rm', path]
+ rm_command = ['-rm', '-skipTrash', path]
if recursive:
- rm_command = ['-rm', '-r', path]
+ rm_command = ['-rm', '-skipTrash', '-r', path]
(status, stdout, stderr) = self._hadoop_fs_shell(rm_command)
return status == 0
diff --git a/tests/util/iceberg_metadata_util.py b/tests/util/iceberg_metadata_util.py
index 6ecce4e36..2ee9dad38 100644
--- a/tests/util/iceberg_metadata_util.py
+++ b/tests/util/iceberg_metadata_util.py
@@ -131,7 +131,8 @@ def generate_new_path(table_params, file_path):
assert len(li) == 2
return new_expr.join(li)
- return replace_last(result, table_name, "{}/{}".format(unique_database, table_name))
+ return replace_last(result, table_name,
+ "{}/{}".format(unique_database + ".db", table_name))
def add_prefix_to_snapshot(table_params, snapshot):