Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSD class method execution #989

Merged
merged 1 commit into from
Jun 19, 2024
Merged

OSD class method execution #989

merged 1 commit into from
Jun 19, 2024

Conversation

vslpsl
Copy link

@vslpsl vslpsl commented May 28, 2024

Added rados_read_op_exec & rados_write_op_exec go-wrappers.

Fixed: #307
Fixed: #305

Added CephBufferList structure to manage c++ allocated memory.

@anoopcs9
Copy link
Collaborator

Let me add some initial comments:

  • New APIs are expected in separate source file with corresponding dedicated test file.
    • You can have both ReadOp.Exec() and WriteOp.Exec() in a new file called rw_op_exec.go.
  • All new APIs are introduced as preview APIs indicated with the help of build tags.
    • Add //go:build ceph_preview at the very beginning of every source file.
  • Run make api-update once you are done with the changes.

Copy link
Collaborator

@anoopcs9 anoopcs9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure but can we consider combining exec_step_op.go and ceph_buffer_list.go?

@phlogistonjohn
Copy link
Collaborator

Regarding the API stuff @anoopcs9 mentioned, it's documented here: https://github.com/ceph/go-ceph/blob/master/docs/development.md#api-status

@phlogistonjohn
Copy link
Collaborator

cc @ansiwen especially WRT the new bufferlist structure

@phlogistonjohn
Copy link
Collaborator

.... and thank you very much for looking into adding these apis!

rados/ceph_buffer_list.go Outdated Show resolved Hide resolved
@ansiwen
Copy link
Collaborator

ansiwen commented May 30, 2024

cc @ansiwen especially WRT the new bufferlist structure

I'm on PTO until June 6, I can only have a look afterwards. But don't hesitate to merge it before. I can still propose a fixup, if I don't like something.

@phlogistonjohn
Copy link
Collaborator

phlogistonjohn commented May 30, 2024

Thanks @ansiwen for the update. We'll see how it goes.

A couple of thoughts on the helper type:

  • Uppercased types and functions that are part of files in the 'rados' package would become part of the public api. So that would include: NewCephBufferList, CephBufferList.Bytes
  • A new public API should be made preview first
  • The public ReadOp.Exec returns a CephBufferList. Making CephBufferList a mandatory part of the public API
  • Items in the 'internal' APIs are only for APIs that are genuinely "internal" to go-ceph and can not be exposed to the public API
  • I'm not sure if the CephBufferList is strictly needed. It has one method Bytes, that returns a bytes slice
  • What would be the downsides of calling .Bytes() within Exec and returning []byte from Exec?

Let me know if I have misunderstood, or misread, anything in the above - if there's value to the new type please share what the advantage is. Otherwise it may be better to return a native Go type. Note that you can still use the type (renamed to lowercase) as an implementation detail if you wish, in this case.

@phlogistonjohn
Copy link
Collaborator

I should have looked closer at the test. This is part of the 'Op' infrasctructure that is a "batch" operations API. You don't have real bytes to return yet -- the buffer class is a bit of a "promise" rather than a simple "buffer". Let me think if I can come up with a better suggestion.

@phlogistonjohn
Copy link
Collaborator

After refreshing my memory wrt the existing APIs, I think you can mimic what was done for the read api:
937f8d8#diff-36918497c2d2778500619bb54b103c8fb67d60563f22f88b719afc675bf68a4dR61

Converge CephBufferList with the exec step to something like ReadOpExecStep and it will become something similar to what we already have for Read. Does that make sense? Let me know if you have questions about this idea.

@phlogistonjohn
Copy link
Collaborator

@Mergifyio rebase

Copy link

mergify bot commented Jun 5, 2024

rebase

❌ Pull request can't be updated with latest base branch changes

Mergify needs the author permission to update the base branch of the pull request.
@odarix needs to authorize modification on its head branch.

@vslpsl
Copy link
Author

vslpsl commented Jun 6, 2024

Rebased & applied changes proposed by @phlogistonjohn

Copy link
Collaborator

@phlogistonjohn phlogistonjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking quite good now. When I start nitpicking the doc comments you know you're generally on the right track ;-)
I have one small but substantial comment on the Bytes method as I want to ensure it does something sensible if it is (incorrectly) called before Operate.

rados/read_op_exec.go Outdated Show resolved Hide resolved
rados/read_op_exec.go Outdated Show resolved Hide resolved
rados/read_op_exec.go Outdated Show resolved Hide resolved
rados/read_op_exec.go Outdated Show resolved Hide resolved
rados/write_op_exec.go Outdated Show resolved Hide resolved
@phlogistonjohn phlogistonjohn added the API This PR includes a change to the public API of a go-ceph package label Jun 6, 2024
@phlogistonjohn
Copy link
Collaborator

Thanks for continuing to work on this. The code looks pretty good to me now. I think the only things remaining are "organizational".

First, I think the JSON generated from the api update make commands is out of date with the actual doc comments in the code. The simplest thing might be simply to delete the current changes and regenerate the JSON changes from scratch.

Related to the git commit history: We prefer a linear history and as such, do not want intermediate commits in the final history. If you are comfortable doing it, could you please squash all the commits on this PR into a single commit. While doing that, please add a Signed-off-by trailer (see also) with the -s option.

If you don't feel comfortable doing this on your own feel free to ask us for steps or direct assistance...

@phlogistonjohn
Copy link
Collaborator

Also, please rebase or configure mergify so that we can trigger rebases using mergify (see #989 (comment) ).

rados/read_op_exec.go Show resolved Hide resolved
@anoopcs9 anoopcs9 dismissed their stale review June 14, 2024 17:33

Initial review comments are no longer valid with latest version of the change.

@vslpsl
Copy link
Author

vslpsl commented Jun 17, 2024

I did rebase & squash & fixed api json.

Signed-off-by: Vladimir Kavlakan <vkavlakan@gmail.com>
@vslpsl
Copy link
Author

vslpsl commented Jun 17, 2024

@phlogistonjohn please review changes

@phlogistonjohn
Copy link
Collaborator

Signed off by and commit message look ok to me on first glance. I'll enable the test run and try and re-review in the next couple of hours.

Copy link
Collaborator

@phlogistonjohn phlogistonjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks so much for working with us on this.

@phlogistonjohn
Copy link
Collaborator

@anoopcs9 and/or @ansiwen - 2nd review please.

Copy link
Collaborator

@anoopcs9 anoopcs9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks.

@mergify mergify bot merged commit 0fc95cf into ceph:master Jun 19, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API This PR includes a change to the public API of a go-ceph package
Projects
None yet
4 participants