Project

General

Profile

Mds dumpability » History » Version 1

Jessica Mack, 06/07/2015 01:10 AM

1 1 Jessica Mack
h1. Mds   dumpability
2 1 Jessica Mack
3 1 Jessica Mack
h3. Summary
4 1 Jessica Mack
5 1 Jessica Mack
Expand the 'dump' command set so that a running mds can dump more state to a local file or unix domain socket for debugging visibility.
6 1 Jessica Mack
7 1 Jessica Mack
h3. Owners
8 1 Jessica Mack
9 1 Jessica Mack
* Name (Affiliation)
10 1 Jessica Mack
* Name (Affiliation)
11 1 Jessica Mack
* Name
12 1 Jessica Mack
13 1 Jessica Mack
h3. Interested Parties
14 1 Jessica Mack
15 1 Jessica Mack
* Sage Weil (Inktank)
16 1 Jessica Mack
* Name (Affiliation)
17 1 Jessica Mack
* Name
18 1 Jessica Mack
19 1 Jessica Mack
h3. Current Status
20 1 Jessica Mack
21 1 Jessica Mack
A 'dumpcache <filename>' command will dump all inodes, dentries, and dirs to a file using the operator<<() methods.  This is a good start, but only captures what is exposed by those methods--not all structure fields.
22 1 Jessica Mack
All encodable objects (that go to disk or over the wire) include a dump(Formatter*) method that will generate structured json (or xml etc) output for debugging.  The in-memory only structures (like CInode, CDentry, CDir) don't have these (yet).
23 1 Jessica Mack
The admin socket infrastructure lets you query a running daemon from the command line (e.g., 'ceph daemon mds.a <command.') and get the output.  It is fully buffered (entire result is built in memory, then written to the output).
24 1 Jessica Mack
The Formatter class has JSON and XML implementations.  It is fully buffered (entire output is generated in memory, then written to the output socket).
25 1 Jessica Mack
26 1 Jessica Mack
h3. Detailed Description
27 1 Jessica Mack
28 1 Jessica Mack
We should add dump() methods to all important in-memory structures, including:
29 1 Jessica Mack
* CInode
30 1 Jessica Mack
* CDir
31 1 Jessica Mack
* CDentry
32 1 Jessica Mack
* Capability
33 1 Jessica Mack
34 1 Jessica Mack
Any dump should be recursive (i.e., dumping the inode will also dump the capabilities).  It should not following links, thoguh (dumping a dir shouldn't dump all dentries and inodes.... or should it?)
35 1 Jessica Mack
We shoudl also capture other improtant state, like:
36 1 Jessica Mack
* MDRequest / Mutation
37 1 Jessica Mack
* Session
38 1 Jessica Mack
* LogSegments
39 1 Jessica Mack
40 1 Jessica Mack
Then we wire them up to admin/dev comamnds to dump cache and other in-memory state.
41 1 Jessica Mack
The final step to make this usable on large clusters is to make the Formatter interface stream based.  Right now it looks like:
42 1 Jessica Mack
* create Formater
43 1 Jessica Mack
* dump to it; class accumulates result in memory
44 1 Jessica Mack
* flush to a bufferlist
45 1 Jessica Mack
* write bufferlist to final destination
46 1 Jessica Mack
47 1 Jessica Mack
Instead, it should be more like
48 1 Jessica Mack
* create Formatter
49 1 Jessica Mack
* specify the sink (bufferlist, fd, something).  maybe make it an ostream, and make bufferlist work with that?
50 1 Jessica Mack
* write to it.
51 1 Jessica Mack
* at the very end call flush() (no arguments!)
52 1 Jessica Mack
 
53 1 Jessica Mack
h3. %{color:gold}Work items%
54 1 Jessica Mack
55 1 Jessica Mack
h3. Coding tasks
56 1 Jessica Mack
57 1 Jessica Mack
# mds: add dump methods to CInode, CDir, CDentry, Capability
58 1 Jessica Mack
# mds: add dump methods to Session, MDRequest, LogSegment
59 1 Jessica Mack
# admin socket dump commands
60 1 Jessica Mack
# tell dump commands (dump to a file)
61 1 Jessica Mack
# Formatter: refactor into a stream-based implementation for better memory efficiency 
62 1 Jessica Mack
# make the admin socket protocol handle a streaming output of unknown length.