Skip to content

slices: remove redundant zeroing in Delete #50760

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

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

Deleplace
Copy link
Contributor

@Deleplace Deleplace commented Apr 30, 2024

Please provide a description of this PR:

Hi, this very small cleanup is removing the explicit zeroing s[i] = empty in slices.Delete.

2 good reasons to do this:

  • The stdlib slices.Delete does now zero/nil out the obsolete elements, since Go 1.22 (1, 2, 3). No need to have istio.io/istio/pkg/slices do the zeroing anymore.
    • istio's go.mod specifies go 1.22.0 so we can move forward
  • Zeroing the correct elements is a subtle exercise. The former code was zeroing at the index being deleted (overwritten), which is not what we wanted. We wanted to zero the now-obsolete element at the end of the slice. The test TestDelete did check if the deleted element was garbage collected, but passed "by chance" because the deleted index happened to be last in the slice. In general, the elements leaking were not necessarily the elements being deleted.

No change to the unit tests is needed.

@Deleplace Deleplace requested a review from a team as a code owner April 30, 2024 13:12
@istio-policy-bot istio-policy-bot added area/perf and scalability release-notes-none Indicates a PR that does not require release notes. labels Apr 30, 2024
@istio-policy-bot
Copy link

😊 Welcome @Deleplace! This is either your first contribution to the Istio istio repo, or it's been
a while since you've been here.

You can learn more about the Istio working groups, Code of Conduct, and contribution guidelines
by referring to Contributing to Istio.

Thanks for contributing!

Courtesy of your friendly welcome wagon.

Copy link

linux-foundation-easycla bot commented Apr 30, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: Deleplace / name: Valentin Deleplace (c805214)

@istio-testing istio-testing added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 30, 2024
@istio-testing
Copy link
Collaborator

Hi @Deleplace. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels Apr 30, 2024
@howardjohn
Copy link
Member

/retest

test flake is from something else, I already have a PR up to fix

@istio-testing istio-testing merged commit 49d42ed into istio:master Apr 30, 2024
28 checks passed
luksa pushed a commit to luksa/istio that referenced this pull request Oct 14, 2024
* upstream/master:
  Fix service entry merge (istio#50711)
  fix jwt-claim-route flake (istio#50769)
  Fix test flake in TestRunComponentsAfterStart (istio#50767)
  slices: remove redundant zeroing in Delete (istio#50760)
  Ambient - propagate IPV6 config correctly to CNI agent (istio#50747)
  Automator: update istio/client-go@master dependency in istio/istio@master (istio#50768)
  Automator: update ztunnel@master in istio/istio@master (istio#50766)
  Automator: update ztunnel@master in istio/istio@master (istio#50740)
  Reduce ztunnel binary minimum size. Fix message (istio#50765)
  Bump go module deps (istio#50732)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/perf and scalability ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. release-notes-none Indicates a PR that does not require release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants