Skip to content

engine/schema: fix findActiveAccountById in AccountDaoImpl.java#5704

Merged
weizhouapache merged 1 commit intoapache:4.16from
shapeblue:4.16-fix-findActiveAccountById
Nov 25, 2021
Merged

engine/schema: fix findActiveAccountById in AccountDaoImpl.java#5704
weizhouapache merged 1 commit intoapache:4.16from
shapeblue:4.16-fix-findActiveAccountById

Conversation

@weizhouapache
Copy link
Copy Markdown
Member

Description

This PR fixes an issue with findActiveAccountById in AccountDaoImpl.java

This method is used in some processes. The impact is unknown.

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)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

@yadvr yadvr added this to the 4.16.1.0 milestone Nov 23, 2021
@yadvr
Copy link
Copy Markdown
Member

yadvr commented Nov 23, 2021

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✖️ el7 ✖️ el8 ✖️ debian ✖️ suse15. SL-JID 1768

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Nov 24, 2021

cc @weizhouapache pl check for failures, I'll rekick pkging
@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

code LGTM

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 1780

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Nov 24, 2021

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link
Copy Markdown

Trillian test result (tid-2585)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 31440 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5704-t2585-kvm-centos7.zip
Smoke tests completed. 91 look OK, 0 have errors
Only failed tests results shown below:

Test Result Time (s) Test File

@DaanHoogland
Copy link
Copy Markdown
Contributor

@weizhouapache code looks ok, but what is the sense of searching for a bunch of fields and the id. The id is unique so this search makes no sense to me. Do you know how it is used and why it is a bug there?

@weizhouapache
Copy link
Copy Markdown
Member Author

@weizhouapache code looks ok, but what is the sense of searching for a bunch of fields and the id. The id is unique so this search makes no sense to me. Do you know how it is used and why it is a bug there?

@DaanHoogland
as I said in description, the issue is with findActiveAccountById

public Account findActiveAccountById(Long accountId, Long domainId) {
SearchCriteria<AccountVO> sc = AllFieldsSearch.create("id", accountId);
sc.setParameters("domainId", domainId);
return findOneBy(sc);
}

this method search records by id, but "id" is not supported in AllFieldsSearch.
therefore the result is same as (id/accountid is ignored)

    @Override
    public Account findActiveAccountById(Long accountId, Long domainId) {
        SearchCriteria<AccountVO> sc = AllFieldsSearch.create();
        sc.setParameters("domainId", domainId);
        return findOneBy(sc);
    }

@DaanHoogland
Copy link
Copy Markdown
Contributor

@weizhouapache code looks ok, but what is the sense of searching for a bunch of fields and the id. The id is unique so this search makes no sense to me. Do you know how it is used and why it is a bug there?

@DaanHoogland as I said in description, the issue is with findActiveAccountById

public Account findActiveAccountById(Long accountId, Long domainId) {
SearchCriteria<AccountVO> sc = AllFieldsSearch.create("id", accountId);
sc.setParameters("domainId", domainId);
return findOneBy(sc);
}

this method search records by id, but "id" is not supported in AllFieldsSearch. therefore the result is same as (id/accountid is ignored)

    @Override
    public Account findActiveAccountById(Long accountId, Long domainId) {
        SearchCriteria<AccountVO> sc = AllFieldsSearch.create();
        sc.setParameters("domainId", domainId);
        return findOneBy(sc);
    }

Ah, you are right. I was confusing SearchBuilder with SearchCriteria.
Nowhere else in the file the id is used in conjunction with the AllFieldsSearch so I think we are good.

@weizhouapache weizhouapache merged commit 2b54b58 into apache:4.16 Nov 25, 2021
@weizhouapache
Copy link
Copy Markdown
Member Author

Merged based on 2 approvals and trillian test result

@weizhouapache weizhouapache deleted the 4.16-fix-findActiveAccountById branch December 9, 2022 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants