Skip to content

Fix syntax issue introduced in #1188 NPE bugfix#1189

Closed
zcross wants to merge 1 commit intoAltinity:0.21.3from
zcross:zcross/bugfix-npe-issue-1187-syntax
Closed

Fix syntax issue introduced in #1188 NPE bugfix#1189
zcross wants to merge 1 commit intoAltinity:0.21.3from
zcross:zcross/bugfix-npe-issue-1187-syntax

Conversation

@zcross
Copy link
Copy Markdown
Contributor

@zcross zcross commented Jul 7, 2023

While manually writing the fix in #1188 using a text editor, I misread the return type of the GetNormalizedCHICompleted function as returning a bool rather than a pointer to a CHI. That broke the build of 0.21.3 once #1188 was merged.

Now, this looks more similar to the original state of the code (just using getters instead of direct field access):
https://github.com/Altinity/clickhouse-operator/pull/1188/files#diff-6dd1bf383889aa0b3dde98cf3579859d84b90dd638c4829390596f9237e62f65L295

cc @sunsingerus

Important items to consider before making a Pull Request

Please check items PR complies to:

  • All commits in the PR are squashed. More info
  • The PR is made into dedicated next-release branch, not into master branch1. More info
  • The PR is signed. More info

@zcross
Copy link
Copy Markdown
Contributor Author

zcross commented Jul 7, 2023

Rebased to fix conflict (DiscoveryWatchedCHIs had some changes on 0.21.3 after my unfortunately syntactically-broken first PR)

continue
}

if !chi.GetStatus().HasNormalizedCHICompleted() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

GetStatus can return nil, so we could either:

  • if chi.GetStatus() == nil || !chi.GetStatus().HasNormalizedCHICompleted()
  • if chi.EnsureStatus().HasNormalizedCHICompleted()

I picked the second option for brevity (and because I'm thinking there's no harm to just ensuring that the status struct is non-nil on access like this, i.e., because it is synchronized and can't "clobber" any other concurrent mutations to this state).

@alex-zaitsev
Copy link
Copy Markdown
Member

The problem is already fixed, so this PR is not needed anymore

@zcross
Copy link
Copy Markdown
Contributor Author

zcross commented Jul 11, 2023

Great, thanks @alex-zaitsev !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants