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

Counters of used resources are not reset when account is recreated

Details

    Description

      If an account has a resource limit (in the example below it is MAX_QUERIES_PER_HOUR, I didn't check other values), and the account has used a part or all of this limit, dropping and re-creating the account anew doesn't reset the accumulated value, instead for the newly created account the counting continues from the value where it ended for the old one.

      So, in the example below, the account has MAX_QUERIES_PER_HOUR=2, it runs 3 queries, and the third fails as expected; then the account is re-created, now with MAX_QUERIES_PER_HOUR=4. The expectation is that it will be able to run 4 queries before reaching the limit, but it can only run one, which together with the previous 3 makes it total of 4, and then it hits ER_USER_LIMIT_REACHED.

      create user u@localhost with max_queries_per_hour 2;
      --connect (con1,localhost,u,,)
      select 1;
      select 2;
      --error ER_USER_LIMIT_REACHED
      select 3;
      --disconnect con1
      --connection default
      drop user u@localhost;
      create user u@localhost with max_queries_per_hour 4;
      --connect (con1,localhost,u,,)
      select 11;
      select 12;
      select 13;
      select 14;
      --disconnect con1
      --connection default
      drop user u@localhost;
      

      main 22efc2c784e1b7199fb5804e6330168277ea7dce

      mysqltest: At line 13: query 'select 12' failed: ER_USER_LIMIT_REACHED (1226): User 'u' has exceeded the 'max_queries_per_hour' resource (current value: 4)
      

      Attachments

        Issue Links

          Activity

            No workflow transitions have been executed yet.

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.