Skip to content

Allow counters to be created with same name, provider and source as a deleted one #10223

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

Open
wants to merge 9 commits into
base: 4.20
Choose a base branch
from

Conversation

Pearl1594
Copy link
Contributor

Description

This PR fixes: #10043

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 8.33333% with 22 lines in your changes missing coverage. Please review.

Project coverage is 15.99%. Comparing base (37c4df9) to head (11f1217).
Report is 72 commits behind head on 4.20.

Files with missing lines Patch % Lines
.../java/com/cloud/network/as/dao/CounterDaoImpl.java 0.00% 12 Missing ⚠️
.../api/command/admin/autoscale/CreateCounterCmd.java 0.00% 5 Missing ⚠️
...ava/com/cloud/network/as/AutoScaleManagerImpl.java 28.57% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #10223   +/-   ##
=========================================
  Coverage     15.99%   15.99%           
- Complexity    13086    13088    +2     
=========================================
  Files          5649     5649           
  Lines        495714   495733   +19     
  Branches      60017    60018    +1     
=========================================
+ Hits          79289    79302   +13     
- Misses       407572   407577    +5     
- Partials       8853     8854    +1     
Flag Coverage Δ
uitests 4.01% <ø> (ø)
unittests 16.83% <8.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@Pearl1594 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12137

@rohityadavcloud
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@rohityadavcloud a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

one comment,

Also the issue reported that deleteCounter doesn't work. Is that genuine?

@blueorangutan
Copy link

[SF] Trillian test result (tid-12142)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 46204 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10223-t12142-kvm-ol8.zip
Smoke tests completed. 133 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland DaanHoogland added this to the 4.19.3 milestone Feb 13, 2025
@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@weizhouapache
Copy link
Member

@Pearl1594
with this PR, can user create a counter with same name, provider and source as non-deleted one ?
(I think it should fail)

@Pearl1594
Copy link
Contributor Author

Pearl1594 commented Feb 25, 2025

@Pearl1594 with this PR, can user create a counter with same name, provider and source as non-deleted one ? (I think it should fail)

@weizhouapache It allows to create a counter with same name provider and source - as long as the value is different. Is that not expected?

image

Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@Pearl1594 Pearl1594 changed the base branch from 4.19 to 4.20 February 25, 2025 18:09
@Pearl1594 Pearl1594 modified the milestones: 4.19.3, 4.20.1 Feb 25, 2025
@weizhouapache
Copy link
Member

weizhouapache commented Feb 25, 2025

@Pearl1594 with this PR, can user create a counter with same name, provider and source as non-deleted one ? (I think it should fail)

@weizhouapache It allows to create a counter with same name provider and source - as long as the value is different. Is that not expected?

image

Thanks for testing @Pearl1594
I think the name should be unique for each provider and source. The second command should fail as well. Just my thoughts, no need to address it.

Can you test with same provider/source/value but different name ? It is the original issue.

@Pearl1594
Copy link
Contributor Author

Pearl1594 commented Feb 25, 2025

It seems to allow that:
image

I think the original issue was not being able to create counter with same name, provider and source as a deleted counter

However, now that you asked to test it @weizhouapache - I am not sure if this is correct in the first place.

@Pearl1594
Copy link
Contributor Author

@weizhouapache I added a fix - could you please verify if the below behaviour is what's expected:
image

Thanks.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
15.2% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube Cloud

@weizhouapache
Copy link
Member

@Pearl1594
thanks for the update.

I checked the counter table in my database, it has unique key

UNIQUE KEY `uc_counter__provider__source__value` (`provider`,`source`,`value`),

the reporter also mentioned

deleteCounter function removes counter and allow us to create a counter with the same value

so it looks like the counter name can be same as other counters, sorry my bad.

currently if create a counter with same provider/source/value, it throws exception entity exists due to the new unique key, which is not very clear to users.
It would be good to replace the check on name with value in your PR, for example

- findByNameProviderSource(String name, String source, String provider)
+ findByNameProviderValue(String name, String value, String provider)

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

@DaanHoogland
Copy link
Contributor

@Pearl1594 what is the status of this? Ar you going to work to apply @weizhouapache 's sugection in #10223 (comment) ?

@Pearl1594
Copy link
Contributor Author

I need to revert a change because from an earlier discussion I had made changes to prevent counters from having the same name. But that seems like it should be allowed. So I need to work on this.

Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland
Copy link
Contributor

@Pearl1594 can you address the comments and conflict?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

bug(api): createCounter/deleteCounter functions not working properly
5 participants