Files
impala/cmake_modules/FindCctz.cmake
Attila Jeges 17749dbcfc IMPALA-3307: Add support for IANA time-zone db
Impala currently uses two different libraries for timestamp
manipulations: boost and glibc.

Issues with boost:
- Time-zone database is currently hard coded in timezone_db.cc.
  Impala admins cannot update it without upgrading Impala.
- Time-zone database is flat, therefore can’t track year-to-year
  changes.
- Time-zone database is not updated on a regular basis.

Issues with glibc:
- Uses /usr/share/zoneinfo/ database which could be out of sync on
  some of the nodes in the Impala cluster.
- Uses the host system’s local time-zone. Different nodes in the
  Impala cluster might use a different local time-zone.
- Conversion functions take a global lock, which causes severe
  performance degradation.

In addition to the issues above, the fact that /usr/share/zoneinfo/
and the hard-coded boost time-zone database are both in use is a
source of inconsistency in itself.

This patch makes the following changes:
- Instead of boost and glibc, impalad uses Google's CCTZ to implement
  time-zone conversions.

- Introduces a new startup flag (--hdfs_zone_info_zip) to impalad to
  specify an HDFS/S3/ADLS path to a zip archive that contains the
  shared compiled IANA time-zone database. If the startup flag is set,
  impalad will use the specified time-zone database. Otherwise,
  impalad will use the default /usr/share/zoneinfo time-zone database.

- Introduces a new startup flag (--hdfs_zone_alias_conf) to impalad to
  specify an HDFS/S3/ADLS path to a shared config file that contains
  definitions for non-standard time-zone aliases.

- impalad reads the entire time-zone database into an in-memory
  map on startup for fast lookups.

- The name of the coordinator node’s local time-zone is saved to the
  query context when preparing query execution. This time-zone is used
  whenever the current time-zone is referred afterwards in an
  execution node.

- Adds a new ZipUtil class to extract files from a zip archive. The
  implementation is not vulnerable to Zip Slip.

Cherry-picks: not for 2.x.

Change-Id: I93c1fbffe81f067919706e30db0a34d0e58e7e77
Reviewed-on: http://gerrit.cloudera.org:8080/9986
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Attila Jeges <attilaj@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2018-06-22 13:18:58 +00:00

52 lines
1.8 KiB
CMake

##############################################################################
# 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.
##############################################################################
# - Find Cctz (headers and libcctz.a) with CCTZ_ROOT hinting a location
# This module defines
# CCTZ_INCLUDE_DIR, directory containing headers
# CCTZ_STATIC_LIB, path to libcctz.a
# CCTZ_FOUND
set(CCTZ_SEARCH_HEADER_PATHS ${CCTZ_ROOT}/include)
set(CCTZ_SEARCH_LIB_PATH ${CCTZ_ROOT}/lib)
find_path(CCTZ_INCLUDE_DIR NAMES cctz/civil_time.h civil_time.h PATHS
${CCTZ_SEARCH_HEADER_PATHS}
# make sure we don't accidentally pick up a different version
NO_DEFAULT_PATH)
find_library(CCTZ_STATIC_LIB NAMES libcctz.a PATHS ${CCTZ_SEARCH_LIB_PATH})
if(NOT CCTZ_STATIC_LIB)
message(FATAL_ERROR "Cctz includes and libraries NOT found. "
"Looked for headers in ${CCTZ_SEARCH_HEADER_PATHS}, "
"and for libs in ${CCTZ_SEARCH_LIB_PATH}")
set(CCTZ_FOUND FALSE)
else()
set(CCTZ_FOUND TRUE)
endif ()
set(CCTZ_FOUND ${CCTZ_STATIC_LIB_FOUND})
mark_as_advanced(
CCTZ_INCLUDE_DIR
CCTZ_STATIC_LIB
CCTZ_FOUND
)