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

LP:1021131 - dynamic setting query_cache_type but keeping the benefit of keeping away of overhead LOCK if query cache type is 0

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      As we know, query_cache overhead for LOCK can only be avoided when start-up mysql with query_cache_type is 0. That's what Percona contributed: http://www.percona.com/doc/percona-server/5.5/performance/query_cache_enhance.html?id=percona-server:features:query_cache_enhance#disabling_the_cache_completely

      That's a nice work. However, if we want the query cache back, the mysqld must be restarted with query_cache_type=1. That's the problem, and some customers faced the scenarios.

      I looked into the code, and found it might be resolved without the limitation of restarted mysqld. If we call is_disabled with a traced query_cache_type and combined with current setting query_cache_type, it's Okay to judge whether we could get the same result as old is_disabled function in Query_cache class.

      Detail info could refer to qc.patch, which is based on Percona-5.5.18

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            hickey Hickey added a comment -

            Re: dynamic setting query_cache_type but keeping the benefit of keeping away of overhead LOCK if query cache type is 0
            Unpatched Percona could not dynamic swtith from OFF to ON, but MariaDB would, that's what you mentioned, and MariaDB got the same result for :
            ./mtr -record --mysqld="-query_cache_type=ON" t/qc.test
            ./mtr -record --mysqld="-query_cache_type=OFF" t/qc.test
            Both warnings would be shown in error log.

            Show
            hickey Hickey added a comment - Re: dynamic setting query_cache_type but keeping the benefit of keeping away of overhead LOCK if query cache type is 0 Unpatched Percona could not dynamic swtith from OFF to ON, but MariaDB would, that's what you mentioned, and MariaDB got the same result for : ./mtr - record --mysqld=" -query_cache_type=ON" t/qc.test ./mtr - record --mysqld=" -query_cache_type=OFF" t/qc.test Both warnings would be shown in error log.
            Hide
            sanja Oleksandr Byelkin added a comment -

            Re: dynamic setting query_cache_type but keeping the benefit of keeping away of overhead LOCK if query cache type is 0
            I enabled logging of locking in Query cache and checked that the lock taken only when QC is ON, when QC is off MariaDB do not try to take lock.

            Show
            sanja Oleksandr Byelkin added a comment - Re: dynamic setting query_cache_type but keeping the benefit of keeping away of overhead LOCK if query cache type is 0 I enabled logging of locking in Query cache and checked that the lock taken only when QC is ON, when QC is off MariaDB do not try to take lock.
            Hide
            hickey Hickey added a comment -

            Re: dynamic setting query_cache_type but keeping the benefit of keeping away of overhead LOCK if query cache type is 0
            Yes, I walked through the code of QC in MariaDB-5.5.25, it has fixed this issue with a more smart idea. Nice work, Sanja.

            Show
            hickey Hickey added a comment - Re: dynamic setting query_cache_type but keeping the benefit of keeping away of overhead LOCK if query cache type is 0 Yes, I walked through the code of QC in MariaDB-5.5.25, it has fixed this issue with a more smart idea. Nice work, Sanja.
            Hide
            ratzpo Rasmus Johansson added a comment -

            Re: dynamic setting query_cache_type but keeping the benefit of keeping away of overhead LOCK if query cache type is 0
            Tested with MariaDB 5.5 and works as expected.

            I noticed that there is a tracking variable used: m_requests_in_progress which is to make sure that disabling/enabling is not done while queries are in-flight within the query cache critical section.

            I see that the enabling the a disabled query cache can fail only when

            a) query cache disabling is in progress or
            b) global query cache is disabled but session query_cache_type is tried.

            Show
            ratzpo Rasmus Johansson added a comment - Re: dynamic setting query_cache_type but keeping the benefit of keeping away of overhead LOCK if query cache type is 0 Tested with MariaDB 5.5 and works as expected. I noticed that there is a tracking variable used: m_requests_in_progress which is to make sure that disabling/enabling is not done while queries are in-flight within the query cache critical section. I see that the enabling the a disabled query cache can fail only when a) query cache disabling is in progress or b) global query cache is disabled but session query_cache_type is tried.
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 1021131

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 1021131

              People

              • Assignee:
                sanja Oleksandr Byelkin
                Reporter:
                hickey Hickey
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: