Bug 2211477

Summary: cephfs-journal-tool --rank with all option in confusing
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Amarnath <amk>
Component: CephFSAssignee: Manish Yathnalli <myathnal>
Status: ASSIGNED --- QA Contact: Amarnath <amk>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.1CC: ceph-eng-bugs, cephqe-warriors, gfarnum, vshankar
Target Milestone: ---   
Target Release: 6.1z2   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Amarnath 2023-05-31 18:05:07 UTC
Description of problem:
cephfs-journal-tool --rank with all option not working

[root@ceph-amk-fs-tools-e05s2e-node7 ~]# cephfs-journal-tool --rank all journal export backup.bin
Error ((22) Invalid argument)
2023-05-31T13:57:37.356-0400 7faec14effc0 -1 main: Couldn't determine MDS rank.

if we pass --rank cephfs:0 it is creating backup.bin
[root@ceph-amk-fs-tools-e05s2e-node7 ~]# cephfs-journal-tool --rank cephfs:0 journal export backup.bin
journal is 157699724~236619391
wrote 236619391 bytes at offset 157699724 to backup.bin
NOTE: this is a _sparse_ file; you can
	$ tar cSzf backup.bin.tgz backup.bin
      to efficiently compress it while preserving sparseness.

[root@ceph-amk-fs-tools-e05s2e-node7 ~]# ls -lrt
total 231088
-rw-r--r--. 1 root root      2412 Jul 24  2015 run.sh
-rw-r--r--. 1 root root 394319115 May 31 13:55 backup.bin

Help Command Options

[root@ceph-amk-fs-tools-e05s2e-node7 opt]# cephfs-journal-tool -h
Usage: 
  cephfs-journal-tool [options] journal <command>
    <command>:
      inspect
      import <path> [--force]
      export <path>
      reset [--force]
  cephfs-journal-tool [options] header <get|set> <field> <value>
    <field>: [trimmed_pos|expire_pos|write_pos|pool_id]
  cephfs-journal-tool [options] event <effect> <selector> <output> [special options]
    <selector>:
      --range=<start>..<end>
      --path=<substring>
      --inode=<integer>
      --type=<UPDATE|OPEN|SESSION...><
      --frag=<ino>.<frag> [--dname=<dentry string>]
      --client=<session id integer>
    <effect>: [get|recover_dentries|splice]
    <output>: [summary|list|binary|json] [--path <path>]

General options:
  --rank=filesystem:mds-rank|all Journal rank (mandatory)
  --journal=<mdlog|purge_queue>  Journal type (purge_queue means
                                 this journal is used to queue for purge operation,
                                 default is mdlog, and only mdlog support event mode)

Special options
  --alternate-pool <name>     Alternative metadata pool to target
                              when using recover_dentries.
  --conf/-c FILE    read configuration from the given configuration file
  --id ID           set ID portion of my name
  --name/-n TYPE.ID set name
  --cluster NAME    set cluster name (default: ceph)
  --setuser USER    set uid to user or uid (and gid to user's gid)
  --setgroup GROUP  set gid to group or gid
  --version         show version and quit



Version-Release number of selected component (if applicable):

[root@ceph-amk-fs-tools-e05s2e-node7 ~]# ceph versions
{
    "mon": {
        "ceph version 17.2.6-70.el9cp (fe62dcdbb2c6e05782a3e2b67d025b84ff5047cc) quincy (stable)": 3
    },
    "mgr": {
        "ceph version 17.2.6-70.el9cp (fe62dcdbb2c6e05782a3e2b67d025b84ff5047cc) quincy (stable)": 2
    },
    "osd": {
        "ceph version 17.2.6-70.el9cp (fe62dcdbb2c6e05782a3e2b67d025b84ff5047cc) quincy (stable)": 12
    },
    "mds": {
        "ceph version 17.2.6-70.el9cp (fe62dcdbb2c6e05782a3e2b67d025b84ff5047cc) quincy (stable)": 3
    },
    "overall": {
        "ceph version 17.2.6-70.el9cp (fe62dcdbb2c6e05782a3e2b67d025b84ff5047cc) quincy (stable)": 20
    }
}


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Greg Farnum 2023-06-01 15:28:54 UTC
(In reply to Amarnath from comment #0)
>   --rank=filesystem:mds-rank|all Journal rank (mandatory)

Did you try with "--rank=all" instead of "--rank all"?

Comment 2 Amarnath 2023-06-04 18:34:06 UTC
Hi Greg, 

I have tried --rank=all it still shows invalid argument

[root@ceph-amk-test-2mpl4e-node9 ~]# cephfs-journal-tool --rank cephfs:0 journal export backup.bin
journal is 4194304~51521245
wrote 51521245 bytes at offset 4194304 to backup.bin
NOTE: this is a _sparse_ file; you can
	$ tar cSzf backup.bin.tgz backup.bin
      to efficiently compress it while preserving sparseness.
[root@ceph-amk-test-2mpl4e-node9 ~]# cephfs-journal-tool --rank=all journal export backup.bin
Error (2023-06-04T14:30:07.033-0400 7f9b66d3ff00 -1 main: Couldn't determine MDS rank.
(22) Invalid argument)
[root@ceph-amk-test-2mpl4e-node9 ~]# ls -lrt
total 50320
-rw-r--r--. 1 root root 55715549 Jun  4 14:29 backup.bin
[root@ceph-amk-test-2mpl4e-node9 ~]# 

Regards,
Amarnath

Comment 3 Greg Farnum 2023-06-06 14:44:10 UTC
Okay, I briefly looked at the code and git history here and I'm confused about how "all" is an option that the parsing system can handle, so leaving this for when Venky gets back to sort out.

Comment 8 Amarnath 2023-06-21 04:39:38 UTC
Hi Venky,

The below command works fine and collects the bin with rank in the postfix of the file name

[root@ceph-amk-enable-mds-hd0cgh-node7 ~]# cephfs-journal-tool --rank cephfs:all journal export backup.bin
journal is 4194304~43882
wrote 43882 bytes at offset 4194304 to backup.bin.0
NOTE: this is a _sparse_ file; you can
	$ tar cSzf backup.bin.0.tgz backup.bin.0
      to efficiently compress it while preserving sparseness.
journal is 4194304~4628
wrote 4628 bytes at offset 4194304 to backup.bin.1
NOTE: this is a _sparse_ file; you can
	$ tar cSzf backup.bin.1.tgz backup.bin.1
      to efficiently compress it while preserving sparseness.
[root@ceph-amk-enable-mds-hd0cgh-node7 ~]# ls -lrt
total 60
-rw-r--r--. 1 root root 4238186 Jun 21 00:34 backup.bin.0
-rw-r--r--. 1 root root 4198932 Jun 21 00:34 backup.bin.1
[root@ceph-amk-enable-mds-hd0cgh-node7 ~]# 

As Greg Mentioned,--rank=filesystem:{mds-rank|all} Will be helpful if it is updated in help option

Hi Venky,
Should we track above change in this bug or should i create other bug.

Regards,
Amaranth