IMPALA-3581: Change location of minidump folders to log_dir

Currently the default minidump location is /tmp/impala-minidumps, which can be wiped on
reboot on various distributions. This change moves the default location to
FLAGS_log_dir/minidumps/$daemon. The additional trailing $daemon folder is kept to prevent
name collisions in case of local test clusters and strangely configured installations.

For local test clusters the minidumps will be written to
$IMPALA_HOME/logs/cluster/minidumps/{catalogd,impalad,statestored}.

Change-Id: Idecf5a314bfb8b0870e8aa4819c4fb39a107702f
Reviewed-on: http://gerrit.cloudera.org:8080/3171
Reviewed-by: Taras Bobrovytsky <tbobrovytsky@cloudera.com>
Tested-by: Internal Jenkins
This commit is contained in:
Lars Volker
2016-05-23 16:54:23 +02:00
committed by Tim Armstrong
parent 6f1fe4ebe7
commit d16e83214a
5 changed files with 72 additions and 28 deletions

View File

@@ -86,12 +86,13 @@ class TestBreakpad(CustomClusterTestSuite):
assert not self.cluster.statestored
assert not self.cluster.catalogd
def count_minidumps(self, daemon):
path = os.path.join(self.tmp_dir, daemon)
def count_minidumps(self, daemon, base_dir=None):
base_dir = base_dir or self.tmp_dir
path = os.path.join(base_dir, daemon)
return len(glob.glob("%s/*.dmp" % path))
def count_all_minidumps(self):
return sum((self.count_minidumps(daemon) for daemon in DAEMONS))
def count_all_minidumps(self, base_dir=None):
return sum((self.count_minidumps(daemon, base_dir) for daemon in DAEMONS))
def assert_num_logfile_entries(self, expected_count):
self.assert_impalad_log_contains('INFO', 'Wrote minidump to ',
@@ -112,6 +113,25 @@ class TestBreakpad(CustomClusterTestSuite):
assert self.count_minidumps('statestored') == 1
assert self.count_minidumps('catalogd') == 1
@pytest.mark.execute_serially
def test_minidump_relative_path(self):
"""Check that setting 'minidump_path' to a relative value results in minidump files
written to 'log_dir'.
"""
minidump_base_dir = os.path.join(os.environ.get('LOG_DIR', '/tmp'), 'minidumps')
shutil.rmtree(minidump_base_dir)
# Omitting minidump_path as a parameter to the cluster will choose the default
# configuration, which is a FLAGS_log_dir/minidumps.
self.start_cluster_with_args()
assert self.count_all_minidumps(minidump_base_dir) == 0
cluster_size = len(self.cluster.impalads)
self.kill_cluster(SIGSEGV)
self.assert_num_logfile_entries(1)
assert self.count_minidumps('impalad', minidump_base_dir) == cluster_size
assert self.count_minidumps('statestored', minidump_base_dir) == 1
assert self.count_minidumps('catalogd', minidump_base_dir) == 1
shutil.rmtree(minidump_base_dir)
@pytest.mark.execute_serially
def test_minidump_cleanup(self):
"""Check that a limited number of minidumps is preserved during startup."""