cls/cmpomap: empty values are 0 in U64 comparisons#42740
Conversation
|
tested with a two-zone configuration with mstart.sh. instead of testing a real upgrade, i manually injected an omap key with:
without this fix, with this fix, this injected key is removed successfully and |
|
the code generic and may be used in other contexts. having |
previously, when trying to use cmpomap interfaces on an omap key with an empty value, U64 comparisons would fail to decode with -EIO. so cmp_set_vals() and cmp_rm_keys() are unable to update or remove such keys for backward-compatibility with rgw's data sync error repo, where the keys used to have empty values, enable these comparisons by treating an empty value as 0 Fixes: https://tracker.ceph.com/issues/52128 Signed-off-by: Casey Bodley <cbodley@redhat.com>
both if (r == -EIO) {
r = 0; // treat EIO as a failed comparison
}backward compat with multisite's error repo was a requirement for this feature, but i lost sight of it as we iterated on the design i updated the client API comments to clarify this new behavior. does that work @yuvalif? |
Is there other risk of breaking compatibility with other users? Having an explicit argument to control the changed semantics could maybe be an option? Matt |
no, the multisite error repo is the only user
it could, but i'm not sure it's worth expanding the interfaces for it. these interfaces support both U64 and String comparisons, but this change in behavior is specific to U64. the string comparisons already work as expected against empty omap values (empty strings compare less than non-empty strings), so this is essentially changing the behavior of U64 comparisons against empty values to match |
if we're the only consumer so far, I agree, it's not needed |
previously, when trying to use cmpomap interfaces on an omap key with an empty value, U64 comparisons would fail to decode with -EIO. so cmp_set_vals() and cmp_rm_keys() are unable to update or remove such keys
for backward-compatibility with rgw's data sync error repo, where the keys used to have empty values, enable these comparisons by treating an empty value as 0
Fixes: https://tracker.ceph.com/issues/52128
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume tox