Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-61518

Too many requests for Featured Topics in Questions for Confluence plugin when there are no featured topics

      Issue Summary

      In Questions for Confluence plugin Cache Featured Topic Repository cache is used to keep ids of all featured topics. We perform one request to DB to retrieve all existing featured topics and put them all into this cache. In our current implementation when we want to check whether topic is a featured one we take all keys from this cache and then search through them, we don't use this cache to search for each individual topic id. In cases when there is no featured topics in Confluence we don't know whether there is no featured topics in the system or we haven't tried to populate this cache before. In this case we perform huge amount of identical queries to retrieve featured topics from db.

      Steps to Reproduce

      1. Install Questions for Confluence plugin
      2. Create few topics (but don't mark them as Featured, there should be no Featured topics in system)
      3. Create few questions and attach topics to them
      4. Create page and put Questions plugin on it. Publish this page
      5. Enable logging in DB.
      6. Reload page and check sql logs - there will be many requests to db which look like this one:
        select "label"."labelid" from "label" "label" inner join "content_label" "content_label" on "content_label"."labelid" = "label"."labelid" inner join "content" "content" on "content_label"."contentid" = "content"."contentid" left join "contentproperties" "contentproperties" on "content"."contentid" = "contentproperties"."contentid" where "content"."contenttype" = 'CUSTOM' and "content"."content_status" = 'current' and "content"."prevver" is null and "content"."pluginkey" = 'com.atlassian.confluence.plugins.confluence-questions:topic-metadata' and "contentproperties"."propertyname" = 'featured' and "contentproperties"."longval" = 1 order by "label"."name" asc;
        

      Expected Results

      This db query is performed only once and results saved to Cache Featured Topic Repository cache. When next request for this data come it should take information from cache (information that there is no featured topics).

      Actual Results

      Nothing is added to cache and we perform same query each time.

      Workaround

      Create at least one featured topic. It will be added to cache and system will not go to db each time.

          Form Name

            [CONFSERVER-61518] Too many requests for Featured Topics in Questions for Confluence plugin when there are no featured topics

            Irina Tiapchenko added a comment - - edited

            Fixed in Confluence Questions 2.7.30

            Irina Tiapchenko added a comment - - edited Fixed in Confluence Questions 2.7.30

              03cb0c04aa4f Irina Tiapchenko
              03cb0c04aa4f Irina Tiapchenko
              Affected customers:
              4 This affects my team
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: