-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mon,osd,osdc: refactor snap trimming (phase 1) #18276
Changes from 25 commits
c536d4c
c8bfe3f
81d63f2
df7523b
ea308ad
3119cf5
1b1eec2
b9c5a24
e89649d
1f133a2
37c4aff
553048f
9d606c5
49833c3
38e96ec
32d7538
b1b8fc6
192a8dc
a53ba73
345d3b6
6df912b
86f0b81
e5f62fb
33c9907
f04729c
231ec67
6e1b7c4
16c5bcc
fd6a59e
9607a2d
f2d602a
8c44dab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ tasks: | |
- \(SLOW_OPS\) | ||
- \(PG_ | ||
- \(OSD_ | ||
- \(OBJECT_ | ||
- thrashosds: | ||
op_delay: 30 | ||
clean_interval: 120 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,8 @@ extern "C" { | |
#include <string> | ||
#include <list> | ||
#include <set> | ||
#include <boost/container/flat_set.hpp> | ||
#include <boost/container/flat_map.hpp> | ||
#include <map> | ||
#include <vector> | ||
#include <iostream> | ||
|
@@ -106,6 +108,10 @@ inline ostream& operator<<(ostream& out, const list<A,Alloc>& ilist); | |
template<class A, class Comp, class Alloc> | ||
inline ostream& operator<<(ostream& out, const set<A, Comp, Alloc>& iset); | ||
template<class A, class Comp, class Alloc> | ||
inline ostream& operator<<(ostream& out, const boost::container::flat_set<A, Comp, Alloc>& iset); | ||
template<class A, class B, class Comp, class Alloc> | ||
inline ostream& operator<<(ostream& out, const boost::container::flat_map<A, B, Comp, Alloc>& iset); | ||
template<class A, class Comp, class Alloc> | ||
inline ostream& operator<<(ostream& out, const multiset<A,Comp,Alloc>& iset); | ||
template<class A, class B, class Comp, class Alloc> | ||
inline ostream& operator<<(ostream& out, const map<A,B,Comp,Alloc>& m); | ||
|
@@ -166,6 +172,28 @@ inline ostream& operator<<(ostream& out, const set<A, Comp, Alloc>& iset) { | |
return out; | ||
} | ||
|
||
template<class A, class Comp, class Alloc> | ||
inline ostream& operator<<(ostream& out, const boost::container::flat_set<A, Comp, Alloc>& iset) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this boost-specific instead of using the generic ceph-namespaced set/map? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. flat_set and flat_map != set and map There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant ceph::flat_map instead of boost::flat_map, guess I left off too many words! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh! because they're not aliased in the ceph namespace. i'm not a real fan of doing that unless there is a reason we'd swap implementations (like we had to with shared_ptr forever ago); it just obscures things for someone reading the code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh hmm, I misread the mempool setup and thought you were adding an alias. I always kind of liked them thanks to the shared_ptr experience. I thought @wjwithagen had taken advantage of that pattern for some porting work as well, but maybe it doesn't matter for boost bits. |
||
for (auto it = iset.begin(); | ||
it != iset.end(); | ||
++it) { | ||
if (it != iset.begin()) out << ","; | ||
out << *it; | ||
} | ||
return out; | ||
} | ||
|
||
template<class A, class B, class Comp, class Alloc> | ||
inline ostream& operator<<(ostream& out, const boost::container::flat_map<A, B, Comp, Alloc>& m) { | ||
for (auto it = m.begin(); | ||
it != m.end(); | ||
++it) { | ||
if (it != m.begin()) out << ","; | ||
out << it->first << "=" << it->second; | ||
} | ||
return out; | ||
} | ||
|
||
template<class A, class Comp, class Alloc> | ||
inline ostream& operator<<(ostream& out, const multiset<A,Comp,Alloc>& iset) { | ||
for (auto it = iset.begin(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,14 +22,20 @@ | |
|
||
class MOSDMap : public Message { | ||
|
||
static const int HEAD_VERSION = 3; | ||
static const int HEAD_VERSION = 4; | ||
static const int COMPAT_VERSION = 3; | ||
|
||
public: | ||
uuid_d fsid; | ||
map<epoch_t, bufferlist> maps; | ||
map<epoch_t, bufferlist> incremental_maps; | ||
epoch_t oldest_map =0, newest_map = 0; | ||
|
||
// if we are fetching maps from the mon and have to jump a gap | ||
// (client's next needed map is older than mon's oldest) we can | ||
// share removed snaps from the gap here. | ||
mempool::osdmap::map<int64_t,OSDMap::snap_interval_set_t> gap_removed_snaps; | ||
|
||
epoch_t get_first() const { | ||
epoch_t e = 0; | ||
map<epoch_t, bufferlist>::const_iterator i = maps.begin(); | ||
|
@@ -56,9 +62,9 @@ class MOSDMap : public Message { | |
} | ||
|
||
|
||
MOSDMap() : Message(CEPH_MSG_OSD_MAP, HEAD_VERSION) { } | ||
MOSDMap() : Message(CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION) { } | ||
MOSDMap(const uuid_d &f) | ||
: Message(CEPH_MSG_OSD_MAP, HEAD_VERSION), | ||
: Message(CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION), | ||
fsid(f), | ||
oldest_map(0), newest_map(0) { } | ||
private: | ||
|
@@ -78,9 +84,13 @@ class MOSDMap : public Message { | |
oldest_map = 0; | ||
newest_map = 0; | ||
} | ||
if (header.version >= 4) { | ||
::decode(gap_removed_snaps, p); | ||
} | ||
} | ||
void encode_payload(uint64_t features) override { | ||
header.version = HEAD_VERSION; | ||
header.compat_version = COMPAT_VERSION; | ||
::encode(fsid, payload); | ||
if ((features & CEPH_FEATURE_PGID64) == 0 || | ||
(features & CEPH_FEATURE_PGPOOL3) == 0 || | ||
|
@@ -93,6 +103,7 @@ class MOSDMap : public Message { | |
header.version = 1; // old old_client version | ||
else if ((features & CEPH_FEATURE_OSDENC) == 0) | ||
header.version = 2; // old pg_pool_t | ||
header.compat_version = 0; | ||
|
||
// reencode maps using old format | ||
// | ||
|
@@ -138,13 +149,18 @@ class MOSDMap : public Message { | |
::encode(oldest_map, payload); | ||
::encode(newest_map, payload); | ||
} | ||
if (header.version >= 4) { | ||
::encode(gap_removed_snaps, payload); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is missing the corresponding decode statement. |
||
} | ||
} | ||
|
||
const char *get_type_name() const override { return "osdmap"; } | ||
void print(ostream& out) const override { | ||
out << "osd_map(" << get_first() << ".." << get_last(); | ||
if (oldest_map || newest_map) | ||
out << " src has " << oldest_map << ".." << newest_map; | ||
if (!gap_removed_snaps.empty()) | ||
out << " +gap_removed_snaps"; | ||
out << ")"; | ||
} | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Squash this patch?