Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,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/
Expand Down
3 changes: 3 additions & 0 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,9 @@ DEFINE_Bool(exit_on_exception, "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
Expand Down
3 changes: 3 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,9 @@ DECLARE_mBool(exit_on_exception);
// 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);
Expand Down
15 changes: 10 additions & 5 deletions be/src/util/timezone_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <shared_mutex>
#include <string>

#include "common/config.h"
#include "common/exception.h"
#include "common/logging.h"

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ clean_be() {

rm -rf "${CMAKE_BUILD_DIR}"
rm -rf "${DORIS_HOME}/be/output"
rm -rf "${DORIS_HOME}/zoneinfo"
popd
}

Expand Down Expand Up @@ -627,6 +628,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/"
Expand Down
Binary file added resource/zoneinfo.tar.gz
Binary file not shown.