Details

    • Improvement
    • Status: Open
    • Medium
    • Resolution: Unresolved
    • 1.5.0
    • None
    • None

    Description

      Currently, checks if ProxySQL or HAProxy is enabled looks like 

       

      if cr.Spec.HAProxy != nil && cr.Spec.HAProxy.Enabled { ... }

       

      for ProxySQL the same

      Since both are pointer types nil checks are mandatory, otherwise "nil pointer dereference" panic will happen. And sometimes it happens...

       

      I propose either:
         1.  Create methods like

      func (s *PerconaXtraDBClusterSpec) HAProxyEnabled() bool {
          return s.HAProxy != nil && s.HAProxy.Enabled
      }
      // THE SAME FOR ProxySQL

      and refactor code to use only these method for checks

          2.  Change ProxySQL & HAProxy to be NOT pointer types. That move looks more solid from the reliability point of view. Those should be carefully weighed and verified if it doesn't break any compatibility etc. Plus it seems it brings more changes thru the codebase.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andrew.pogrebnoi Andrew Pogrebnoi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Smart Checklist