From: Patrick Donnelly Date: Thu, 11 May 2023 16:19:27 +0000 (-0400) Subject: tools/cephfs/first-damage: always use bytes representation of omap key X-Git-Tag: v19.0.0~989^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=56219bea697519ec96d7eed230c88648bf005cff;p=ceph.git tools/cephfs/first-damage: always use bytes representation of omap key 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 --- diff --git a/src/tools/cephfs/first-damage.py b/src/tools/cephfs/first-damage.py index b7660f590f0..0479dc8cb2a 100644 --- a/src/tools/cephfs/first-damage.py +++ b/src/tools/cephfs/first-damage.py @@ -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(' 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)