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

cannot set session gtid_domain_id in stored procedure (SECURITY DEFINER)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 10.0.14
    • Fix Version/s: N/A
    • Component/s: OTHER
    • Labels:
      None
    • Environment:
      wheezy x86_64

      Description

      CREATE PROCEDURE setdomain() DETERMINISTIC SQL SECURITY DEFINER
      BEGIN
      set @gtid_domain_id=59;
      END
      
      set global init_connect='call  mysql.setdomain();';
      

      non-priv user:

      mysql>  select @gtid_domain_id;
      +-----------------+
      | @gtid_domain_id |
      +-----------------+
      |              59 |
      +-----------------+
      1 row in set (0.00 sec)
      
      mysql> show session variables like 'gtid_domain_id';
      +----------------+-------+
      | Variable_name  | Value |
      +----------------+-------+
      | gtid_domain_id | 0     |
      +----------------+-------+
      1 row in set (0.00 sec)
      

      Binary events logged as this user use gtid_domain_id =0 instead of 59.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            danblack Daniel Black added a comment -

            non-priv user

            mysql> select @last_gtid
                -> ;
            +------------+
            | @last_gtid |
            +------------+
            | NULL       |
            +------------+
            1 row in set (0.00 sec)
            
            mysql> use db;
            Database changed
            mysql> update users set login='user_disabled'  where id=14;
            Query OK, 0 rows affected (0.11 sec)
            Rows matched: 1  Changed: 0  Warnings: 0
            
            mysql> select @@last_gtid
                -> ;
            +-----------------+
            | @@last_gtid     |
            +-----------------+
            | 0-12301-1050230 |
            +-----------------+
            
            mysql> show session variables like 'gtid_domain_id';
            +----------------+-------+
            | Variable_name  | Value |
            +----------------+-------+
            | gtid_domain_id | 0     |
            +----------------+-------+
            1 row in set (0.00 sec)
            
            mysql> select @gtid_domain_id;
            +-----------------+
            | @gtid_domain_id |
            +-----------------+
            |              59 |
            +-----------------+
            1 row in set (0.00 sec)
            
            Show
            danblack Daniel Black added a comment - non-priv user mysql> select @last_gtid -> ; +------------+ | @last_gtid | +------------+ | NULL | +------------+ 1 row in set (0.00 sec) mysql> use db; Database changed mysql> update users set login='user_disabled' where id=14; Query OK, 0 rows affected (0.11 sec) Rows matched: 1 Changed: 0 Warnings: 0 mysql> select @@last_gtid -> ; +-----------------+ | @@last_gtid | +-----------------+ | 0-12301-1050230 | +-----------------+ mysql> show session variables like 'gtid_domain_id'; +----------------+-------+ | Variable_name | Value | +----------------+-------+ | gtid_domain_id | 0 | +----------------+-------+ 1 row in set (0.00 sec) mysql> select @gtid_domain_id; +-----------------+ | @gtid_domain_id | +-----------------+ | 59 | +-----------------+ 1 row in set (0.00 sec)
            Hide
            elenst Elena Stepanova added a comment -

            Hi Daniel,

            I'm not sure I quite understand your point, could you please clarify?
            You set @var (a user-defined variable), but you expect @@var to be updated (a session environment variable). I don't think it works for any variable, gtid or not, do you have a reason to expect that it would?

            Show
            elenst Elena Stepanova added a comment - Hi Daniel, I'm not sure I quite understand your point, could you please clarify? You set @var (a user-defined variable), but you expect @@var to be updated (a session environment variable). I don't think it works for any variable, gtid or not, do you have a reason to expect that it would?
            Hide
            danblack Daniel Black added a comment -

            quite right. I've mixed up those concepts. session variable Gtid_domain_id is able to be set in a procedure.

            bug invalid

            Show
            danblack Daniel Black added a comment - quite right. I've mixed up those concepts. session variable Gtid_domain_id is able to be set in a procedure. bug invalid

              People

              • Assignee:
                Unassigned
                Reporter:
                danblack Daniel Black
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: