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

Reindexing API misbehaviour causing performance issues: reIndex(issue) reindexing related entities

    XMLWordPrintable

Details

    Description

      Issue Summary

      Misbehaviour of the single issue reindexing API call: triggers issue and all related entities reindex instead of reindexing just the issue.

      Steps to Reproduce

      Jira is exposing a single issue re-index API:

       

      // com.atlassian.jira.issue.index.IssueIndexManager
      /**
       * Reindex an issue (eg. after field updates).
       */
      void reIndex(Issue issue) throws IndexException;
      
      
      // com.atlassian.jira.issue.index.IssueIndexingService
      
      /**
       * Reindex an issue (eg. after field updates).
       */
      void reIndex(final Issue issue) throws IndexException;

       

      According to the javadoc this method should trigger an issue re-index but currently it is also re-indexing all related entities (comments, worklogs):

      • bump issue version
      • bump this issue comments versions
      • bump this issue worklogs versions
      • conditionally update local issue, comments, worklogs index (note that for comments and worklogs this will trigger a conditional index update for every comment/worklog separately)
      • (Jira DC) send the documents (issue, comments, worklogs) via DBR to all other nodes and conditionally update other nodes indexes
      • (Jira DC) add indexing operation (issue, comments, worklogs) to the index replication log
      • (Jira DC) other nodes should process the index replication log and conditionally re-index this issue, comment, version 

      If the issue contains a large amount of related entities this may have serious indexing implication (tens of thousands of index update operations across the cluster instead of a single index update across the cluster). 

      Expected Results

      According to the javadoc this method should trigger an issue re-index only:

      • bump issue version
      • conditionally update local issue index
      • (Jira DC) send the document (issue only) via DBR (with issue only)to all other nodes and conditionally update other nodes indexes
      • (Jira DC) add indexing operation (issue only) to the index replication log
      • (Jira DC) other nodes should process the index replication log and conditionally re-index (issue only)

      Actual Results

      Timeouts on the comments and indexing queues may occur. 

      Workaround

      • Change on the API caller to specifically only re-index the issue:
        // com.atlassian.jira.issue.index.IssueIndexingService
        
        /** 
         * Reindex an issue (eg. after field updates). 
         */ 
        void reIndex(final Issue issue, final IssueIndexingParams issueIndexingParams) throws IndexException;
        
        // where issueIndexingParams = INDEX_ISSUE_ONLY | INDEX_ISSUE_WITH_HISTORY 
      • Archive issue with "large" number of related entities
      • In version 8.16.2, 8.17.1, >=8.18.0 one can set a flag to disable this behaviour:
      -Dcom.atlassian.jira.issue.reindex.legacy.mode=false

      With this flag the single issue re-index API:

      // com.atlassian.jira.issue.index.IssueIndexManager 
      /** 
       * Reindex an issue (eg. after field updates). 
       */ 
      void reIndex(Issue issue) throws IndexException; 
      
      // com.atlassian.jira.issue.index.IssueIndexingService  
      /** 
       * Reindex an issue (eg. after field updates). 
       */ 
      void reIndex(final Issue issue) throws IndexException;
      

      is re-indexing the issue only.

      This should improve the stability of the whole Jira DC cluster. 

      Attachments

        Issue Links

          Activity

            People

              mswinarski Maciej Swinarski
              mswinarski Maciej Swinarski
              Votes:
              1 Vote for this issue
              Watchers:
              24 Start watching this issue

              Dates

                Created:
                Updated: