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

SENT_ROWS shows random wrong values when stored function is selected

    XMLWordPrintable

Details

    Description

      The test case if for reproducing purposes only, don't put it into the regression suite, please create a deterministic one instead.

      --source include/have_sequence.inc
       
      create function f() returns int return 1;
       
      --connect(con1,localhost,root,,)
      --let $conid= `select connection_id()`
      --send
        select f() from seq_1_to_10000000 where seq%1000000 = 0;
       
      --connection default
      --let $sent_rows=
       
      while (`select INFO is not null from information_schema.processlist where id = $conid`)
      {
        --let $rows= `select sent_rows from information_schema.processlist where id = $conid`
        if ($rows != $sent_rows)
        {
          --echo # Found SENT_ROWS = $rows
          --let $sent_rows= $rows
        }
      }
      --enable_query_log
       
      --connection con1
      --reap
      drop function f;
      

      preview-11.3-preview b09e99ff759

      connection default;
      # Found SENT_ROWS = 0
      # Found SENT_ROWS = 1
      # Found SENT_ROWS = 0
      # Found SENT_ROWS = 3
      # Found SENT_ROWS = 7
      # Found SENT_ROWS = 15
      # Found SENT_ROWS = 31
      # Found SENT_ROWS = 63
      # Found SENT_ROWS = 127
      # Found SENT_ROWS = 255
      # Found SENT_ROWS = 511
      # Found SENT_ROWS = 0
      connection con1;
      f()
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      

      Not only the values above are wrong (there are only 10 rows sent), but also it jumps from non-zero to zero again (0 => 1 => 0).

      If the query is modified to

      select f() from seq_1_to_10000000
      

      without WHERE condition, then the SENT_ROWS often jumps from 0 to 2147483647 and back to 0 (but the test case won't work well, as the connection will hit net writing limit).

      connect con1,localhost,root,,;
      select f() from seq_1_to_10000000;
      connection default;
      # Found SENT_ROWS = 0
      # Found SENT_ROWS = 2147483647
      # Found SENT_ROWS = 0
      # Found SENT_ROWS = 2147483647
      # Found SENT_ROWS = 0
      # Found SENT_ROWS = 2147483647
      # Found SENT_ROWS = 0
      ...
      

      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.