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

Bulk execution loses warnings of earlier parameter sets when the statement is reprepared

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11, 11.4
    • None
    • Prepared Statements
    • None

    Description

      In a per-row bulk operation (COM_STMT_BULK_EXECUTE that executes the statement once per parameter set: UPDATE, DELETE, INSERT with a subquery depending on a parameter after MDEV-23864) a reprepare in a later execution calls Prepared_statement::reprepare(), which calls thd->get_stmt_da()->clear_warning_info(). The warnings of the earlier parameter sets are dropped, but the warning count of the bulk operation still counts them.

      How to repeat

      SET sql_mode='';
      CREATE TABLE t2 (a INT PRIMARY KEY, b TINYINT);
      INSERT INTO t2 VALUES (1,0),(2,0),(3,0);
      -- bulk, parameter sets (1000,1), (1,2), (1,3):
      UPDATE t2 SET b = ? WHERE a = ?;
      -- connection 2, between parameter sets 1 and 2:
      ALTER TABLE t2 FORCE;
      SHOW WARNINGS;

      The client runs the bulk statement on connection 1 with SET debug_sync='before_execute_sql_command SIGNAL s1 WAIT_FOR go EXECUTE 2', and a second connection runs the DDL while the second parameter set waits (debug build). Without debug_sync the same happens when the DDL is concurrent and lands between two parameter sets.

      With the MDEV-23864 patch (10.11, debug) the OK packet reports 1 warning, but SHOW WARNINGS is empty. Without the reprepare SHOW WARNINGS shows

      Warning 1264 Out of range value for column 'b' at row 1

      Without the patch (11.4.13 debug, source revision 4813c2f0a8a79e4e4c000cc8c9447096fafe7033) the server fails the assertion `! is_set() || m_can_overwrite_status' in Diagnostics_area::set_error_status() instead, see MDEV-41511.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sanja Oleksandr Byelkin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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