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

Extend read_only to also block share locks and super users

Details

    • Bug
    • Status: In Testing (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • 12.1
    • Admin statements
    • None

    Description

      Currently the read_only option is defined the following way:
      Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the 'READ ONLY ADMIN' privilege.

      The current implementation of read_only does not block users from using
      SELECT ... LOCK IN SHARE MODE or LOCK TABLES ... READ, both of which can block
      replication threads from continuing. LOCK IN SHARE MODE is especially dangerous as it takes write locks, which will block replication threads.

      The solve this issue, we plan to extend the --read_only option to have 3 levels:
      Note that the read_only option has no effects on slave/replica threads or temporary tables.
      0 changes allowed
      1 Make all non-temporary tables read-only, with the exception for users with the 'READ ONLY ADMIN' privilege.
      2 block also LOCK TABLES and SELECT IN SHARE MOD
      3 block also users with 'READ ONLY ADMIN' privilege. This is sames as MySQL's super_read_only option.

      Attachments

        Issue Links

          Activity

            Relevant things from the commit message:

            The --read-only option can now take 4 different values:
            0 No read only (as before).
            1 Blocks changes for users without the 'READ ONLY ADMIN' privilege (as before).
            2 Blocks in addition LOCK TABLES and SELECT IN SHARE MODE for not 'READ ONLY ADMIN' users.
            3 Blocks in addition 'READ_ONLY_ADMIN' users for all the previous statements.

            read_only is changed to an enum and one can use the following names for the lock levels:
            OFF, ON, NO_LOCK, NO_LOCK_NO_ADMIN

            Too keep things compatible with older versions config files, one can
            still use values FALSE and TRUE, which are mapped to OFF and ON.

            monty Michael Widenius added a comment - Relevant things from the commit message: The --read-only option can now take 4 different values: 0 No read only (as before). 1 Blocks changes for users without the 'READ ONLY ADMIN' privilege (as before). 2 Blocks in addition LOCK TABLES and SELECT IN SHARE MODE for not 'READ ONLY ADMIN' users. 3 Blocks in addition 'READ_ONLY_ADMIN' users for all the previous statements. read_only is changed to an enum and one can use the following names for the lock levels: OFF, ON, NO_LOCK, NO_LOCK_NO_ADMIN Too keep things compatible with older versions config files, one can still use values FALSE and TRUE, which are mapped to OFF and ON.

            People

              elenst Elena Stepanova
              monty Michael Widenius
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.