Uploaded image for project: 'Jira Server and Data Center'
  1. Jira Server and Data Center
  2. JRASERVER-40161

Add work log queries whole issue history causing performance hit on issues with large change history

    XMLWordPrintable

    Details

      Description

      NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      Hello JIRA,

      This is issue is a continuation of JRA-31581

      I started my old test server with JIRA 6.3.6 and found a relatively large issue (25.000 entries in the change history), turned on the SQL log and tried to log work with the REST API like this:

      jQuery.ajax({url:"/rest/api/2/issue/SAG-1/worklog", contentType:"application/json", data: JSON.stringify({"author": {"name": "bjarnit"},"timeSpent": "3h 20m"}), type:"POST", async:false});
      

      Tailing the SQL log it was fairly obvious that this query took the longest (6041ms):

      2014-09-25 10:57:10,850 http-bio-8627-exec-25 bjarnit 657x12163x1 ekpy0w /rest/api/2/issue/SAG-1/worklog 6041ms "SELECT CG.ID, CG.issueid, CG.AUTHOR, CG.CREATED, CI.ID, CI.groupid, CI.FIELDTYPE, CI.FIELD, CI.OLDVALUE, CI.OLDSTRING, CI.NEWVALUE, CI.NEWSTRING FROM public.changegroup CG INNER JOIN public.changeitem CI ON CG.ID = CI.groupid WHERE CG.issueid='47878' ORDER BY CG.CREATED ASC, CI.ID ASC"
      

      Looks like JIRA is querying the whole changelog upon every new worklog creation!

      I also tried this on plain vanilla JIRA (atlas-run-standalone with just the DEMO project installed) and I see that the same query is executed then which means that it is JIRA itself and no plugin that is querying and sorting the whole changelog for every new add.

      Please let me know if you need any more information.

      Best regards,

      -Bjarni

      P.S. I have JIRA agile (latest version, 6.6.0) on my test and I see that Agile is investigating the changelog as well. Better filter but it all adds up:

      2014-09-25 10:57:11,576 http-bio-8627-exec-25 bjarnit 657x12163x1 ekpy0w /rest/api/2/issue/SAG-1/worklog 403ms "SELECT CG.ID, CG.issueid, CG.AUTHOR, CG.CREATED, CI.ID, CI.groupid, CI.FIELDTYPE, CI.FIELD, CI.OLDVALUE, CI.OLDSTRING, CI.NEWVALUE, CI.NEWSTRING FROM public.changegroup CG INNER JOIN public.changeitem CI ON CG.ID = CI.groupid WHERE CG.issueid='47878' AND CI.FIELD='Sprint' ORDER BY CG.CREATED ASC, CI.ID ASC"
      
      2014-09-25 10:57:12,349 http-bio-8627-exec-25 bjarnit 657x12163x1 ekpy0w /rest/api/2/issue/SAG-1/worklog 430ms "SELECT CG.ID, CG.issueid, CG.AUTHOR, CG.CREATED, CI.ID, CI.groupid, CI.FIELDTYPE, CI.FIELD, CI.OLDVALUE, CI.OLDSTRING, CI.NEWVALUE, CI.NEWSTRING FROM public.changegroup CG INNER JOIN public.changeitem CI ON CG.ID = CI.groupid WHERE CG.issueid='47878' AND CI.FIELD='Epic Link' ORDER BY CG.CREATED ASC, CI.ID ASC"
      

        Attachments

        1. jira-6.3.6.log
          271 kB
        2. jira-6.4.1.log
          58 kB

          Issue Links

            Activity

              People

              Assignee:
              kkercz Krzysztof Kercz
              Reporter:
              bjarnit2 Bjarni Thorbjornsson
              Votes:
              17 Vote for this issue
              Watchers:
              40 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: