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

mysqldump --force doesn't ignore error as it should

Details

    Description

      Customer has few legacy functions.

      One of the function has some syntax error.
      But more importantly customer is unable to take a dump of the function even with --force.

      mysqldump --no-data --routines --events --triggers --force --databases xxxx> dump.sql
      mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `FF1`': Undeclared variable: DBPAY_DRAWING_AMT (1327)
      

      Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
      This doesnt happen for this particular function.
      But the behaviour can be observed for "Views with missing tables" errors.

      Attachments

        Activity

          susmeet.khaire Susmeet Khaire created issue -
          susmeet.khaire Susmeet Khaire made changes -
          Field Original Value New Value
          Description Customer has few legacy functions.

          One the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          Customer has few legacy functions.

          One the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          [mysql@x01gtdsdb2a mysqldump]$ mysqldump -uinstadm -p --no-data --routines --events --triggers --max-allowed-packet=100M --single-transaction --force --databases tdsdbsgowner > ddl_tdsdbsgowner.sql
          Enter password:
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `FF1`': Failed to load routine tdsdbsgowner.FF1 (internal code -6). For more details, run SHOW WARNINGS (1457)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          susmeet.khaire Susmeet Khaire made changes -
          Description Customer has few legacy functions.

          One the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          [mysql@x01gtdsdb2a mysqldump]$ mysqldump -uinstadm -p --no-data --routines --events --triggers --max-allowed-packet=100M --single-transaction --force --databases tdsdbsgowner > ddl_tdsdbsgowner.sql
          Enter password:
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `FF1`': Failed to load routine tdsdbsgowner.FF1 (internal code -6). For more details, run SHOW WARNINGS (1457)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          Customer has few legacy functions.

          One the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          [mysql@x01gtdsdb2a mysqldump]$ mysqldump -uinstadm -p --no-data --routines --events --triggers --max-allowed-packet=100M --single-transaction --force --databases {database}> dump.sql
          Enter password:
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `FF1`': Failed to load routine tdsdbsgowner.FF1 (internal code -6). For more details, run SHOW WARNINGS (1457)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          susmeet.khaire Susmeet Khaire made changes -
          Description Customer has few legacy functions.

          One the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          [mysql@x01gtdsdb2a mysqldump]$ mysqldump -uinstadm -p --no-data --routines --events --triggers --max-allowed-packet=100M --single-transaction --force --databases {database}> dump.sql
          Enter password:
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `FF1`': Failed to load routine tdsdbsgowner.FF1 (internal code -6). For more details, run SHOW WARNINGS (1457)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          Customer has few legacy functions.

          One the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          [mysql@x01gtdsdb2a mysqldump]$ mysqldump -uinstadm -p --no-data --routines --events --triggers --max-allowed-packet=100M --single-transaction --force --databases xxxx> dump.sql
          Enter password:
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `ABC`': Failed to load routine xxxx.ABC (internal code -6). For more details, run SHOW WARNINGS (1457)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          susmeet.khaire Susmeet Khaire made changes -
          Summary mysqldump --force doesn't ignore error as it should PENDING mysqldump --force doesn't ignore error as it should
          susmeet.khaire Susmeet Khaire made changes -
          Summary PENDING mysqldump --force doesn't ignore error as it should mysqldump --force doesn't ignore error as it should
          susmeet.khaire Susmeet Khaire made changes -
          Description Customer has few legacy functions.

          One the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          [mysql@x01gtdsdb2a mysqldump]$ mysqldump -uinstadm -p --no-data --routines --events --triggers --max-allowed-packet=100M --single-transaction --force --databases xxxx> dump.sql
          Enter password:
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `ABC`': Failed to load routine xxxx.ABC (internal code -6). For more details, run SHOW WARNINGS (1457)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          Customer has few legacy functions.

          One of the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          [mysql@x01gtdsdb2a mysqldump]$ mysqldump -uinstadm -p --no-data --routines --events --triggers --max-allowed-packet=100M --single-transaction --force --databases xxxx> dump.sql
          Enter password:
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `ABC`': Failed to load routine xxxx.ABC (internal code -6). For more details, run SHOW WARNINGS (1457)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          susmeet.khaire Susmeet Khaire made changes -
          Description Customer has few legacy functions.

          One of the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          [mysql@x01gtdsdb2a mysqldump]$ mysqldump -uinstadm -p --no-data --routines --events --triggers --max-allowed-packet=100M --single-transaction --force --databases xxxx> dump.sql
          Enter password:
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `ABC`': Failed to load routine xxxx.ABC (internal code -6). For more details, run SHOW WARNINGS (1457)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          Customer has few legacy functions.

          One of the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          mysqldump --no-data --routines --events --triggers --force --databases tdsdbsgowner > dump.sql
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `FF1`': Undeclared variable: DBPAY_DRAWING_AMT (1327)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          susmeet.khaire Susmeet Khaire made changes -
          Description Customer has few legacy functions.

          One of the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          mysqldump --no-data --routines --events --triggers --force --databases tdsdbsgowner > dump.sql
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `FF1`': Undeclared variable: DBPAY_DRAWING_AMT (1327)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          Customer has few legacy functions.

          One of the function has some syntax error.
          But more importantly customer is unable to take a dump of the function even with --force.

          {code:java}
          mysqldump --no-data --routines --events --triggers --force --databases xxxx> dump.sql
          mysqldump: Couldn't execute 'SHOW CREATE FUNCTION `FF1`': Undeclared variable: DBPAY_DRAWING_AMT (1327)
          {code}

          Force option is supposed to ignore the error, add a comment in the dump file and move on to the next object.
          This doesnt happen for this particular function.
          But the behaviour can be observed for "Views with missing tables" errors.
          danblack Daniel Black added a comment -

          reproduced with:

          MariaDB [mysql]> create function bob() returns int return 1;
           
          MariaDB [mysql]> update proc set body='return no_such_var' where name='bob';
          Query OK, 1 row affected (0.001 sec)
          Rows matched: 1  Changed: 1  Warnings: 0
           
          MariaDB [mysql]> show create function bob;
          ERROR 1327 (42000): Undeclared variable: no_such_var
          MariaDB [mysql]> select bob();
          ERROR 1457 (HY000): Failed to load routine mysql.bob (internal code -6). For more details, run SHOW WARNINGS
          MariaDB [mysql]> show warnings;
          +-------+------+------------------------------------------------------------------------------------------+
          | Level | Code | Message                                                                                  |
          +-------+------+------------------------------------------------------------------------------------------+
          | Error | 1327 | Undeclared variable: no_such_var                                                         |
          | Error | 1457 | Failed to load routine mysql.bob (internal code -6). For more details, run SHOW WARNINGS |
          +-------+------+------------------------------------------------------------------------------------------+
          2 rows in set (0.000 sec)
          

          I suppose it would be more consistent to treat events and triggers the same way during mariadb-dump too.

          danblack Daniel Black added a comment - reproduced with: MariaDB [mysql]> create function bob() returns int return 1;   MariaDB [mysql]> update proc set body= 'return no_such_var' where name = 'bob' ; Query OK, 1 row affected (0.001 sec) Rows matched: 1 Changed: 1 Warnings: 0   MariaDB [mysql]> show create function bob; ERROR 1327 (42000): Undeclared variable: no_such_var MariaDB [mysql]> select bob(); ERROR 1457 (HY000): Failed to load routine mysql.bob (internal code -6). For more details, run SHOW WARNINGS MariaDB [mysql]> show warnings; + -------+------+------------------------------------------------------------------------------------------+ | Level | Code | Message | + -------+------+------------------------------------------------------------------------------------------+ | Error | 1327 | Undeclared variable: no_such_var | | Error | 1457 | Failed to load routine mysql.bob (internal code -6). For more details, run SHOW WARNINGS | + -------+------+------------------------------------------------------------------------------------------+ 2 rows in set (0.000 sec) I suppose it would be more consistent to treat events and triggers the same way during mariadb-dump too.
          julien.fritsch Julien Fritsch made changes -
          Issue Type Task [ 3 ] Bug [ 1 ]
          julien.fritsch Julien Fritsch made changes -
          Labels mysqldump
          julien.fritsch Julien Fritsch made changes -
          Assignee Sergei Golubchik [ serg ]
          danblack Daniel Black made changes -
          Affects Version/s 10.6.12 [ 28513 ]
          Affects Version/s 10.5 [ 23123 ]
          danblack Daniel Black made changes -
          Component/s Scripts & Clients [ 11002 ]
          danblack Daniel Black made changes -
          Assignee Sergei Golubchik [ serg ] Daniel Black [ danblack ]
          danblack Daniel Black added a comment -

          It occurs to me we could just removing the validation of the function in SHOW CREATE FUNCTION? This would make it equivalent to triggers and events who's SHOW SQL doesn't validate the function.

          Any recommendation serg?

          danblack Daniel Black added a comment - It occurs to me we could just removing the validation of the function in SHOW CREATE FUNCTION ? This would make it equivalent to triggers and events who's SHOW SQL doesn't validate the function. Any recommendation serg ?
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s 10.4 [ 22408 ]
          Fix Version/s 10.5 [ 23123 ]
          Fix Version/s 10.6 [ 24028 ]
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s 10.4 [ 22408 ]

          danblack, I think just making --force to continue over errors should be enough here. If someone would want to include invalid routines into the dump it could be easily achieved by dumping mysql.proc and not using --routines

          serg Sergei Golubchik added a comment - danblack , I think just making --force to continue over errors should be enough here. If someone would want to include invalid routines into the dump it could be easily achieved by dumping mysql.proc and not using --routines
          julien.fritsch Julien Fritsch made changes -
          Priority Major [ 3 ] Critical [ 2 ]
          julien.fritsch Julien Fritsch made changes -
          Status Open [ 1 ] Confirmed [ 10101 ]
          serg Sergei Golubchik made changes -
          Assignee Daniel Black [ danblack ] Sergei Golubchik [ serg ]
          serg Sergei Golubchik made changes -
          Status Confirmed [ 10101 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.4 [ 22408 ]
          serg Sergei Golubchik made changes -
          Status In Progress [ 3 ] Stalled [ 10000 ]
          serg Sergei Golubchik made changes -
          Status Stalled [ 10000 ] In Testing [ 10301 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.4.31 [ 29010 ]
          Fix Version/s 10.5.22 [ 29011 ]
          Fix Version/s 10.6.15 [ 29013 ]
          Fix Version/s 10.9.8 [ 29015 ]
          Fix Version/s 10.10.6 [ 29017 ]
          Fix Version/s 10.11.5 [ 29019 ]
          Fix Version/s 11.1.2 [ 28921 ]
          Fix Version/s 11.2.1 [ 29034 ]
          Fix Version/s 10.4 [ 22408 ]
          Fix Version/s 10.5 [ 23123 ]
          Fix Version/s 10.6 [ 24028 ]
          Resolution Fixed [ 1 ]
          Status In Testing [ 10301 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 11.0.3 [ 28920 ]
          mariadb-jira-automation Jira Automation (IT) made changes -
          Zendesk Related Tickets 157168

          People

            serg Sergei Golubchik
            susmeet.khaire Susmeet Khaire
            Votes:
            1 Vote for this issue
            Watchers:
            5 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.