Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-41215

can_purge_log() reports "it is the current active binlog" for a log that is not active

    XMLWordPrintable

Details

    Description

      can_purge_log() reports it is the current active binlog for a binary log that is not the active one. In the reproduction below the refusal names ...-bin.000003 while ...-bin.000008 is active.

      Where

      Two unrelated conditions share one reason string (sql/log.cc):

        if (is_active(log_file_name_arg) ||
            (!is_relay_log && waiting_for_slave_to_change_binlog &&
             purge_sending_new_binlog_file == sending_new_binlog_file &&
             !strcmp(log_file_name_arg, purge_binlog_name)))
        {
          reason= "it is the current active binlog";
          goto error;
        }
      

      The first condition is what the string says. The second – "this file was refused a moment ago and nothing has changed since" – says nothing about the file being active, and in general it is not.

      The refusal that populated the cache had already reported the real reason, either "less than 'slave_connections_needed_for_purge' slaves have processed it" or "it is in use by a slave thread", so the information needed is available at the point the cache is written. Carrying the recorded reason alongside purge_binlog_name, or simply wording the cached branch for what it means, would fix it independently of the behavioral bug in MDEV-41214.

      Why it has stayed hidden

      On the non-interactive path, purge_warning_given suppresses the note on every refusal after the first until a purge succeeds, so an automatic purge usually does not print it twice. An interactive caller is exempt from that suppression, so a human running PURGE BINARY LOGS is the one most likely to be told something false.

      Steps to reproduce

      As in MDEV-41214, whose attached mtr test manifests this too: on a standalone master with no slaves and default settings, let one automatic purge be refused, then run PURGE BINARY LOGS TO against a later file.

      Expected

      The reason given is the reason the purge was actually refused.

      Actual

      Note 1375  Binary log '...-bin.000003' is not purged because it is the
                 current active binlog
      

      Relationship to MDEV-41214

      Separable, and deliberately filed on its own: fixing the interactive inheritance in MDEV-41214 still leaves this branch reporting the wrong reason for a genuine and correct refusal of an automatic purge.

      Versions

      Introduced by 18dfcfdecf4 (MDEV-31404), first released in 11.4.1. Reproduced on 13.0.2-MariaDB-log.

      Priority deliberately left at the project default: severity is not mine to rate.

      Attachments

        Issue Links

          Activity

            People

              mariadb-pavithrapandith Pavithra Pandith
              stefan.hinz Stefan Hinz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5h
                  0.5h

                  Git Integration

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