You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by hu...@apache.org on 2026/05/12 17:40:08 UTC
(doris) branch fe_local_shuffle updated (08862cec4f3 -> bcc692b3158)
This is an automated email from the ASF dual-hosted git repository.
924060929 pushed a change to branch fe_local_shuffle
in repository https://gitbox.apache.org/repos/asf/doris.git
discard 08862cec4f3 [fix](build) Make multi_version.h compile on both libc++ and libstdc++
new bcc692b3158 [fix](build) Make multi_version.h compile on both libc++ and libstdc++
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (08862cec4f3)
\
N -- N -- N refs/heads/fe_local_shuffle (bcc692b3158)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
be/src/common/multi_version.h | 41 ++++++++++++++---------------------------
1 file changed, 14 insertions(+), 27 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 01/01: [fix](build) Make multi_version.h compile on both libc++ and libstdc++
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
924060929 pushed a commit to branch fe_local_shuffle
in repository https://gitbox.apache.org/repos/asf/doris.git
commit bcc692b3158aa3645ef5e8ad6948351cc3573181
Author: 924060929 <la...@selectdb.com>
AuthorDate: Wed May 13 01:26:39 2026 +0800
[fix](build) Make multi_version.h compile on both libc++ and libstdc++
The previous fix in 35c69241bb7 switched MultiVersion to the free
std::atomic_load / std::atomic_store functions because libc++ in
LLVM 20 (macOS) does not yet specialize std::atomic for
std::shared_ptr (shared_ptr is not trivially_copyable).
But libstdc++ 12+ (used by the Linux RQG compile, gcc 15) marks
those free atomic_load/atomic_store overloads as deprecated in C++20.
Doris builds with -Werror, so the RQG compile fails:
error: 'atomic_load<const doris::RuntimeProfile>' is deprecated:
use 'std::atomic<std::shared_ptr<T>>' instead
[-Werror,-Wdeprecated-declarations]
Drop both atomic paths and use std::shared_mutex:
- shared_lock on get() lets multiple readers proceed concurrently,
matching MultiVersion's "many readers, occasional writer" intent.
- unique_lock on set() serializes the version swap.
- Portable across all toolchains we build with.
MultiVersion is only used on low-frequency paths (metrics scrape /
debug strings / symbol resolution), so the lock overhead vs.
atomic<shared_ptr> is negligible in practice.
---
be/src/common/multi_version.h | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/be/src/common/multi_version.h b/be/src/common/multi_version.h
index aadd2ef3237..c3858da779f 100644
--- a/be/src/common/multi_version.h
+++ b/be/src/common/multi_version.h
@@ -21,6 +21,7 @@
#pragma once
#include <memory>
+#include <shared_mutex>
/** Allow to store and read-only usage of an object in several threads,
* and to atomically replace an object in another thread.
@@ -47,20 +48,30 @@ public:
/// Default initialization - by nullptr.
MultiVersion() = default;
- explicit MultiVersion(std::unique_ptr<const T>&& value) : current_version(std::move(value)) {}
+ explicit MultiVersion(std::unique_ptr<const T>&& value)
+ : current_version(Version {std::move(value)}) {}
- // Use the pre-C++20 atomic free functions for shared_ptr instead of
- // std::atomic<shared_ptr>, which requires a trivially_copyable specialization
- // not available in all libc++ versions (e.g., LLVM 20).
+ // Use a shared_mutex (read-write lock) rather than the C++20
+ // std::atomic<std::shared_ptr<T>> specialization or the deprecated free
+ // atomic_load/atomic_store overloads — neither is portable across the
+ // toolchains we build with (libc++ in LLVM 20 lacks the atomic<shared_ptr>
+ // specialization; libstdc++ 12+ marks the free functions deprecated).
+ // MultiVersion is only used on low-frequency paths (metrics scrape,
+ // debug strings, symbol resolution), so the lock overhead is negligible.
/// Obtain current version for read-only usage. Returns shared_ptr, that manages lifetime of version.
- Version get() const { return std::atomic_load(¤t_version); }
+ Version get() const {
+ std::shared_lock lock(mutex);
+ return current_version;
+ }
/// Update an object with new version.
void set(std::unique_ptr<const T>&& value) {
- std::atomic_store(¤t_version, Version {std::move(value)});
+ std::unique_lock lock(mutex);
+ current_version = Version {std::move(value)};
}
private:
+ mutable std::shared_mutex mutex;
Version current_version;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org