-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refs/pull/22534/head: msg/Messenger: use safe_item_history<> for my_addrs msg/simple: fix set_myaddrs() msg/Messenger: use mutable_item_history<> for my_addrs common/item_history: container to support lockless reads, infrequent updates msg/simple/Accepter: fix my_addr == my_addrs.v[0] constraint msg/async: track target_addr for each connection msg/async: mark accepted connections with addr type (legacy or msgr2) msg/async: mark AsyncConnection with msgr2 flag msg/async: track connections by addrvec mon/Session: inst -> name and addrs osd/OSDMap: don't print hb addrs msg/DispatchQueue: myaddr -> myaddrs mgr: myaddr -> myaddrs msg: make set_addr_unknowns take an addrvec mon/LogMonitor: myaddr -> myaddrs librados: myaddr -> myaddrs common/LogClient: myaddr -> myaddrs client: myaddr -> myaddrs osd/OSDMap: is_blacklisted() for addrvecs osd: populate metadata with all addrs mds: addr -> addrvec mon/MonClient: get_myaddrs() mon/OSDMonitor: addrvec blacklist helper mds: use new pick_addresses ceph-osd: use new bindv() msg/async: bind to multiple addresses msg/async: (legacy) handshake using legacy addr msg/async: fix some debug prefixes msg/async: multiple listening ServerSockets osd/OSDMap: make cluster addrs addrvecs too msg/Messenger: my_addr -> my_addrs msg/Connection: peer_addr -> peer_addrs msg/msg_types: hash<> for entity_addrvec_t mgr/DaemonServer: use new bindv() and pick_addresses() msg/Messenger: new bindv() that takes an addrvec common/pick_address: fill in ipv4/6 and msgr1/msgr2 via config options common/pick_addresses: new addrvec-based pick_addresses() common/pick_addresses: add filtering by ipv4 and ipv6 CEPH_MON_PORT -> CEPH_MON_PORT_LEGACY; define CEPH_MON_PORT_IANA osd: kill osd_heartbeat_addr option common/options: add addrvec option type Reviewed-by: Ricardo Dias <[email protected]>
- Loading branch information
Showing
60 changed files
with
1,502 additions
and
641 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | ||
// vim: ts=8 sw=2 smarttab | ||
|
||
#pragma once | ||
|
||
#include <list> | ||
#include <mutex> | ||
|
||
/* | ||
Keep a history of item values so that readers can dereference the pointer to | ||
the latest value and continue using it as long as they want. This container | ||
is only appropriate for values that are updated a handful of times over their | ||
total lifetime. | ||
There is a prune() method to throw out old values, but it should only be used | ||
if the caller has some way of knowing all readers are done. | ||
*/ | ||
|
||
template<class T> | ||
class mutable_item_history { | ||
private: | ||
std::mutex lock; | ||
std::list<T> history; | ||
T *current = nullptr; | ||
|
||
public: | ||
mutable_item_history() { | ||
history.emplace_back(T()); | ||
current = &history.back(); | ||
} | ||
|
||
// readers are lock-free | ||
const T& operator*() const { | ||
return *current; | ||
} | ||
const T *operator->() const { | ||
return current; | ||
} | ||
|
||
// non-const variants (be careful!) | ||
T& operator*() { | ||
return *current; | ||
} | ||
T *operator->() { | ||
return current; | ||
} | ||
|
||
// writes are serialized | ||
const T& operator=(const T& other) { | ||
std::lock_guard<std::mutex> l(lock); | ||
history.push_back(other); | ||
current = &history.back(); | ||
return *current; | ||
} | ||
|
||
void prune() { | ||
// note: this is not necessarily thread-safe wrt readers | ||
std::lock_guard<std::mutex> l(lock); | ||
while (history.size() > 1) { | ||
history.pop_front(); | ||
} | ||
} | ||
}; | ||
|
||
template<class T> | ||
class safe_item_history { | ||
private: | ||
std::mutex lock; | ||
std::list<T> history; | ||
T *current = nullptr; | ||
|
||
public: | ||
safe_item_history() { | ||
history.emplace_back(T()); | ||
current = &history.back(); | ||
} | ||
|
||
// readers are lock-free | ||
const T& operator*() const { | ||
return *current; | ||
} | ||
const T *operator->() const { | ||
return current; | ||
} | ||
|
||
// writes are serialized | ||
const T& operator=(const T& other) { | ||
std::lock_guard<std::mutex> l(lock); | ||
history.push_back(other); | ||
current = &history.back(); | ||
return *current; | ||
} | ||
|
||
void prune() { | ||
// note: this is not necessarily thread-safe wrt readers | ||
std::lock_guard<std::mutex> l(lock); | ||
while (history.size() > 1) { | ||
history.pop_front(); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.