Class BlueGreenReindexServiceImpl
java.lang.Object
com.atlassian.jira.search.opensearch.BlueGreenReindexServiceImpl
- All Implemented Interfaces:
BlueGreenReindexService
Implementation of the BlueGreenReindexService that handles the reindexing process in a blue-green deployment setup.
This service manages the creation of staging indices, repointing aliases, and cleaning up old indices.
- Since:
- 11.0
-
Constructor Summary
ConstructorsConstructorDescriptionBlueGreenReindexServiceImpl(OpenSearchStagingIssueIndexFactory stagingIndexFactory, IndexReplayStrategyFactory rioStrategyFactory, FeatureManager featureManager, ArchivingLicenseCheck archivingLicenseCheck, org.opensearch.client.opensearch.OpenSearchClient openSearchClient, io.github.resilience4j.retry.RetryRegistry retryRegistry, OpenSearchConfigManager openSearchConfigManager) -
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.voidrepointingIndexAlias(Context context, String stagingIndexName) Repoints the index alias to the new staging index.
-
Constructor Details
-
BlueGreenReindexServiceImpl
public BlueGreenReindexServiceImpl(OpenSearchStagingIssueIndexFactory stagingIndexFactory, IndexReplayStrategyFactory rioStrategyFactory, FeatureManager featureManager, ArchivingLicenseCheck archivingLicenseCheck, org.opensearch.client.opensearch.OpenSearchClient openSearchClient, io.github.resilience4j.retry.RetryRegistry retryRegistry, OpenSearchConfigManager openSearchConfigManager)
-
-
Method Details
-
getCurrentProdIndexName
Description copied from interface:BlueGreenReindexServiceRetrieves the current production index name. If the index alias does not exist, it will return null.- Specified by:
getCurrentProdIndexNamein interfaceBlueGreenReindexService- Returns:
- the name of the current production index
- Throws:
IndexOperationException- if there is an error retrieving the index name
-
createStagingIssueIndex
public OpenSearchStagingIssueIndex createStagingIssueIndex(String stagingIndexName) throws IndexOperationException Description copied from interface:BlueGreenReindexServiceCreates a new staging issue index for the specified staging index name with all components required to read, write and search the new index.- Specified by:
createStagingIssueIndexin interfaceBlueGreenReindexService- 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
Description copied from interface:BlueGreenReindexServiceReleases the resources associated with the given staging issue indexer. This method should be called after the indexing process is complete to free up resources.- Specified by:
releaseStagingIssueIndexin interfaceBlueGreenReindexService- Parameters:
stagingIssueIndex- the staging issue indexer to be released
-
repointingIndexAlias
public void repointingIndexAlias(Context context, String stagingIndexName) throws IndexOperationException Description copied from interface:BlueGreenReindexServiceRepoints 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.- Specified by:
repointingIndexAliasin interfaceBlueGreenReindexService- 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
Description copied from interface:BlueGreenReindexServiceDeletes the old production index after the new staging index has been successfully created and the alias has been repointed.- Specified by:
deleteOldProdIndexin interfaceBlueGreenReindexService- Parameters:
prodIndexName- the name of the old production index to be deletedcontext- the context in which the operation is performed
-
doIndexIssuesInBatchMode
public void doIndexIssuesInBatchMode(IssueIndexer stagingIssueIndexer, Context context, IssueIndexingParams issueIndexingParams) Description copied from interface:BlueGreenReindexServiceIndexes issues in batch mode into the staging index. This method is responsible for indexing issues in batches to optimize performance during the reindexing process.- Specified by:
doIndexIssuesInBatchModein interfaceBlueGreenReindexService- Parameters:
stagingIssueIndexer- the issue indexer for the staging indexcontext- the context in which the operation is performedissueIndexingParams- parameters for indexing issues
-
createStagingIndexName
Description copied from interface:BlueGreenReindexServiceCreates a new staging index name based on the current timestamp. The format is "issues-atlas-YYYYMMDDHHmmSS".- Specified by:
createStagingIndexNamein interfaceBlueGreenReindexService- Returns:
- the name of the new staging index
-
optimizeIndex
Description copied from interface:BlueGreenReindexServiceOptimizes 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.- Specified by:
optimizeIndexin interfaceBlueGreenReindexService- Parameters:
issueIndexer- the issue indexer for the staging indexcontext- the context in which the operation is performed
-
getOpenSearchIndexPerformanceTuner
Description copied from interface:BlueGreenReindexServiceRetrieves the OpenSearch index performance tuner for the current context. This tuner is used to adjust index settings for optimal performance during reindexing operations.- Specified by:
getOpenSearchIndexPerformanceTunerin interfaceBlueGreenReindexService- Returns:
- an instance of OpenSearchIndexPerformanceTuner
-
createIndexReplayTransaction
public IndexReplayStrategy.Transaction createIndexReplayTransaction(OpenSearchStagingIssueIndex stagingIssueIndex) Description copied from interface:BlueGreenReindexServiceCreates a transaction for replaying index operations to the staging index.- Specified by:
createIndexReplayTransactionin interfaceBlueGreenReindexService- 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
-