Interface BlueGreenReindexService

All Known Implementing Classes:
BlueGreenReindexServiceImpl

@Internal public interface BlueGreenReindexService
BlueGreenReindexService is a service that handles reindexing of issues in a blue-green deployment setup. Blue deployment refers to the current production index, while green deployment refers to the staging index being prepared. At the end of the reindexing process, the green index becomes the new production index.
Since:
11.0
  • Method Details

    • getCurrentProdIndexName

      @Nullable String getCurrentProdIndexName() throws IndexOperationException
      Retrieves the current production index name. If the index alias does not exist, it will return null.
      Returns:
      the name of the current production index
      Throws:
      IndexOperationException - if there is an error retrieving the index name
    • removeOldStagingIndices

      void removeOldStagingIndices(@Nullable String currentProdIndexName, Context context)
      Removes old staging indices that are no longer needed by searching the index names that match the staging index pattern. Provide the current production index name to avoid removing it.
      Parameters:
      currentProdIndexName - the name of the current production index, can be null
      context - the context in which the operation is performed
    • createStagingIndexName

      String createStagingIndexName()
      Creates a new staging index name based on the current timestamp. The format is "issues-atlas-YYYYMMDDHHmmSS".
      Returns:
      the name of the new staging index
    • createStagingIssueIndex

      OpenSearchStagingIssueIndex createStagingIssueIndex(String stagingIndexName) throws IndexOperationException
      Creates a new staging issue index for the specified staging index name with all components required to read, write and search the new index.
      Parameters:
      stagingIndexName - the name of the staging index
      Returns:
      an instance of OpenSearchStagingIssueIndex for the staging index
      Throws:
      IndexOperationException - if there is an error creating the index
    • releaseStagingIssueIndex

      void releaseStagingIssueIndex(OpenSearchStagingIssueIndex stagingIssueIndex)
      Releases the resources associated with the given staging issue indexer. This method should be called after the indexing process is complete to free up resources.
      Parameters:
      stagingIssueIndex - the staging issue indexer to be released
    • repointingIndexAlias

      void repointingIndexAlias(Context context, String stagingIndexName) throws IndexOperationException
      Repoints the index alias to the new staging index. This operation updates the alias to point to the new staging index, making it the current production index.
      Parameters:
      context - the context in which the operation is performed
      stagingIndexName - the name of the new staging index to which the alias will be repointed
      Throws:
      IndexOperationException
    • deleteOldProdIndex

      void deleteOldProdIndex(String prodIndexName, Context context)
      Deletes the old production index after the new staging index has been successfully created and the alias has been repointed.
      Parameters:
      prodIndexName - the name of the old production index to be deleted
      context - the context in which the operation is performed
    • doIndexIssuesInBatchMode

      void doIndexIssuesInBatchMode(IssueIndexer stagingIssueIndexer, Context context, IssueIndexingParams issueIndexingParams) throws IndexOperationException
      Indexes issues in batch mode into the staging index. This method is responsible for indexing issues in batches to optimize performance during the reindexing process.
      Parameters:
      stagingIssueIndexer - the issue indexer for the staging index
      context - the context in which the operation is performed
      issueIndexingParams - parameters for indexing issues
      Throws:
      IndexOperationException
    • createIndexReplayTransaction

      IndexReplayStrategy.Transaction createIndexReplayTransaction(OpenSearchStagingIssueIndex stagingIssueIndex)
      Creates a transaction for replaying index operations to the staging index.
      Parameters:
      stagingIssueIndex - the staging issue index for which the transaction is created
      Returns:
      an instance of IndexReplayStrategy.Transaction that can be used to manage the replay process
    • optimizeIndex

      void optimizeIndex(IssueIndexer issueIndexer, Context context) throws IndexOperationException
      Optimizes the new staging index after all issues have been indexed and the journal has been synchronized. This method is responsible for performing any necessary optimizations to ensure the index is ready for production use.
      Parameters:
      issueIndexer - the issue indexer for the staging index
      context - the context in which the operation is performed
      Throws:
      IndexOperationException - if there is an error during the optimization process
    • getOpenSearchIndexPerformanceTuner

      OpenSearchIndexPerformanceTuner getOpenSearchIndexPerformanceTuner()
      Retrieves the OpenSearch index performance tuner for the current context. This tuner is used to adjust index settings for optimal performance during reindexing operations.
      Returns:
      an instance of OpenSearchIndexPerformanceTuner