Fix compatibility issue where coll_t::_str retained stale values after
decoding v1/v2 format blobs, causing confusing debug output and tool
messages.
The _str field was not recalculated when decoding older formats:
- v1 format (pre-Ceph v0.21, before commit
a108774e)
- v2 format (meta/regular PGs)
- v3 format always includes _str (temp PGs)
This primarily affected debugging scenarios since _str is only used for
log messages and BlueStore low-level tool output. The issue went
undetected because existing tests reused struct instances, preserving
field values across encode/decode cycles.
An upcoming test change will allocate fresh instances for each decode,
which would expose these stale values. Since _str can be derived from
always-encoded fields, recalculate it during decode() when missing
from the encoded data.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
type = TYPE_PG;
}
removal_seq = 0;
+ // recalculate _str, which is not encoded by v1
+ calc_str();
}
break;
decode(snap, bl);
type = (type_t)_type;
removal_seq = 0;
+ // recalculate _str, which is not encoded by v2
+ calc_str();
}
break;