Details

    • Type: Bug
    • Status: Stalled
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.0.10
    • Fix Version/s: 10.0
    • Component/s: None
    • Labels:
      None

      Description

      Some administrative commands report corruption for CONNECT tables:

      • CHECK TABLE
      • REPAIR TABLE
      • ANALYZE TABLE
      • others?

      For example:

      MariaDB [test]> CHECK TABLE tc;
      +---------+-------+----------+------------------------------------------------------------------------+
      | Table   | Op    | Msg_type | Msg_text                                                               |
      +---------+-------+----------+------------------------------------------------------------------------+
      | test.tc | check | Error    | CONNECT Unsupported command                                            |
      | test.tc | check | Error    | Can't lock file (errno: 122 "Internal (unspecified) error in handler") |
      | test.tc | check | error    | Corrupt                                                                |
      +---------+-------+----------+------------------------------------------------------------------------+
      3 rows in set (0.00 sec)
      

      I understand that they are not supported. The problem is with the last row. If you want a program to verify whether a table is corrupted, you issue CHECK TABLE and look if the last returned row has Msg_type='error' and Msg_text='Corrupt'. You do the same if you want the program to try a REPAIR and check if it succeeds.

      It would be nice if CONNECT could avoid returning that row.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            f_razzoli Federico Razzoli added a comment - - edited

            For example, if it could do something like this (InnoDB), it would be perfect:

            MariaDB [test]> REPAIR TABLE t;
            +--------+--------+----------+---------------------------------------------------------+
            | Table  | Op     | Msg_type | Msg_text                                                |
            +--------+--------+----------+---------------------------------------------------------+
            | test.t | repair | note     | The storage engine for the table doesn't support repair |
            +--------+--------+----------+---------------------------------------------------------+
            1 row in set (0.00 sec)
            
            Show
            f_razzoli Federico Razzoli added a comment - - edited For example, if it could do something like this (InnoDB), it would be perfect: MariaDB [test]> REPAIR TABLE t; +--------+--------+----------+---------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +--------+--------+----------+---------------------------------------------------------+ | test.t | repair | note | The storage engine for the table doesn't support repair | +--------+--------+----------+---------------------------------------------------------+ 1 row in set (0.00 sec)
            Hide
            elenst Elena Stepanova added a comment -

            CHECKSUM returns the first two, but not 'Corrupt'.
            Interestingly, OPTIMIZE behaves nice:

            +---------+----------+----------+-----------------------------+
            | Table   | Op       | Msg_type | Msg_text                    |
            +---------+----------+----------+-----------------------------+
            | test.t1 | optimize | Warning  | CONNECT Unsupported command |
            | test.t1 | optimize | status   | OK                          |
            +---------+----------+----------+-----------------------------+
            
            Show
            elenst Elena Stepanova added a comment - CHECKSUM returns the first two, but not 'Corrupt'. Interestingly, OPTIMIZE behaves nice: +---------+----------+----------+-----------------------------+ | Table | Op | Msg_type | Msg_text | +---------+----------+----------+-----------------------------+ | test.t1 | optimize | Warning | CONNECT Unsupported command | | test.t1 | optimize | status | OK | +---------+----------+----------+-----------------------------+
            Hide
            bertrandop Olivier Bertrand added a comment -

            Here is what I get with the last version of CONNECT:

            MariaDB [connect]> CHECK TABLE employe;
            +-----------------+-------+----------+------------------------------------------------------------------------+
            | Table           | Op    | Msg_type | Msg_text                                                               |
            +-----------------+-------+----------+------------------------------------------------------------------------+
            | connect.employe | check | Error    | CONNECT Unsupported command                                            |
            | connect.employe | check | Error    | Can't lock file (errno: 122 "Internal (unspecified) error in handler") |
            | connect.employe | check | error    | Corrupt                                                                |
            +-----------------+-------+----------+------------------------------------------------------------------------+
            3 rows in set (0.08 sec)
            
            MariaDB [connect]> REPAIR TABLE employe;
            +-----------------+--------+----------+------------------------------------------------------------------------+
            | Table           | Op     | Msg_type | Msg_text                                                               |
            +-----------------+--------+----------+------------------------------------------------------------------------+
            | connect.employe | repair | Error    | CONNECT Unsupported command                                            |
            | connect.employe | repair | Error    | Can't lock file (errno: 122 "Internal (unspecified) error in handler") |
            | connect.employe | repair | error    | Corrupt                                                                |
            +-----------------+--------+----------+------------------------------------------------------------------------+
            3 rows in set (0.00 sec)
            
            MariaDB [connect]> ANALYZE TABLE employe;
            +-----------------+---------+----------+------------------------------------------------------------------------+
            | Table           | Op      | Msg_type | Msg_text                                                               |
            +-----------------+---------+----------+------------------------------------------------------------------------+
            | connect.employe | analyze | Error    | CONNECT Unsupported command                                            |
            | connect.employe | analyze | Error    | Can't lock file (errno: 122 "Internal (unspecified) error in handler") |
            | connect.employe | analyze | error    | Corrupt                                                                |
            +-----------------+---------+----------+------------------------------------------------------------------------+
            3 rows in set (0.00 sec)
            
            MariaDB [connect]> OPTIMIZE TABLE employe;
            +-----------------+----------+----------+----------+
            | Table           | Op       | Msg_type | Msg_text |
            +-----------------+----------+----------+----------+
            | connect.employe | optimize | status   | OK       |
            +-----------------+----------+----------+----------+
            1 row in set (0.05 sec)
            
            MariaDB [connect]> CHECKSUM TABLE employe;
            +-----------------+----------+
            | Table           | Checksum |
            +-----------------+----------+
            | connect.employe |     NULL |
            +-----------------+----------+
            1 row in set, 2 warnings (0.08 sec)
            

            The problem is complex. CONNECT works by treating each query as a separate entity. For this, it needs to know when a new query begins. There are two functions that mark the start of new query for a table:

            1 - external_lock: called when the table is not locked
            2 - start_stmt: called when the table is locked

            Therefore CONNECT does all query initialization and termination work in external_lock (most of the time) in particular checks whether the command is supported or not supported. When a command is not supported CONNECT prepares the message "CONNECT Unsupported command" and returns HA_ERR_INTERNAL_ERROR.

            What happens next is MariaDB processing. The message "Can't lock file" comes from CONNECT doing things in external_lock that are not related to locking. I don't know where the "Corrupt" message comes from.

            This shows that some plugins, in particular CONNECT, need a true function call at the beginning of each new query. The start_stmt function would be all right if unconditionally called.

            Show
            bertrandop Olivier Bertrand added a comment - Here is what I get with the last version of CONNECT: MariaDB [connect]> CHECK TABLE employe; +-----------------+-------+----------+------------------------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +-----------------+-------+----------+------------------------------------------------------------------------+ | connect.employe | check | Error | CONNECT Unsupported command | | connect.employe | check | Error | Can't lock file (errno: 122 "Internal (unspecified) error in handler" ) | | connect.employe | check | error | Corrupt | +-----------------+-------+----------+------------------------------------------------------------------------+ 3 rows in set (0.08 sec) MariaDB [connect]> REPAIR TABLE employe; +-----------------+--------+----------+------------------------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +-----------------+--------+----------+------------------------------------------------------------------------+ | connect.employe | repair | Error | CONNECT Unsupported command | | connect.employe | repair | Error | Can't lock file (errno: 122 "Internal (unspecified) error in handler" ) | | connect.employe | repair | error | Corrupt | +-----------------+--------+----------+------------------------------------------------------------------------+ 3 rows in set (0.00 sec) MariaDB [connect]> ANALYZE TABLE employe; +-----------------+---------+----------+------------------------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +-----------------+---------+----------+------------------------------------------------------------------------+ | connect.employe | analyze | Error | CONNECT Unsupported command | | connect.employe | analyze | Error | Can't lock file (errno: 122 "Internal (unspecified) error in handler" ) | | connect.employe | analyze | error | Corrupt | +-----------------+---------+----------+------------------------------------------------------------------------+ 3 rows in set (0.00 sec) MariaDB [connect]> OPTIMIZE TABLE employe; +-----------------+----------+----------+----------+ | Table | Op | Msg_type | Msg_text | +-----------------+----------+----------+----------+ | connect.employe | optimize | status | OK | +-----------------+----------+----------+----------+ 1 row in set (0.05 sec) MariaDB [connect]> CHECKSUM TABLE employe; +-----------------+----------+ | Table | Checksum | +-----------------+----------+ | connect.employe | NULL | +-----------------+----------+ 1 row in set, 2 warnings (0.08 sec) The problem is complex. CONNECT works by treating each query as a separate entity. For this, it needs to know when a new query begins. There are two functions that mark the start of new query for a table: 1 - external_lock: called when the table is not locked 2 - start_stmt: called when the table is locked Therefore CONNECT does all query initialization and termination work in external_lock (most of the time) in particular checks whether the command is supported or not supported. When a command is not supported CONNECT prepares the message "CONNECT Unsupported command" and returns HA_ERR_INTERNAL_ERROR. What happens next is MariaDB processing. The message "Can't lock file" comes from CONNECT doing things in external_lock that are not related to locking. I don't know where the "Corrupt" message comes from. This shows that some plugins, in particular CONNECT, need a true function call at the beginning of each new query. The start_stmt function would be all right if unconditionally called.

              People

              • Assignee:
                bertrandop Olivier Bertrand
                Reporter:
                f_razzoli Federico Razzoli
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: