mds: add a command to dump directory information#49756
Conversation
The tests for |
Sounds good. |
src/mds/MDCache.cc
Outdated
| f->open_object_section("resolve_status"); | ||
| f->dump_stream("resolve_gather") << resolve_gather; | ||
| f->dump_stream("resolve_ack_gather") << resolve_gather; | ||
| f->dump_stream("resolve_ack_gather") << resolve_ack_gather; |
There was a problem hiding this comment.
Advisable to make this a separate commit ?
There was a problem hiding this comment.
Advisable to make this a separate commit ?
I have separated it into a new PR #49882.
OK! I have done it. |
|
@zhsgao can you create a separate commit for the test? It would be less cluttered that way |
OK! I have done it. |
Thanks, although a slight change can be done for the commit title - Also, this might also need to be documented somewhere, maybe in PendingReleaseNotes or in |
I have modified the commit title. |
yeah, those are asok commands, and a lot of them have not been documented anywhere. maybe we need a place in docs or somewhere else to dump info about these commands. @vshankar what do you think? |
src/mds/MDCache.cc
Outdated
|
|
||
| bool MDCache::dump_dir(Formatter *f, CDir *dir) { | ||
| f->open_object_section("dir"); | ||
| dir->dump(f); |
There was a problem hiding this comment.
This, by default, does not dump dentry items. Should that be made optional?
There was a problem hiding this comment.
This, by default, does not dump dentry items. Should that be made optional?
Yes, I think it's a good idea and I have added an option for it. Thanks!
Let's do doc changes in a separate PR. |
qa/tasks/cephfs/test_misc.py
Outdated
| def test_dump_dir(self): | ||
| self.mount_a.run_shell(["mkdir", "-p", "foo/bar"]) | ||
| dirs = self.fs.mds_asok(['dump', 'dir', '/foo']) | ||
| assert type(dirs) is list |
There was a problem hiding this comment.
minor nit: use self.assertTrue()
There was a problem hiding this comment.
minor nit: use self.assertTrue()
Thanks! I have modified them.
src/mds/MDCache.cc
Outdated
| bool MDCache::dump_dir(Formatter *f, CDir *dir, bool dentry_dump) { | ||
| f->open_object_section("dir"); | ||
| dir->dump(f, dentry_dump ? CDir::DUMP_ALL : CDir::DUMP_DEFAULT); | ||
| f->close_section(); | ||
| return true; | ||
| } |
There was a problem hiding this comment.
code looks good, just a question: is there any reason for this function to have bool return type? I think void would do too
There was a problem hiding this comment.
code looks good, just a question: is there any reason for this function to have
boolreturn type? I thinkvoidwould do too
I have modified it. At first I referred to dump_inode and the type of its return value is boolean.
qa/tasks/cephfs/test_misc.py
Outdated
| dirs = self.fs.mds_asok(['dump', 'dir', '/foo']) | ||
| assert type(dirs) is list | ||
| for dir in dirs: | ||
| assert dir['path'] == "/foo" |
There was a problem hiding this comment.
as venky mentioned, using self.assert* would be better, do try to replace all assertions if possible, for e.g you can use self.assertEquals() here
There was a problem hiding this comment.
as venky mentioned, using self.assert* would be better, do try to replace all assertions if possible, for e.g you can use
self.assertEquals()here
OK! I have replaced all assertions in this file.
There was a problem hiding this comment.
thanks! but i guess you got me a little bit wrong, by all i meant those in your test case. However if you feel you want to replace them as well, maybe that can be done separately in another commit, but i'm not very sure about it.
Signed-off-by: Zhansong Gao <zhsgao@hotmail.com>
Signed-off-by: Zhansong Gao <zhsgao@hotmail.com>
dparmar18
left a comment
There was a problem hiding this comment.
just some minor touchups in test case file, else LGTM
|
Test ran successfully with this change - https://pulpito.ceph.com/vshankar-2023-02-24_02:11:45-fs-wip-vshankar-testing-20230222.025426-testing-default-smithi/ Failures are not related to this PR. |
|
jenkins retest this please |
|
jenkins test make check |
|
jenkins test make check arm64 |
* refs/pull/49756/head: qa: add test for 'dump dir' mds: add a command to dump directory information Reviewed-by: Dhairya Parmar <dparmar@redhat.com> Reviewed-by: Kotresh Hiremath Ravishankar <khiremat@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Reviewed-by: Rishabh Dave <ridave@redhat.com>
|
@vshankar @zhsgao It looks like a very useful command, but it seems like there are no plans to backport it? Right now even reef misses it. Do you think it would be a good idea to create backport tickets (and PRs) for it? I could do it. I would like to have backports down to pacific unless it relies on a new functionality. |
Sure thing - please do the needful @trociny. I think we should also address https://github.com/ceph/ceph/pull/49756/files#r1120348923 and then backport both changes. I'll create a tracker. |
Signed-off-by: Zhansong Gao zhsgao@hotmail.com
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows