mirror of
https://github.com/apache/impala.git
synced 2025-12-20 18:37:21 -05:00
RuntimeState::LogError() does both error aggregation to the coordinator and logging the error to the log file depending on the vlog_level. This can flood INFO log if the specified vlog_level is 1 and makes it difficult to analyze other more significant log lines. This patch limits the number of errors logged to INFO based on max_error_logs_per_instance flag (default is 2000). When this number is exceeded, vlog_level=1 will be downgraded to vlog_level=2. To allow easy debugging in the future, this flag will be ignored if the user sets query option max_errors < 0, which in that case all errors targetting vlog_level 1 will be logged. This patch also fixes a bug where the error count is not increased for non-general error code that is already in 'error_log_' map. Testing: - Add test_logging.py::TestLoggingCore Change-Id: I924768ec461735c172fbf75d6415033bbdb77f9b Reviewed-on: http://gerrit.cloudera.org:8080/18565 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
62 lines
2.4 KiB
Python
62 lines
2.4 KiB
Python
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you 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.
|
|
|
|
import pytest
|
|
|
|
from tests.common.custom_cluster_test_suite import CustomClusterTestSuite
|
|
|
|
|
|
class TestLoggingCore(CustomClusterTestSuite):
|
|
"""Test existence of certain log lines under some scenario."""
|
|
|
|
@classmethod
|
|
def get_workload(cls):
|
|
return 'functional-query'
|
|
|
|
def _test_max_errors(self, max_error_logs_per_instance, max_errors, expect_downgraded):
|
|
"""Test that number of non-fatal error printed to INFO log is limited by
|
|
max_errors and max_error_logs_per_instance."""
|
|
|
|
query = ("select id, bool_col, tinyint_col, smallint_col "
|
|
"from functional.alltypeserror order by id")
|
|
client = self.create_impala_client()
|
|
|
|
self.execute_query_expect_success(client, query, {'max_errors': max_errors})
|
|
self.assert_impalad_log_contains("INFO", "Error parsing row",
|
|
max_error_logs_per_instance if expect_downgraded else 8)
|
|
self.assert_impalad_log_contains("INFO",
|
|
"printed {0} non-fatal error to log level 1".format(max_error_logs_per_instance),
|
|
1 if expect_downgraded else 0)
|
|
|
|
@pytest.mark.execute_serially
|
|
@CustomClusterTestSuite.with_args(cluster_size=1,
|
|
impalad_args="--max_error_logs_per_instance=2")
|
|
def test_max_errors(self):
|
|
self._test_max_errors(2, 4, True)
|
|
|
|
@pytest.mark.execute_serially
|
|
@CustomClusterTestSuite.with_args(cluster_size=1,
|
|
impalad_args="--max_error_logs_per_instance=3")
|
|
def test_max_errors_0(self):
|
|
self._test_max_errors(3, 0, True)
|
|
|
|
@pytest.mark.execute_serially
|
|
@CustomClusterTestSuite.with_args(cluster_size=1,
|
|
impalad_args="--max_error_logs_per_instance=2")
|
|
def test_max_errors_no_downgrade(self):
|
|
self._test_max_errors(2, -1, False)
|