Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-4556

master detection not work properly in cmapi

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • cmapi-1.3
    • cmapi
    • None

    Description

      Hello,

      cmapi detects master with

      SELECT VARIABLE_VALUE FROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME = 'SLAVE_CONNECTIONS';

      SLAVE_CONNECTIONS is defined as

      "Number of REGISTER_SLAVE attempts. In practice the number of times slaves has tried to connect to the master. "

      https://mariadb.com/kb/en/replication-and-binary-log-status-variables/#slave_connections

      It is a counter, which will not be reseted, if the server is no master anymore, so this will not safely detects a master.

       
      # returns a pair of bools
      # the first indicates whether the node is the master
      # the second indicates if the calling functions retry loop should continue
      def _is_master(node, root):
          ces_node = root.find("./CrossEngineSupport")
          username = ces_node.find("./User").text
          password = ces_node.find("./Password").text
       
          if username is None:
              return False, False
       
          cmd = (f"mariadb -h {node} -u '{username}' --password='{password}' -sN -e \
                  \"SELECT VARIABLE_VALUE FROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME = 'SLAVE_CONNECTIONS';\"")
       
          ret = subprocess.run(cmd, stdout=subprocess.PIPE, shell = True)
          if ret.returncode == 0:
              response = ret.stdout.decode("utf-8").strip()
              if response > '0':
                  return True, False
          else:
              return False, False
          return False, True
      

      Maybe the suggestion from Todd in MCOL-4289 is more safe,

      SELECT COUNT(1) AS `slave_threads`
       
      FROM `information_schema`.`PROCESSLIST`
       
      WHERE `USER`='system user'
       
        AND `COMMAND` LIKE 'Slave%';
      

      Attachments

        Issue Links

          Activity

            People

              toddstoffel Todd Stoffel (Inactive)
              Richard Richard Stracke
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.