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
os/bluestore/bluestore_tool: add log-dump command to dump bluefs's log #18535
Conversation
src/os/bluestore/bluestore_tool.cc
Outdated
log_file->fnode = super.log_fnode; | ||
cout << __func__ << " log_fnode " << super.log_fnode << std::endl; | ||
|
||
BlueFS::FileReader *log_reader = new BlueFS::FileReader( |
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.
Can we try to reuse BlueFS::_replay(bool noop)
instead of duplicating it here? Otherwise it is going to be very fragile..
@xiexingguo The implementation is improved followed your suggestion. |
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
In general this looks good, just one concern though. Function BlueFS::_replay() called from mount() one will dump the log to ostream irrespective of the configured debug level. Hence delaying the mount and wasting (temporary) the RAM. May be it makes sense to add some checks to bypass that useless dumping when unneeded. |
You are right. When log file is very large, it will be a problem. |
dump it only when it is not replayed? And how about, write to a file, instead of std::out? If the file ref is present, then write to that file, else follow the dout(), which is needed for any debugging. |
@varadakari When to_stdout is true, dump to std out, else keep the original logic. |
@yanghonggang dump to stdout only noop is false? that means no replay is in progress? |
noop is used to control whether to replay the log(true means no). our tool only dump log's content, we should not replay the log. |
@yanghonggang what i mean write to std::out only when noop == false and std_out == true. |
What's the benefit of doing that? |
@ifed01 @xiexingguo Please help to review |
src/os/bluestore/bluestore_tool.cc
Outdated
@@ -525,6 +553,8 @@ int main(int argc, char **argv) | |||
} | |||
fs->umount(); | |||
delete fs; | |||
} else if (action == "log-dump") { |
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.
bluefs-log-dump? since other bluefs stuff is prefixed.
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.
ok
src/os/bluestore/BlueFS.cc
Outdated
<< ": " << t << std::endl; | ||
} else { | ||
dout(10) << __func__ << " 0x" << std::hex << pos << std::dec | ||
<< ": " << t << dendl; |
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 leave the dout unconditional so it's just if (to_stdout) std::cout << ...
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.
ok
…fs's log ./bin/ceph-bluestore-tool --command bluefs-log-dump --path dev/osd0/ ... 0x1000: txn(seq 2 len 0xd7 crc 0x306e389b) 0x1000: op_dir_create db 0x1000: op_dir_create db.wal 0x1000: op_dir_create db.slow 0x1000: op_file_update file Signed-off-by: Yang Honggang <joseph.yang@xtaotech.com>
./bin/ceph-bluestore-tool --command bluefs-log-dump --path dev/osd0/
...
log_dump log_fnode file(ino 1 size 0x1000 mtime 0.000000 bdev 0 extents [0:0x100000+400000])
log_dump 0x0: txn(seq 1 len 0x37 crc 0x3d91dc32)
log_dump 0x0: op_init
log_dump 0x0: op_alloc_add 0:0x1000~3e7ff000
...
Signed-off-by: Yang Honggang joseph.yang@xtaotech.com