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

TABLE_STATISTICS increments ROWS_CHANGED twice upon UPDATE and does not count DELETE

    XMLWordPrintable

Details

    Description

      This is a regression introduced by MDEV-33151.
      The column rows_changed already existed, it wasn't added by MDEV-33151; but it now shows wrong counts for UPDATE/DELETE, which wasn't happening before, apparently due to the typo:

      @@ -40,14 +47,22 @@ static int table_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond)
               check_grant(thd, SELECT_ACL, &tmp_table, 1, 1, 1))
             continue;
       
      +    rows_changed= (rows_stats->inserted + rows_stats->updated +
      +                   rows_stats->updated);
      

      set @userstat.save= @@userstat;
      set global userstat= 1;
       
      create table t (a int);
      insert into t values (1),(2);
       
      flush table_statistics;
      update t set a = a + 10;
      select rows_changed from information_schema.table_statistics where table_name = 't';
      delete from t where a = 11;
      select rows_changed from information_schema.table_statistics where table_name = 't';
       
      # Cleanup
      drop table t;
      set global userstat= @userstat.save;
      

      bb-11.5-MDEV-33151-userstat 36c7a912bc

      flush table_statistics;
      update t set a = a + 10;
      select rows_changed from information_schema.table_statistics where table_name = 't';
      rows_changed
      4
      delete from t where a = 11;
      select rows_changed from information_schema.table_statistics where table_name = 't';
      rows_changed
      4
      

      The expected result is "2" and "3" correspondingly, which is returned by the baseline.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.