Skip to content

ceph-objectstore-tool: update clear-snapset command doc - #65099

Merged
Naveenaidu merged 2 commits into
ceph:mainfrom
Naveenaidu:wip-naveen-bz-2251015-docs-clear-snapset
Nov 13, 2025
Merged

Naveenaidu merged 2 commits into
ceph:mainfrom
Naveenaidu:wip-naveen-bz-2251015-docs-clear-snapset

Conversation

@Naveenaidu

@Naveenaidu Naveenaidu commented Aug 18, 2025 •

Copy link
Copy Markdown
Contributor

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2251015
Closes: https://tracker.ceph.com/issues/78807

The ceph-objectstore-tool --help is now updated to the following:

Allowed options:                                                   
  --help                      produce help message
  --type arg                  Arg is one of [bluestore (default), memstore]

....

Positional syntax:                                                                                                                     
                                                                                                                                       
ceph-objectstore-tool ... <object> (get|set)-bytes [file]                                                                                                                                             
....                                                           
ceph-objectstore-tool ... <object> clear-snapset [(corrupt|seq|snaps|clones|clone_size|clone_overlap|size)]  <--- Newly added option

<object> can be a JSON object description as displayed                                                                                 
by --op list.                                                                                                                          
<object> can be an object name which will be looked up in all                                                                          
the OSD's PGs.                                                     
<object> can be the empty string ('') which with a provided pgid 
specifies the pgmeta object                                                                                                            
                                                                                                                                       
The optional [file] argument will read stdin or write stdout                                                                           
if not specified or if '-' specified.                                                                                                  
                                                                                                                                       
clear-snapset options:      <---- Newly added section                                       
  clear-snapset               : by default, clear clones, clone_size and clone_overlap
  clear-snapset corrupt       : clear entire snapset                                                                                   
  clear-snapset seq           : clear snapset.seq                                                                                      
  clear-snapset clone_size    : clear clone_size                   
  clear-snapset clone_overlap : clear clone_overlap                                                                                    
  clear-snapset clones        : clear clones                                                                                           
  clear-snapset snaps         : clear clone_snaps                                                                                      
  clear-snapset size          : break all clone sizes by adding 1

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. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

@Naveenaidu
Naveenaidu force-pushed the wip-naveen-bz-2251015-docs-clear-snapset branch 2 times, most recently from 9c2ef50 to 28aee43 Compare August 19, 2025 12:39
@Naveenaidu Naveenaidu self-assigned this Aug 28, 2025
@Naveenaidu
Naveenaidu force-pushed the wip-naveen-bz-2251015-docs-clear-snapset branch from 28aee43 to a8ac1ed Compare August 28, 2025 13:08
@Naveenaidu Naveenaidu changed the title (wip): objectstore-tool: update clear-snapset command ceph-objectstore-tool: update clear-snapset command Sep 1, 2025
@Naveenaidu Naveenaidu changed the title ceph-objectstore-tool: update clear-snapset command ceph-objectstore-tool: update clear-snapset command doc Sep 1, 2025
@Naveenaidu
Naveenaidu force-pushed the wip-naveen-bz-2251015-docs-clear-snapset branch from a8ac1ed to 141ae25 Compare September 1, 2025 03:18
@Naveenaidu
Naveenaidu marked this pull request as ready for review September 1, 2025 03:18
@Naveenaidu
Naveenaidu requested a review from a team as a code owner September 1, 2025 03:18
@@ -153,8 +153,6 @@ function create_scenario() {
ceph-objectstore-tool --data-path $dir/${osd} "$JSON" clear-snapset clone_overlap || return 1
JSON="$(ceph-objectstore-tool --data-path $dir/${osd} --head --op list obj11)"
ceph-objectstore-tool --data-path $dir/${osd} "$JSON" clear-snapset clones || return 1
JSON="$(ceph-objectstore-tool --data-path $dir/${osd} --head --op list obj12)"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ronen-fr adding you as a reviewer specifically for this change. The command head was removed during one of the scrub refactors. Was there any reason, the head command was not removed from the test file?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this question to Ronen.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Naveenaidu - what change are you referring to? The "head" option is still there, on line 3671 & 3740. ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ronen-fr I am talking about the subcommand head in corresponding to clear-snapset command. If you look at this function:

int clear_snapset(ObjectStore *store, coll_t coll, ghobject_t &ghobj,

you'll notice that - there is no sub argument head for clear-snapset.

This was the PR which added the clear-snapset command and in this line , we see that clear-snapset command had a sub argument called head associated with it and there are tests associated with it. In the current main we do not have this command.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The ability to corrupt the head was indeed removed some 8 years ago (PR #17579).
(It wasn't a Scrub refactoring exactly, but rather Sage removing the 'snapdir' attribute).
At first glance: that test change was just overlooked. Verifying.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you verify that the standalobne test still works? (I will be checking it now, anyway).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test passes. Good

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you verify that the standalobne test still works? (I will be checking it now, anyway).

I did test the standalone tests and they were passing, apologies for not mentioning that in the description - thanks for checking it again though :)

// UNDOCUMENTED: For testing zap SnapSet
// IGNORE extra args since not in usage anyway
if (!ghobj.hobj.has_snapset()) {
if (vm.count("arg1") == 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more than just documenting; the commit brings these validators as well.
Nothing wrong them them, this nit-picking is just about the commit's title.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, fixed it

@@ -153,8 +153,6 @@ function create_scenario() {
ceph-objectstore-tool --data-path $dir/${osd} "$JSON" clear-snapset clone_overlap || return 1
JSON="$(ceph-objectstore-tool --data-path $dir/${osd} --head --op list obj11)"
ceph-objectstore-tool --data-path $dir/${osd} "$JSON" clear-snapset clones || return 1
JSON="$(ceph-objectstore-tool --data-path $dir/${osd} --head --op list obj12)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this question to Ronen.

@ronen-fr ronen-fr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change in line 4716 seems strange...

Comment thread src/tools/ceph_objectstore_tool.cc Outdated
}

if (vm.count("arg2") != 0) {
if (arg2 != "corrupt" || arg2 != "seq" || arg2 != "snaps" ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'||' ????

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention of this code block is that, if we have a sub argument other than the allowed such as corrupt, seq, snaps etc then we would like to print the usage description.

The actual line is

if (arg2 != "corrupt" || arg2 != "seq" || arg2 != "snaps" || arg2 != "clones" || arg2 != "clone_size" || arg2 != "clone_overlap" || arg2 != "size") {

After formatting with clang, it split them into multiple lines with || operator at the end of line. Is this not a right way to format ? If I am misreading the comment please correct me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My problem is with the logic...
Unless I'm really addled (have not eaten lunch yet), all those '||' should read '&&'...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thankss for catching it! fixed it now

…tion for obj12

clear-snapset, does not have any argument named as "head"

Signed-off-by: Naveen Naidu <[email protected]>
@Naveenaidu
Naveenaidu force-pushed the wip-naveen-bz-2251015-docs-clear-snapset branch from 141ae25 to 68debbf Compare September 19, 2025 04:20
@Naveenaidu
Naveenaidu requested a review from ronen-fr September 19, 2025 04:21

@ronen-fr ronen-fr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@lee-j-sanders

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants