Skip to content

Instantly share code, notes, and snippets.

@Matan-B
Last active August 17, 2023 07:52
Show Gist options
  • Save Matan-B/4e491582f250c09a5facb866b542d431 to your computer and use it in GitHub Desktop.
Save Matan-B/4e491582f250c09a5facb866b542d431 to your computer and use it in GitHub Desktop.
Simplified version: 1 OSD, 1 pg, 1 object.

Create pool (single pg, no autoscale):

ceph osd pool create <pool_id> 1 1 --autoscale-mode=off

Put an object:

rados -p <pool_id> put objectone <obj_1>

Make a snapshot:

rados -p <pool_id> mksnap <snap_name>

Re-put the object (create clone object):

rados -p <pool_id> put objectone <obj_2>

Sleep 5 (let the changes take place)

A clone object is now created (See rados df) and a correspoding SnapMapper entry in the db.

Stop the OSD.

Find the relevant entry keys (with the URL encoded prefix):

ceph-kvstore-tool bluestore-kv <store path> list p |  grep SNA_

Store the value in any place (Use the entire key, with the URL prefix included):

ceph-kvstore-tool bluestore-kv <store path> get p <key-listed-in-previous-command> out <val-path>

Remove the entry:

ceph-kvstore-tool bluestore-kv <store path> rm  p <key-listed-in-previous-command>

Note:

  
The <key-listed-in-previous-command> was in the following strucure:
  
<MAPPING_PREFIX><pool>_<snapid>_<shardid>_<hobject_t::to_str()>
Example: SNA_4_0000000000000001_0000000000000004.ECF34CE6.1.objectone..

The malformed strucure is:

<LEGACY_MAPPING_PREFIX><snapid>_
Example: SNA_4_0000000000000001_
 
In the next step use the same key listed and truncate it (as in the example).
  

Insert the corrupted key with the value stored:

ceph-kvstore-tool bluestore-kv <store path> set p <corrupted-key> <val-path>

Verify the the corrupted key is insterted:

ceph-kvstore-tool bluestore-kv <store path> list p | grep SNA_

Restart the cluster.

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