]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/cephfs/first-damage: always use bytes representation of omap key
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 11 May 2023 16:19:27 +0000 (12:19 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 7 Jun 2023 01:39:42 +0000 (21:39 -0400)
We cannot assume the encoding of a file name and we don't need it.

Fixes: https://tracker.ceph.com/issues/59716
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/tools/cephfs/first-damage.py

index b7660f590f098f3950cd951c32c374bc1244d893..0479dc8cb2a6c4e3a8e286df54b36e227f4fa547 100644 (file)
@@ -78,15 +78,15 @@ def traverse(MEMO, ioctx):
         with rados.ReadOpCtx() as rctx:
             nkey = None
             while True:
-                it = ioctx.get_omap_vals(rctx, nkey, None, 100)[0]
+                it = ioctx.get_omap_vals(rctx, nkey, None, 100, omap_key_type=bytes)[0]
                 ioctx.operate_read_op(rctx, o.key)
                 nkey = None
                 for (dnk, val) in it:
-                    log.debug('\t%s: val size %d', dnk, len(val))
+                    log.debug(f'\t{dnk}: val size {len(val)}')
                     (first,) = struct.unpack('<I', val[:4])
                     if first > NEXT_SNAP:
                         log.warning(f"found {o.key}:{dnk} first (0x{first:x}) > NEXT_SNAP (0x{NEXT_SNAP:x})")
-                        if REPAIR_NOSNAP and dnk.endswith("_head") and first == CEPH_NOSNAP:
+                        if REPAIR_NOSNAP and dnk.endswith(b"_head") and first == CEPH_NOSNAP:
                             log.warning(f"repairing first==CEPH_NOSNAP damage, setting to NEXT_SNAP (0x{NEXT_SNAP:x})")
                             first = NEXT_SNAP
                             nval = bytearray(val)