rbd: retry lock owner listing with resized buffer#1279
Conversation
anoopcs9
left a comment
There was a problem hiding this comment.
I have a minor comment, otherwise lgtm.
| return retry.Size(int(maxLockOwners)).If(err == errRange) | ||
| }) | ||
| if err != nil { | ||
| if err == ErrNotExist { |
There was a problem hiding this comment.
getError(-C.ENOENT) always returns ErrNotFound, so after getErrorIfNegative(), the error value will be ErrNotFound. The comparison err == ErrNotExist works only because ErrNotExist is itself initialized via getError(-C.ENOENT), making them the same pointer.
I wonder if we should use ErrNotFound instead, but at the same time it is confusing because the naming is unfortunate; it says "RBD image notfound", which is semantically wrong for lock owners. @phlogistonjohn wdyt?
There was a problem hiding this comment.
For wrapper APIs, I generally prefer consistency with the underlying C API. So if a C api returns -EFOO we should return ErrFoo. Does that help?
|
Hi, thanks a bunch for the contribution. In these days of agents and stuff we're trying to be a bit more cautious with checking for certain things and that includes the "DCO" - your signed off by line. The Signed-off-by should contain should contain your real name. |
ee5ced1 to
2d7c263
Compare
|
Thanks for the review! I updated to compare against ErrNotFound directly, and signed off the commit with my real name. |
@hsjsstn I see another |
Signed-off-by: Soojin Han <sjhan034@naver.com>
2d7c263 to
a106f41
Compare
Sorry, I forgot to remove that earlier. Fixed now! |
anoopcs9
left a comment
There was a problem hiding this comment.
On a second thought, I think even ErrNotFound is also misleading as it says "RBD image not found: . .". I wish we didn't have that early catch for ENOENT in getError() from rbd/errors.go. May be we switch to checking ret instead of err as before?
Otherwise lgtm.
@phlogistonjohn Any further thoughts?
Can you elaborate on that a bit? I'm not entirely sure what your concern is... I am probably bouncing between to many projects lately to think deeply about it. |
Here's how the errors are defined in rbd/errors.go: and getError() has an early return for Now the very first version of the change compared against |
Update lock owner listing retry behavior:
retry.WithSizesinLockGetOwnersrbd_lock_get_ownersreturnsERANGEENOENTbehaviorNo new test was added because reproducing this path requires librbd to return
ERANGEfromrbd_lock_get_owners,which depends on having more lock owners than the initial buffer size.
This is not a new API, so
ceph_previewandmake api-updatedo not apply.fixes #1269
Checklist
//go:build ceph_previewmake api-updateto record new APIsNew or infrequent contributors may want to review the go-ceph Developer's Guide including the section on how we track API Status and the API Stability Plan.
The go-ceph project uses mergify. View the mergify command guide for information on how to interact with mergify. Add a comment with
@Mergifyiorebaseto rebase your PR when github indicates that the PR is out of date with the base branch.