From 72d4faaf8197e9c5aa7f95ac90134ae8c99c70bb Mon Sep 17 00:00:00 2001 From: xylaaaaa <2392805527@qq.com> Date: Mon, 2 Feb 2026 16:58:08 +0800 Subject: [PATCH] upgrade glog --- be/CMakeLists.txt | 1 + be/src/common/signal_handler.h | 2 +- cloud/CMakeLists.txt | 1 + thirdparty/CHANGELOG.md | 4 + thirdparty/build-thirdparty.sh | 24 +- thirdparty/download-thirdparty.sh | 7 + thirdparty/patches/brpc-1.4.0-cxx14.patch | 18 + .../patches/brpc-1.4.0-glog-export.patch | 11 + thirdparty/patches/glog-0.7.1.patch | 398 ++++++++++++++++++ thirdparty/vars.sh | 8 +- 10 files changed, 463 insertions(+), 11 deletions(-) create mode 100644 thirdparty/patches/brpc-1.4.0-cxx14.patch create mode 100644 thirdparty/patches/brpc-1.4.0-glog-export.patch create mode 100644 thirdparty/patches/glog-0.7.1.patch diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt index ab7c5dfa6b2fff..d6c32de5c62e8f 100644 --- a/be/CMakeLists.txt +++ b/be/CMakeLists.txt @@ -68,6 +68,7 @@ endif() # enable glog custom prefix add_definitions(-DGLOG_CUSTOM_PREFIX_SUPPORT) +add_definitions(-DGLOG_USE_GLOG_EXPORT) # Options option(GLIBC_COMPATIBILITY "Enable compatibility with older glibc libraries." ON) diff --git a/be/src/common/signal_handler.h b/be/src/common/signal_handler.h index ca117ee2b1cef5..882ed476ed852e 100644 --- a/be/src/common/signal_handler.h +++ b/be/src/common/signal_handler.h @@ -418,7 +418,7 @@ void FailureSignalHandler(int signal_number, siginfo_t* signal_info, void* ucont // Flush the logs before we do anything in case 'anything' // causes problems. - google::FlushLogFilesUnsafe(0); + google::FlushLogFilesUnsafe(google::GLOG_INFO); // Kill ourself by the default signal handler. InvokeDefaultSignalHandler(signal_number); diff --git a/cloud/CMakeLists.txt b/cloud/CMakeLists.txt index fe7062e3fcc13d..b12e47644780aa 100644 --- a/cloud/CMakeLists.txt +++ b/cloud/CMakeLists.txt @@ -396,6 +396,7 @@ endif() # enable glog custom prefix add_definitions(-DGLOG_CUSTOM_PREFIX_SUPPORT) +add_definitions(-DGLOG_USE_GLOG_EXPORT) set(FDB_VERSIONS "7.1.57" "7.3.69") set(FDB_DEFAULT_VERSION "7.1.57") diff --git a/thirdparty/CHANGELOG.md b/thirdparty/CHANGELOG.md index b8ad4edbfec4af..cc00182fc08d5f 100644 --- a/thirdparty/CHANGELOG.md +++ b/thirdparty/CHANGELOG.md @@ -2,6 +2,10 @@ This file contains version of the third-party dependency libraries in the build-env image. The docker build-env image is apache/doris, and the tag is `build-env-${version}` +## 20260202 + +- Modified: glog 0.6.0 -> 0.7.1 + ## 20151222 - Added: timsort (cpp-TimSort 3.x.y) diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh index 39e1d4efd850ae..4a3b8197fc8bd8 100755 --- a/thirdparty/build-thirdparty.sh +++ b/thirdparty/build-thirdparty.sh @@ -493,13 +493,19 @@ build_glog() { make -j "${PARALLEL}" make install - elif [[ "${GLOG_SOURCE}" == "glog-0.6.0" ]]; then + elif [[ "${GLOG_SOURCE}" == "glog-0.6.0" ]] || [[ "${GLOG_SOURCE}" == "glog-0.7.1" ]]; then + if [[ "${GLOG_SOURCE}" == "glog-0.7.1" ]]; then + WITH_UNWIND_FLAG="-DWITH_UNWIND=none" + else + WITH_UNWIND_FLAG="-DWITH_UNWIND=OFF" + fi + LDFLAGS="-L${TP_LIB_DIR}" \ - "${CMAKE_CMD}" -S . -B build -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" \ + "${CMAKE_CMD}" -S . -B build -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DCMAKE_BUILD_TYPE=Release \ + ${WITH_UNWIND_FLAG} \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DWITH_UNWIND=OFF \ -DBUILD_SHARED_LIBS=OFF \ -DWITH_TLS=OFF @@ -863,7 +869,9 @@ build_brpc() { # If glog is compiled before gflags, the above error will not exist, this works in glog 0.4, # but glog 0.6 enforces dependency on gflags. # glog must be enabled, otherwise error: `flag 'v' was defined more than once` (in files 'glog-0.6.0/src/vlog_is_on.cc' and 'brpc-1.6.0/src/butil/logging.cc') - LDFLAGS="${ldflags}" \ + CFLAGS="-DGLOG_USE_GLOG_EXPORT" \ + CXXFLAGS="-DGLOG_USE_GLOG_EXPORT" \ + LDFLAGS="${ldflags}" \ "${CMAKE_CMD}" -G "${GENERATOR}" -DBUILD_SHARED_LIBS=ON -DWITH_GLOG=ON -DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DCMAKE_LIBRARY_PATH="${TP_INSTALL_DIR}/lib64" -DCMAKE_INCLUDE_PATH="${TP_INSTALL_DIR}/include" \ @@ -1076,7 +1084,9 @@ build_arrow() { ldflags="-L${TP_LIB_DIR}" fi - LDFLAGS="${ldflags}" \ + CFLAGS="-DGLOG_USE_GLOG_EXPORT" \ + CXXFLAGS="-DGLOG_USE_GLOG_EXPORT" \ + LDFLAGS="${ldflags}" \ "${CMAKE_CMD}" -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -G "${GENERATOR}" -DARROW_PARQUET=ON -DARROW_IPC=ON -DARROW_BUILD_SHARED=OFF \ -DARROW_BUILD_STATIC=ON -DARROW_WITH_BROTLI=ON -DARROW_WITH_LZ4=ON -DARROW_USE_GLOG=ON \ @@ -1160,7 +1170,9 @@ build_s2() { rm -rf CMakeCache.txt CMakeFiles/ - LDFLAGS="-L${TP_LIB_DIR}" \ + CFLAGS="-DGLOG_USE_GLOG_EXPORT" \ + CXXFLAGS="-DGLOG_USE_GLOG_EXPORT" \ + LDFLAGS="-L${TP_LIB_DIR}" \ ${CMAKE_CMD} -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -G "${GENERATOR}" -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" \ -DCMAKE_PREFIX_PATH="${TP_INSTALL_DIR}" \ diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh index 001d8bba290e5b..61dd75b2c015db 100755 --- a/thirdparty/download-thirdparty.sh +++ b/thirdparty/download-thirdparty.sh @@ -265,6 +265,13 @@ if [[ " ${TP_ARCHIVES[*]} " =~ " GLOG " ]]; then touch "${PATCHED_MARK}" fi cd - + elif [[ "${GLOG_SOURCE}" == "glog-0.7.1" ]]; then + cd "${TP_SOURCE_DIR}/${GLOG_SOURCE}" + if [[ ! -f "${PATCHED_MARK}" ]]; then + patch -p1 <"${TP_PATCH_DIR}/glog-0.7.1.patch" + touch "${PATCHED_MARK}" + fi + cd - fi echo "Finished patching ${GLOG_SOURCE}" fi diff --git a/thirdparty/patches/brpc-1.4.0-cxx14.patch b/thirdparty/patches/brpc-1.4.0-cxx14.patch new file mode 100644 index 00000000000000..f98f696d2c8793 --- /dev/null +++ b/thirdparty/patches/brpc-1.4.0-cxx14.patch @@ -0,0 +1,18 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -152,12 +152,12 @@ macro(use_cxx11) + if(CMAKE_VERSION VERSION_LESS "3.1.3") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + endif() + else() +- set(CMAKE_CXX_STANDARD 11) ++ set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + endif() + endmacro(use_cxx11) diff --git a/thirdparty/patches/brpc-1.4.0-glog-export.patch b/thirdparty/patches/brpc-1.4.0-glog-export.patch new file mode 100644 index 00000000000000..8319d910eacbd5 --- /dev/null +++ b/thirdparty/patches/brpc-1.4.0-glog-export.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -141,7 +141,7 @@ + endif() + endif() + +-set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${DEFINE_CLOCK_GETTIME} -DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DBRPC_WITH_RDMA=${WITH_RDMA_VAL} -DGFLAGS_NS=${GFLAGS_NS}") ++set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${DEFINE_CLOCK_GETTIME} -DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DBRPC_WITH_RDMA=${WITH_RDMA_VAL} -DGFLAGS_NS=${GFLAGS_NS} -DGLOG_USE_GLOG_EXPORT") + if(WITH_MESALINK) + set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -DUSE_MESALINK") + endif() diff --git a/thirdparty/patches/glog-0.7.1.patch b/thirdparty/patches/glog-0.7.1.patch new file mode 100644 index 00000000000000..495f19a90a0c7c --- /dev/null +++ b/thirdparty/patches/glog-0.7.1.patch @@ -0,0 +1,398 @@ +--- a/src/glog/flags.h ++++ b/src/glog/flags.h +@@ -111,6 +111,16 @@ + DECLARE_string(alsologtoemail); + DECLARE_string(log_backtrace_at); + ++// Set max log file num ++DECLARE_int32(log_filenum_quota); ++ ++// Set max warn log file num ++#define GLOG_HAS_WARN_LOG_FILENUM_QUOTA ++DECLARE_int32(warn_log_filenum_quota); ++ ++// Set log file split method ++DECLARE_string(log_split_method); ++ + // Set whether appending a timestamp to the log file name + DECLARE_bool(timestamp_in_logfile_name); + +--- a/src/flags.cc ++++ b/src/flags.cc +@@ -111,6 +111,16 @@ + GLOG_DEFINE_int32(logbufsecs, 30, + "Buffer log messages for at most this many seconds"); + ++GLOG_DEFINE_string(log_split_method, "day", ++ "split log by size, day, hour"); ++ ++GLOG_DEFINE_int32(log_filenum_quota, 10, ++ "max log file num in log dir"); ++ ++GLOG_DEFINE_int32(warn_log_filenum_quota, -1, ++ "max warn log file num in log dir, -1 means equal to " ++ "log_filenum_quota"); ++ + GLOG_DEFINE_int32(logcleansecs, 60 * 5, // every 5 minutes + "Clean overdue logs every this many seconds"); + +--- a/src/logging.cc ++++ b/src/logging.cc +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -443,6 +444,13 @@ + + std::unique_ptr g_prefix_formatter; + ++struct Filetime { ++ std::string name; ++ std::time_t time; ++ ++ bool operator<(const Filetime& o) const { return o.time > time; } ++}; ++ + // Encapsulates all file-system related state + class LogFileObject : public base::Logger { + public: +@@ -473,6 +481,7 @@ + // can avoid grabbing a lock. Usually Flush() calls it after + // acquiring lock_. + void FlushUnlocked(const std::chrono::system_clock::time_point& now); ++ void CheckFileNumQuota(); + + private: + static const uint32 kRolloverAttemptFrequency = 0x20; +@@ -491,6 +500,9 @@ + std::chrono::system_clock::time_point + next_flush_time_; // cycle count at which to flush log + std::chrono::system_clock::time_point start_time_; ++ std::list file_list_; ++ bool inited_{false}; ++ struct ::tm tm_time_{}; + + // Actually create a logfile using the value of base_filename_ and the + // optional argument time_pid_string +@@ -707,10 +719,8 @@ + // all this stuff. + std::lock_guard l{log_mutex}; + for (int i = min_severity; i < NUM_SEVERITIES; i++) { +- LogDestination* log = log_destination(static_cast(i)); +- if (log != nullptr) { +- log->logger_->Flush(); +- } ++ LogDestination* log = log_destinations_[i].get(); ++ if (log != nullptr) log->logger_->Flush(); + } + } + +@@ -903,9 +913,12 @@ + } else if (FLAGS_logtostderr) { // global flag: never log to file + ColoredWriteToStderr(severity, message, len); + } else { +- for (int i = severity; i >= 0; --i) { +- LogDestination::MaybeLogToLogfile(static_cast(i), timestamp, +- message, len); ++ if (severity >= 1) { ++ LogDestination::MaybeLogToLogfile(GLOG_WARNING, timestamp, message, len); ++ LogDestination::MaybeLogToLogfile(GLOG_INFO, timestamp, message, len); ++ } else if (severity == 0) { ++ LogDestination::MaybeLogToLogfile(GLOG_INFO, timestamp, message, len); ++ } else { + } + } + } +@@ -1059,11 +1072,11 @@ + string_filename += filename_extension_; + const char* filename = string_filename.c_str(); + // only write to files, create if non-existant. +- int flags = O_WRONLY | O_CREAT; +- if (FLAGS_timestamp_in_logfile_name) { +- // demand that the file is unique for our timestamp (fail if it exists). +- flags = flags | O_EXCL; +- } ++ int flags = O_WRONLY | O_CREAT | O_APPEND; ++ // if (FLAGS_timestamp_in_logfile_name) { ++ // // demand that the file is unique for our timestamp (fail if it exists). ++ // flags = flags | O_EXCL; ++ // } + FileDescriptor fd{ + open(filename, flags, static_cast(FLAGS_logfile_mode))}; + if (!fd) return false; +@@ -1112,6 +1125,9 @@ + } + } + #endif ++ Filetime ft; ++ ft.name = string_filename; ++ file_list_.push_back(ft); + // We try to create a symlink called ., + // which is easier to use. (Every time we create a new logfile, + // we destroy the old symlink and create a new one, so it always +@@ -1155,6 +1171,58 @@ + return true; // Everything worked + } + ++void LogFileObject::CheckFileNumQuota() { ++ struct dirent* entry; ++ DIR* dp; ++ ++ const vector& log_dirs = GetLoggingDirectories(); ++ if (log_dirs.size() < 1) return; ++ ++ dp = opendir(log_dirs[0].c_str()); ++ if (dp == nullptr) { ++ fprintf(stderr, "open log dir %s fail\n", log_dirs[0].c_str()); ++ return; ++ } ++ ++ file_list_.clear(); ++ while ((entry = readdir(dp)) != nullptr) { ++ if (DT_DIR == entry->d_type || DT_LNK == entry->d_type) { ++ continue; ++ } ++ std::string filename = std::string(entry->d_name); ++ ++ if (filename.find(symlink_basename_ + '.' + ++ LogSeverityNames[severity_]) == 0) { ++ std::string filepath = log_dirs[0] + "/" + filename; ++ ++ struct stat fstat; ++ if (::stat(filepath.c_str(), &fstat) < 0) { ++ fprintf(stderr, "state %s fail\n", filepath.c_str()); ++ closedir(dp); ++ return; ++ } ++ ++ Filetime file_time; ++ file_time.time = fstat.st_mtime; ++ file_time.name = filepath; ++ file_list_.push_back(file_time); ++ } ++ } ++ closedir(dp); ++ ++ file_list_.sort(); ++ ++ auto log_filenum_quota = FLAGS_log_filenum_quota; ++ if (severity_ == GLOG_WARNING && FLAGS_warn_log_filenum_quota > 0) { ++ log_filenum_quota = FLAGS_warn_log_filenum_quota; ++ } ++ while (log_filenum_quota > 0 && ++ file_list_.size() >= static_cast(log_filenum_quota)) { ++ unlink(file_list_.front().name.c_str()); ++ file_list_.pop_front(); ++ } ++} ++ + void LogFileObject::Write( + bool force_flush, const std::chrono::system_clock::time_point& timestamp, + const char* message, size_t message_len) { +@@ -1175,12 +1243,58 @@ + // Remove old logs + ScopedExit cleanupAtEnd{cleanupLogs}; + +- if (file_length_ >> 20U >= MaxLogSize() || PidHasChanged()) { ++ struct ::tm tm_time; ++ std::time_t t = std::chrono::system_clock::to_time_t(timestamp); ++ ++ bool is_split = false; ++ if ("day" == FLAGS_log_split_method) { ++ localtime_r(&t, &tm_time); ++ if (tm_time.tm_year != tm_time_.tm_year || ++ tm_time.tm_mon != tm_time_.tm_mon || ++ tm_time.tm_mday != tm_time_.tm_mday) { ++ is_split = true; ++ } ++ } else if ("hour" == FLAGS_log_split_method) { ++ localtime_r(&t, &tm_time); ++ if (tm_time.tm_year != tm_time_.tm_year || ++ tm_time.tm_mon != tm_time_.tm_mon || ++ tm_time.tm_mday != tm_time_.tm_mday || ++ tm_time.tm_hour != tm_time_.tm_hour) { ++ is_split = true; ++ } ++ } else if (file_length_ >> 20U >= MaxLogSize()) { ++ is_split = true; ++ } ++ ++ if (is_split) { + file_ = nullptr; + file_length_ = bytes_since_flush_ = dropped_mem_length_ = 0; + rollover_attempt_ = kRolloverAttemptFrequency - 1; + } + ++ if ((file_ == nullptr) && (!inited_) && (FLAGS_log_split_method == "size")) { ++ CheckFileNumQuota(); ++ if (!file_list_.empty()) { ++ const char* filename = file_list_.back().name.c_str(); ++ int fd = open(filename, O_WRONLY | O_CREAT | O_APPEND, ++ static_cast(FLAGS_logfile_mode)); ++ if (fd != -1) { ++#ifdef HAVE_FCNTL ++ fcntl(fd, F_SETFD, FD_CLOEXEC); ++#endif ++ file_.reset(fdopen(fd, "a+")); ++ if (file_ == nullptr) { ++ close(fd); ++ } else { ++ fseek(file_.get(), 0, SEEK_END); ++ file_length_ = bytes_since_flush_ = ++ static_cast(ftell(file_.get())); ++ inited_ = true; ++ } ++ } ++ } ++ } ++ + // If there's no destination file, make one before outputting + if (file_ == nullptr) { + // Try to rollover the log file every 32 log messages. The only time +@@ -1189,8 +1303,20 @@ + if (++rollover_attempt_ != kRolloverAttemptFrequency) return; + rollover_attempt_ = 0; + +- struct ::tm tm_time; +- std::time_t t = std::chrono::system_clock::to_time_t(timestamp); ++ if (!inited_) { ++ CheckFileNumQuota(); ++ inited_ = true; ++ } else { ++ auto log_filenum_quota = FLAGS_log_filenum_quota; ++ if (severity_ == GLOG_WARNING && FLAGS_warn_log_filenum_quota > 0) { ++ log_filenum_quota = FLAGS_warn_log_filenum_quota; ++ } ++ while (log_filenum_quota > 0 && ++ file_list_.size() >= static_cast(log_filenum_quota)) { ++ unlink(file_list_.front().name.c_str()); ++ file_list_.pop_front(); ++ } ++ } + + if (FLAGS_log_utc_time) { + gmtime_r(&t, &tm_time); +@@ -1198,13 +1324,21 @@ + localtime_r(&t, &tm_time); + } + +- // The logfile's filename will have the date/time & pid in it ++ // The logfile's filename will have the date/time in it + ostringstream time_pid_stream; + time_pid_stream.fill('0'); + time_pid_stream << 1900 + tm_time.tm_year << setw(2) << 1 + tm_time.tm_mon +- << setw(2) << tm_time.tm_mday << '-' << setw(2) +- << tm_time.tm_hour << setw(2) << tm_time.tm_min << setw(2) +- << tm_time.tm_sec << '.' << GetMainThreadPid(); ++ << setw(2) << tm_time.tm_mday; ++ ++ if ("hour" == FLAGS_log_split_method) { ++ time_pid_stream << setw(2) << tm_time.tm_hour; ++ } else if ("day" != FLAGS_log_split_method) { ++ time_pid_stream << '-' << setw(2) << tm_time.tm_hour << setw(2) ++ << tm_time.tm_min << setw(2) << tm_time.tm_sec; ++ } ++ ++ tm_time_ = tm_time; ++ + const string& time_pid_string = time_pid_stream.str(); + + if (base_filename_selected_) { +@@ -1215,31 +1349,10 @@ + return; + } + } else { +- // If no base filename for logs of this severity has been set, use a +- // default base filename of +- // "...log..". So +- // logfiles will have names like +- // webserver.examplehost.root.log.INFO.19990817-150000.4354, where +- // 19990817 is a date (1999 August 17), 150000 is a time (15:00:00), +- // and 4354 is the pid of the logging process. The date & time reflect +- // when the file was created for output. +- // +- // Where does the file get put? Successively try the directories +- // "/tmp", and "." + string stripped_filename( + glog_internal_namespace_::ProgramInvocationShortName()); +- string hostname; +- GetHostName(&hostname); +- +- string uidname = MyUserName(); +- // We should not call CHECK() here because this function can be +- // called after holding on to log_mutex. We don't want to +- // attempt to hold on to the same mutex, and get into a +- // deadlock. Simply use a name like invalid-user. +- if (uidname.empty()) uidname = "invalid-user"; +- +- stripped_filename = stripped_filename + '.' + hostname + '.' + uidname + +- ".log." + LogSeverityNames[severity_] + '.'; ++ stripped_filename = ++ stripped_filename + "." + LogSeverityNames[severity_] + ".log."; + // We're going to (potentially) try to put logs in several different dirs + const vector& log_dirs = GetLoggingDirectories(); + +@@ -1261,42 +1374,6 @@ + return; + } + } +- +- // Write a header message into the log file +- if (FLAGS_log_file_header) { +- ostringstream file_header_stream; +- file_header_stream.fill('0'); +- file_header_stream << "Log file created at: " << 1900 + tm_time.tm_year +- << '/' << setw(2) << 1 + tm_time.tm_mon << '/' +- << setw(2) << tm_time.tm_mday << ' ' << setw(2) +- << tm_time.tm_hour << ':' << setw(2) << tm_time.tm_min +- << ':' << setw(2) << tm_time.tm_sec +- << (FLAGS_log_utc_time ? " UTC\n" : "\n") +- << "Running on machine: " << LogDestination::hostname() +- << '\n'; +- +- if (!g_application_fingerprint.empty()) { +- file_header_stream << "Application fingerprint: " +- << g_application_fingerprint << '\n'; +- } +- const char* const date_time_format = FLAGS_log_year_in_prefix +- ? "yyyymmdd hh:mm:ss.uuuuuu" +- : "mmdd hh:mm:ss.uuuuuu"; +- file_header_stream +- << "Running duration (h:mm:ss): " +- << PrettyDuration( +- std::chrono::duration_cast>( +- timestamp - start_time_)) +- << '\n' +- << "Log line format: [IWEF]" << date_time_format << " " +- << "threadid file:line] msg" << '\n'; +- const string& file_header_string = file_header_stream.str(); +- +- const size_t header_len = file_header_string.size(); +- fwrite(file_header_string.data(), 1, header_len, file_.get()); +- file_length_ += header_len; +- bytes_since_flush_ += header_len; +- } + } + + // Write to LOG file +--- a/src/utilities.cc ++++ b/src/utilities.cc +@@ -296,6 +296,14 @@ + g_reason.compare_exchange_strong(expected, r); + } + ++#ifdef HAVE_STACKTRACE ++void DumpStackTraceToString(std::string* stacktrace) { ++ if (stacktrace == nullptr) return; ++ stacktrace->clear(); ++ DumpStackTrace(1, DebugWriteToString, stacktrace); ++} ++#endif ++ + void InitGoogleLoggingUtilities(const char* argv0) { + CHECK(!IsGoogleLoggingInitialized()) + << "You called InitGoogleLogging() twice!"; diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh index 980a2c5fc92002..f57943028a7e9f 100644 --- a/thirdparty/vars.sh +++ b/thirdparty/vars.sh @@ -86,10 +86,10 @@ GFLAGS_SOURCE=gflags-2.2.2 GFLAGS_MD5SUM="1a865b93bacfa963201af3f75b7bd64c" # glog -GLOG_DOWNLOAD="https://github.com/google/glog/archive/refs/tags/v0.6.0.tar.gz" -GLOG_NAME="glog-v0.6.0.tar.gz" -GLOG_SOURCE=glog-0.6.0 -GLOG_MD5SUM="c98a6068bc9b8ad9cebaca625ca73aa2" +GLOG_DOWNLOAD="https://github.com/google/glog/archive/refs/tags/v0.7.1.tar.gz" +GLOG_NAME="glog-v0.7.1.tar.gz" +GLOG_SOURCE=glog-0.7.1 +GLOG_MD5SUM="128e2995cc33d794ff24f785a3060346" # gtest GTEST_DOWNLOAD="https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz"