Conversation
phlogistonjohn
left a comment
There was a problem hiding this comment.
Thank you very much for your contribution! I have a few comments below. Overall, it looks like a nice improvement.
rados/rados_test.go
Outdated
| "empty": []byte(""), | ||
| "key1": []byte("value1"), | ||
| "key2": []byte("value2"), | ||
| "prefixed\x00key3": []byte("value3"), |
There was a problem hiding this comment.
I'd prefer to see the new key in addition to the existing key, thanks.
rados/ioctx.go
Outdated
| ret := C.rados_nobjects_list_open(ioctx.ioctx, &ctx) | ||
| if ret < 0 { | ||
| return getError(ret) | ||
| page_results := C.size_t(1000) |
There was a problem hiding this comment.
Since this is a "magic" value. Let's make it a const at the file level. Name it something like defaultListObjectsResultSize.
rados/ioctx.go
Outdated
|
|
||
| next := C.rados_object_list_begin(ioctx.ioctx) | ||
| if next == nil { | ||
| return errors.New("Pool does not exist") |
There was a problem hiding this comment.
It might be better to return ErrNotFound here.
rados/ioctx.go
Outdated
| listFn(C.GoStringN(item.oid, (C.int)(item.oid_length))) | ||
| } | ||
|
|
||
| if ret := C.rados_object_list_is_end(ioctx.ioctx, next); int(ret) == 1 { |
There was a problem hiding this comment.
Again, it would make things clearer to have the "magic" value 1 as a real constant such as const listEndSentinel = C.int(1). Also, since ret isn't used elsewhere again there's no need to assign ret, just do:
if C.rados_object_list_is_end(...) == listEndSentinel {
...
}
|
Regarding the tests, are there no functions in go-ceph that currently allow you to create the object name with a null? I'm not clear what a "CLS function" is. |
|
re testing: Sorry, I'm probably not using the correct terminology, I meant an OSD class method (https://docs.ceph.com/en/latest/rados/api/librados/#c.rados_exec). From the librados documentation, I don't see how to specify an oid with a length, so that it can include a null character. I had assumed that this was only possible using some osd class method, but maybe I'm missing something. |
248aea0 to
85abd74
Compare
OK, thanks. I was vaguely aware of that method but don't know much about it.
I just skimmed the list of function definitions and I agree, there's nothing obvious there to create a name with a null. Obviously, it must be possible since you're seeing them. However, it may be done at a layer "below" librados and therefore difficult to access via go-ceph.
Maybe, if you research it and find it is possible that way, I'd certainly be open to having something like rados_write_op_exec and/or rados_exec to the library. I am somewhat concerned that it may not do what you want as the inline docs say "The OSD has a plugin mechanism for performing complicated Another approach you might take is to ask the RGW developers how it was done (regardless of if it was indented). Finally, while I'd like to have regression tests for everything, I'd be fine not having coverage for this case and still taking these patches. The existing test will cover the common use case. So don't worry about the patches being declined just for the lack of a test for the "extra nulls" case. |
phlogistonjohn
left a comment
There was a problem hiding this comment.
It looks like you may have overlooked make check failing when you updated the patches based on my earlier feedback. New code should have typical golang naming standards (no underscores).
Additionally, there's still a "bare 1" rather than a listEndSentinel. Since this is a suggestion, not a requirement, feel free to say if you don't want to do that. At the moment though, I don't know if you forgot or chose not to do that.
I'll fix up the formatting, and that was an oversight on my part, so I'll replace with a non-magic value, thanks for the review! I should be able to push an updated branch this evening. |
85abd74 to
e80ca00
Compare
|
It looks like there a test failure when iterating over an omap with a iteratorSize of 1. Going to play around with the new null char key to see if that ordering makes a difference and debug from there. @phlogistonjohn Do you think it would be valuable to have a make command that ran tests in a docker container with a given ceph version's packages installed? |
Sounds reasonable.
I'm not sure what you mean by "a given ceph version's packages installed". If you just mean trying out different major version of ceph you should already be able to do that. Some examples: Everything the CI does should be doable on one's desktop/laptop. You can narrow down the scope of what's being tested too. To run only a particular sub-package of go-ceph use You can even make custom containers to use, but doing so is not direct or easy. If I'm misunderstanding your request, please feel free to correct me. |
|
Ah nope, that's exactly what I was asking about, thanks! I hadn't looked at the existing Makefile closely enough. |
|
There's https://github.com/ceph/go-ceph/blob/master/docs/development.md#testing too. but I forgot to link to it earlier. Also don't hesitate to file issues if the above docs are wrong/incomplete or you simply want to request that we document something! |
e80ca00 to
a5e72a0
Compare
|
Looks like the test failure is just a limitation of librados - |
a5e72a0 to
fb7a38f
Compare
|
This should be ready for CI again. |
|
👋 The test failure for Pacific looks unrelated to these commit. Let me know if there's any other changes I should make, and thanks for looking! |
phlogistonjohn
left a comment
There was a problem hiding this comment.
Looks good to me. Just because it's a bit of a subtle bunch of changes I would like a 2nd reviewer to look at it. That's the only reason for the dnm label at this time.
@ansiwen PTAL and remove the 'do-not-merge' label if you approve. Thanks!
ansiwen
left a comment
There was a problem hiding this comment.
Well, I don't like the rados_object_list API, but that's not the faut of this PR. ;-) (Why you have use a finish cursor, if you anyway have to check for the end of the list with ..._is_end? 🙄 )
|
@Mergifyio rebase |
The previous `rados_nobjects_list_open` used for listing could not return oids that included null characters. Although this isn't a common case, having go-ceph able to list such objects is useful for bugs such as https://tracker.ceph.com/issues/48874. Signed-off-by: Nick Janus <github@nondesignated.com>
Previous changes added support for operating on omap keys that include null characters (e.g. rados_omap_get_next2, rados_write_op_omap_rm_keys2). This change adds some basic test coverage those operations' null character support. Signed-off-by: Nick Janus <github@nondesignated.com>
✅ Branch has been successfully rebased |
|
@Mergifyio requeue |
❌ This pull request head commit has not been previously disembarked from queue. |
|
Thanks, folks! |
👋 We've been using a patch that's similar to this in production for a while now, which has helped with our internal tooling to clean up broken MPUs created by RGW. Ideas welcome on how I could go about testing the changes to ListObjects. I don't know of a way to create an object with a null char in the key short of getting a new CLS function committed.
Checklist