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 Summary
Modifier and TypeMethodDescriptioncreateIndexReplayTransaction(OpenSearchStagingIssueIndex stagingIssueIndex) Creates a transaction for replaying index operations to the staging index.Creates a new staging index name based on the current timestamp.createStagingIssueIndex(String stagingIndexName) Creates a new staging issue index for the specified staging index name with all components required to read, write and search the new index.voiddeleteOldProdIndex(String prodIndexName, Context context) Deletes the old production index after the new staging index has been successfully created and the alias has been repointed.voiddoIndexIssuesInBatchMode(IssueIndexer stagingIssueIndexer, Context context, IssueIndexingParams issueIndexingParams) Indexes issues in batch mode into the staging index.Retrieves the current production index name.Retrieves the OpenSearch index performance tuner for the current context.voidoptimizeIndex(IssueIndexer issueIndexer, Context context) Optimizes the new staging index after all issues have been indexed and the journal has been synchronized.voidreleaseStagingIssueIndex(OpenSearchStagingIssueIndex stagingIssueIndex) Releases the resources associated with the given staging issue indexer.voidremoveOldStagingIndices(String currentProdIndexName, Context context) Removes old staging indices that are no longer needed by searching the index names that match the staging index pattern.voidrepointingIndexAlias(Context context, String stagingIndexName) Repoints the index alias to the new staging index.
-
Method Details
-
getCurrentProdIndexName
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
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 nullcontext- 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
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
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 performedstagingIndexName- the name of the new staging index to which the alias will be repointed- Throws:
IndexOperationException
-
deleteOldProdIndex
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 deletedcontext- 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 indexcontext- the context in which the operation is performedissueIndexingParams- 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
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 indexcontext- 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
-