[chore](be) Add default timezone files (#25097)

This commit is contained in:
zclllyybb
2023-10-20 13:12:24 +08:00
committed by GitHub
parent dc47087560
commit 9a675fcdfc
7 changed files with 24 additions and 6 deletions

1
.gitignore vendored
View File

@ -97,6 +97,7 @@ be/tags
be/test/olap/test_data/tablet_meta_test.hdr
be/.devcontainer/
be/src/apache-orc/
zoneinfo/
## tools
tools/ssb-tools/ssb-data/

View File

@ -1114,6 +1114,9 @@ DEFINE_Bool(enable_cpu_hard_limit, "false");
DEFINE_Bool(ignore_always_true_predicate_for_segment, "true");
// Dir of default timezone files
DEFINE_String(default_tzfiles_path, "${DORIS_HOME}/zoneinfo");
// clang-format off
#ifdef BE_TEST
// test s3

View File

@ -1184,6 +1184,9 @@ DECLARE_Bool(enable_flush_file_cache_async);
// Remove predicate that is always true for a segment.
DECLARE_Bool(ignore_always_true_predicate_for_segment);
// Dir of default timezone files
DECLARE_String(default_tzfiles_path);
#ifdef BE_TEST
// test s3
DECLARE_String(test_s3_resource);

View File

@ -36,6 +36,7 @@
#include <shared_mutex>
#include <string>
#include "common/config.h"
#include "common/exception.h"
#include "common/logging.h"
@ -77,8 +78,10 @@ void TimezoneUtils::load_timezone_names() {
path += '/';
if (!std::filesystem::exists(path)) {
LOG_WARNING("Cannot find system tzfile. Abandon to preload timezone name cache.");
return;
LOG_WARNING("Cannot find system tzfile. Use default instead.");
path = config::default_tzfiles_path + '/';
CHECK(std::filesystem::exists(path))
<< "Can't find system tzfiles or default tzfiles neither.";
}
auto path_prefix_len = path.size();
@ -236,10 +239,12 @@ void TimezoneUtils::load_timezones_to_cache() {
base_str += tzdir;
base_str += '/';
const auto root_path = std::filesystem::path {base_str};
auto root_path = std::filesystem::path {base_str};
if (!std::filesystem::exists(root_path)) {
LOG_WARNING("Cannot find system tzfile. Abandon to preload timezone cache.");
return;
LOG_WARNING("Cannot find system tzfile. Use default instead.");
root_path = config::default_tzfiles_path + '/';
CHECK(std::filesystem::exists(root_path))
<< "Can't find system tzfiles or default tzfiles neither.";
}
std::set<std::string> ignore_paths = {"posix", "right"}; // duplications

View File

@ -202,7 +202,6 @@ TEST(VTimestampFunctionsTest, timediff_test) {
}
TEST(VTimestampFunctionsTest, convert_tz_test) {
GTEST_SKIP() << "Skip temporarily. need fix";
std::string func_name = "convert_tz";
TimezoneUtils::clear_timezone_caches();

View File

@ -95,6 +95,7 @@ clean_be() {
rm -rf "${CMAKE_BUILD_DIR}"
rm -rf "${DORIS_HOME}/be/output"
rm -rf "${DORIS_HOME}/zoneinfo"
popd
}
@ -634,6 +635,12 @@ if [[ "${OUTPUT_BE_BINARY}" -eq 1 ]]; then
cp -r -p "${DORIS_HOME}/be/output/bin"/* "${DORIS_OUTPUT}/be/bin"/
cp -r -p "${DORIS_HOME}/be/output/conf"/* "${DORIS_OUTPUT}/be/conf"/
cp -r -p "${DORIS_HOME}/be/output/dict" "${DORIS_OUTPUT}/be/"
if [[ ! -r "${DORIS_HOME}/zoneinfo/Africa/Abidjan" ]]; then
rm -rf "${DORIS_HOME}/zoneinfo"
echo "Generating zoneinfo files"
tar -xzf "${DORIS_HOME}/resource/zoneinfo.tar.gz" -C "${DORIS_HOME}"/
fi
cp -r -p "${DORIS_HOME}/zoneinfo" "${DORIS_OUTPUT}/be/"
if [[ -d "${DORIS_THIRDPARTY}/installed/lib/hadoop_hdfs/" ]]; then
cp -r -p "${DORIS_THIRDPARTY}/installed/lib/hadoop_hdfs/" "${DORIS_OUTPUT}/be/lib/"

BIN
resource/zoneinfo.tar.gz Normal file

Binary file not shown.