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

add atomic reference tracker #2893

Merged
merged 2 commits into from
Mar 27, 2022
Merged

add atomic reference tracker #2893

merged 2 commits into from
Mar 27, 2022

Conversation

gman0
Copy link
Contributor

@gman0 gman0 commented Feb 21, 2022

Describe what this PR does

RT, reference tracker, is key-based implementation of a reference counter.
Unlike an integer-based counter, RT counts references by tracking unique
keys. This allows accounting in situations where idempotency must be
preserved. It guarantees there will be no duplicit increments or decrements
of the counter.

It is directly needed by the snapshot-backed shallow volumes for CephFS, but is general enough for any other use-cases that need accounting.

Includes unit tests. They use "fake RADOS" interface, but I have run them under real Ceph locally too, and everything worked as expected.

Related issues

Part of #2142

Future concerns

The RADOS objects handled by this RT are versioned. Should the object layout ever need to change / some backwards-incompatible implementation change, it should be possible to safely do so.


Show available bot commands

These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:

  • /retest ci/centos/<job-name>: retest the <job-name> after unrelated
    failure (please report the failure too!)
  • /retest all: run this in case the CentOS CI failed to start/report any test
    progress or results

@gman0
Copy link
Contributor Author

gman0 commented Feb 21, 2022

Please see a somewhat concrete example of how this would be used here #2142 (comment).

@gman0 gman0 requested a review from a team February 21, 2022 19:36
@mergify
Copy link
Contributor

mergify bot commented Feb 22, 2022

This pull request now has conflicts with the target branch. Could you please resolve conflicts and force push the corrected changes? 🙏

Copy link
Collaborator

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

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

Will take a look at it soon.

@@ -46,22 +46,19 @@ endif

GO_PROJECT=github.com/ceph/ceph-csi

CEPH_VERSION ?= $(shell . $(CURDIR)/build.env ; echo $${CEPH_VERSION})
# TODO: ceph_preview tag may be removed with go-ceph 0.16.0
GO_TAGS_LIST ?= $(CEPH_VERSION) ceph_preview
Copy link
Collaborator

Choose a reason for hiding this comment

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

using preview API by default was not accepted see #2633 (comment) we need a stable API as this will be used in production?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's a list of preview go-ceph APIs that this PR relies on:

  • rados.ReadOp.AssertVersion()
  • rados.ReadOp.GetOmapValuesByKeys() and its return value rados.ReadOpOmapGetValsByKeysStep struct
  • rados.ReadOp.Read()
  • rados.WriteOp.AssertVersion()
  • rados.WriteOp.Remove()
  • rados.WriteOp.SetXattr()

These are just bare bindings for librados for functions that are stable -- not really any brand new functionality that would be in a big risk of breaking in following two go-ceph releases (the time needed to graduate an API from preview to stable). Is this not acceptable too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So how do we do this, can anybody please let me know? Can I continue prototyping other parts of #2142 while this is in review, or are you postponing this PR until ceph_preview build tag is no longer needed?

All of these bindings used in this PR are for RADOS primitives, which are very unlikely to change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

am fine with this one as it was not accepted in earlier PR i mentioned it here. @humblec @nixpanic?

Copy link
Collaborator

Choose a reason for hiding this comment

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

fine with me too. 👍

internal/util/rt/errors/errors.go Outdated Show resolved Hide resolved
internal/util/rt/errors/errors.go Outdated Show resolved Hide resolved
internal/util/rt/errors/errors.go Outdated Show resolved Hide resolved
internal/util/rt/radoswrapper/fakerados.go Outdated Show resolved Hide resolved
internal/util/rt/radoswrapper/fakerados.go Outdated Show resolved Hide resolved
internal/util/rt/v1/add.go Outdated Show resolved Hide resolved
@gman0
Copy link
Contributor Author

gman0 commented Mar 9, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.21

@gman0
Copy link
Contributor Author

gman0 commented Mar 9, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.23

2 similar comments
@gman0
Copy link
Contributor Author

gman0 commented Mar 10, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.23

@gman0
Copy link
Contributor Author

gman0 commented Mar 11, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.23

@humblec
Copy link
Collaborator

humblec commented Mar 21, 2022

lgtm. will wait for others to take final look at this.

Cc @ceph/ceph-csi-maintainers

internal/util/reftracker/errors/errors.go Outdated Show resolved Hide resolved
internal/util/reftracker/radoswrapper/fakerados.go Outdated Show resolved Hide resolved
internal/util/reftracker/radoswrapper/interface.go Outdated Show resolved Hide resolved
internal/util/reftracker/radoswrapper/interface.go Outdated Show resolved Hide resolved
internal/util/reftracker/reftracker.go Show resolved Hide resolved
internal/util/reftracker/reftracker.go Show resolved Hide resolved
internal/util/reftracker/reftracker.go Show resolved Hide resolved
internal/util/reftracker/reftracker.go Outdated Show resolved Hide resolved
internal/util/reftracker/version/version_test.go Outdated Show resolved Hide resolved
@gman0
Copy link
Contributor Author

gman0 commented Mar 23, 2022

/retest ci/centos/mini-e2e/k8s-1.22

@gman0 gman0 requested a review from Madhu-1 March 24, 2022 09:26
@humblec
Copy link
Collaborator

humblec commented Mar 24, 2022

@gman0 this looks good to me, I got a few minor comments/questions though.

@gman0
Copy link
Contributor Author

gman0 commented Mar 24, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.23

1 similar comment
@gman0
Copy link
Contributor Author

gman0 commented Mar 24, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.23

@Madhu-1 Madhu-1 requested a review from humblec March 25, 2022 05:15
@gman0
Copy link
Contributor Author

gman0 commented Mar 25, 2022

Hmm, is the merge stuck?

@Rakshith-R
Copy link
Contributor

Hmm, is the merge stuck?

https://github.com/ceph/ceph-csi/pull/2893/checks?check_run_id=5688271877
It's second in the queue,

gman0 added 2 commits March 25, 2022 12:04
ceph_preview tag is needed to make new go-ceph's RADOS read/write ops available

Signed-off-by: Robert Vasek <robert.vasek@cern.ch>
RT, reference tracker, is key-based implementation of a reference counter.
Unlike an integer-based counter, RT counts references by tracking unique
keys. This allows accounting in situations where idempotency must be
preserved. It guarantees there will be no duplicit increments or decrements
of the counter.

Signed-off-by: Robert Vasek <robert.vasek@cern.ch>
@gman0
Copy link
Contributor Author

gman0 commented Mar 25, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.21

@gman0
Copy link
Contributor Author

gman0 commented Mar 25, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.22

@gman0
Copy link
Contributor Author

gman0 commented Mar 25, 2022

/retest ci/centos/mini-e2e/k8s-1.21

@gman0
Copy link
Contributor Author

gman0 commented Mar 25, 2022

/retest ci/centos/mini-e2e/k8s-1.22

@gman0
Copy link
Contributor Author

gman0 commented Mar 25, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.21

@gman0
Copy link
Contributor Author

gman0 commented Mar 25, 2022

/retest ci/centos/mini-e2e-helm/k8s-1.22

@gman0
Copy link
Contributor Author

gman0 commented Mar 25, 2022

/retest ci/centos/mini-e2e/k8s-1.21

@gman0
Copy link
Contributor Author

gman0 commented Mar 25, 2022

/retest ci/centos/mini-e2e/k8s-1.22

@Rakshith-R
Copy link
Contributor

@Mergifyio refresh
@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented Mar 25, 2022

refresh

✅ Pull request refreshed

@Rakshith-R Rakshith-R added the ci/retry/e2e Label to retry e2e retesting on approved PR's label Mar 25, 2022
@ceph-csi-bot
Copy link
Collaborator

/retest ci/centos/mini-e2e/k8s-1.21

@ceph-csi-bot
Copy link
Collaborator

@gman0 "ci/centos/mini-e2e/k8s-1.21" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

@Mergifyio refresh

@mergify
Copy link
Contributor

mergify bot commented Mar 25, 2022

refresh

✅ Pull request refreshed

@gman0
Copy link
Contributor Author

gman0 commented Mar 27, 2022

@Mergifyio refresh

@mergify
Copy link
Contributor

mergify bot commented Mar 27, 2022

refresh

✅ Pull request refreshed

@mergify mergify bot merged commit f6ae612 into ceph:devel Mar 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/retry/e2e Label to retry e2e retesting on approved PR's
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants