-
Notifications
You must be signed in to change notification settings - Fork 6k
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, client: Filter statfs for file systems with a single data pool #16378
Conversation
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.
This looks great. Let's add an entry to PendingReleaseNotes to publicise it.
@fullerdj sorry I msised this because of no cephfs label. I'll take a look now. |
looks like it needs a rebase while I'm at it. |
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.
Looks good overall to me but should have a trivial test confirming it works. An extra pool using a few megabytes which is shown not to be included in the statfs on the data pool should suffice?
} | ||
|
||
void encode_payload(uint64_t features) override { | ||
paxos_encode(); | ||
::encode(fsid, payload); | ||
::encode(data_pool, payload); |
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.
Is this always encoded as an int?
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.
It's encoded as a boost::optional. There's a defined encoding for that:
https://github.com/ceph/ceph/blob/master/src/include/encoding.h#L289
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.
Ah, cool.
src/mon/MgrStatMonitor.cc
Outdated
@@ -290,11 +291,11 @@ bool MgrStatMonitor::preprocess_getpoolstats(MonOpRequestRef op) | |||
return true; | |||
} | |||
|
|||
bool MgrStatMonitor::preprocess_statfs(MonOpRequestRef op) | |||
{ | |||
bool MgrStatMonitor::preprocess_statfs(MonOpRequestRef op) { |
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.
Unnecessary code churn (and conflicts with style of the file).
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.
More likely unnecessary press of the shift key whilst scrolling.
src/mon/PGMap.h
Outdated
*/ | ||
int64_t get_pool_free_space(const OSDMap &osd_map, int poolid) const; | ||
|
||
float pool_raw_used_rate(const OSDMap &osd_map, int poolid) const |
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.
Why not put this as a static function in PGMap.cc?
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.
Most of the other stats gathering functions are exported. Some of these stats gathering functions are rather new; we seem to be interested in exposing more statistics that rely on telling the user how many more bytes they're allowed to store.
These are certainly only used in PGMap.cc for now, though, so I can move it there if you prefer.
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.
Let's just keep it in PGMap.cc for now.
087ad1b
to
da8f820
Compare
For a test, we can just see if the report accounts for replication/ec overhead. I'll come up with something. |
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.
a few comments, but otherwise this is awesome!
I wonder if it is possible to do this based on the current directory? Linux maps that back to a superblock so no, but the glibc call takes a path name, which means in theory we could look at that directory's layout (vs the whole fs).
src/messages/MStatfs.h
Outdated
MStatfs() : PaxosServiceMessage(CEPH_MSG_STATFS, 0) {} | ||
MStatfs(const uuid_d& f, ceph_tid_t t, version_t v) : | ||
PaxosServiceMessage(CEPH_MSG_STATFS, v), fsid(f) { | ||
MStatfs() : PaxosServiceMessage(CEPH_MSG_STATFS, 0, 2) {} |
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.
should use the const definitions at the top of the class like other messages... see e.g.
https://github.com/ceph/ceph/blob/master/src/messages/MOSDOp.h#L36
src/messages/MStatfs.h
Outdated
@@ -22,10 +22,12 @@ | |||
class MStatfs : public PaxosServiceMessage { | |||
public: | |||
uuid_d fsid; | |||
boost::optional<int> data_pool; |
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.
this should be int64_t instead of int
src/mon/MgrStatMonitor.cc
Outdated
ceph_statfs get_statfs() const override { | ||
return digest.get_statfs(); | ||
ceph_statfs get_statfs(OSDMap& osdmap, | ||
boost::optional<int> data_pool) const override { |
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.
s/int/int64_t/
src/mon/PGMap.cc
Outdated
@@ -614,6 +614,21 @@ void PGMapDigest::pool_cache_io_rate_summary(Formatter *f, ostream *out, | |||
cache_io_rate_summary(f, out, p->second.first, ts->second); | |||
} | |||
|
|||
int64_t PGMapDigest::get_pool_free_space(const OSDMap &osd_map, | |||
int poolid) const |
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.
int64_t
src/mon/PGMap.h
Outdated
statfs.num_objects = pg_sum.stats.sum.num_objects; | ||
|
||
if (data_pool) { | ||
const pool_stat_t &stat = pg_pool_sum.at(*data_pool); |
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.
this should probably fall back if the pool doesn't exist (e.g., if a client statfs request races with a pool deletion)
8a21c5c
to
90edb88
Compare
Tracker ticket: http://tracker.ceph.com/issues/19109 |
@fullerdj your rebase got screwed up somehow. |
It seems so. I'm writing up a test, so at least this will make sure this PR doesn't get merged beforehand. |
Ok, I've added a test. This should be ready to go. |
qa/tasks/cephfs/test_misc.py
Outdated
fs_avail = float(fs_avail) * 1024 | ||
|
||
ratio = (raw_avail / pool_size) / fs_avail | ||
assert ratio > 0.9 and ratio < 1.1 |
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.
nit, could just put
assert 0.9 < ratio < 1.1
The test is racy. Even though it does conv=fdatasync, that is a nop on fuse. This probably used to work because of the previous dd; although it looks for |
Bump encoding version accordingly. Signed-off-by: Douglas Fuller <dfuller@redhat.com>
35a640d
to
ac1c0a3
Compare
MStatfs now includes an optional data pool element for filesystems with a single data pool, support this element and return data for a single data pool if requested. Signed-off-by: Douglas Fuller <dfuller@redhat.com>
Extend the Objecter's StatfsOp to support MStatfs::data_pool. This requests statistics for a single data pool in the case of a filesystem that has exactly one. Signed-off-by: Douglas Fuller <dfuller@redhat.com>
When statfs() is called for a filesystem with a single data pool, add that as an argument to receive statistics for that pool only. Signed-off-by: Douglas Fuller <dfuller@redhat.com>
Signed-off-by: Douglas Fuller <dfuller@redhat.com>
Add a test for filtered df for file systems with single data pools. Signed-off-by: Douglas Fuller <dfuller@redhat.com>
10c9ece
to
3b70b33
Compare
Signed-off-by: Douglas Fuller <dfuller@redhat.com>
Presumably this was caused by a bad rebase. Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* refs/remotes/upstream/pull/16378/head: doc: remove accidental additions to release notes qa/cephfs: Fix race in test_volume_client qa/cephfs: Test filtered df PendingReleaseNotes: add note about df filtering client: Support new, filtered MStatfs objecter: Support new, filtered MStatfs mon/PGMap stats: Support new, filtered MStatfs messages: Add optional data pool to MStatfs Reviewed-by: John Spray <john.spray@redhat.com> Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> Reviewed-by: Sage Weil <sage@redhat.com>
* refs/remotes/upstream/pull/16378/head: doc: remove accidental additions to release notes qa/cephfs: Fix race in test_volume_client qa/cephfs: Test filtered df PendingReleaseNotes: add note about df filtering client: Support new, filtered MStatfs objecter: Support new, filtered MStatfs mon/PGMap stats: Support new, filtered MStatfs messages: Add optional data pool to MStatfs Reviewed-by: John Spray <john.spray@redhat.com> Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> Reviewed-by: Sage Weil <sage@redhat.com>
No description provided.