Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only provide obsoleteIndexTemplatePattern to the default index migrator to avoid race conditions #42016

Merged
merged 4 commits into from
Jul 25, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,20 @@ export class KibanaMigrator {
await server.plugins.elasticsearch.waitUntilReady();

const config = server.config();
const defaultIndex = config.get('kibana.index');
const indexMap = createIndexMap(
config.get('kibana.index'),
defaultIndex,
this.kbnServer.uiExports.savedObjectSchemas,
this.mappingProperties
);

const migrators = Object.keys(indexMap).map(index => {
let obsoleteIndexTemplatePattern;
// Only necessary for the migrator of the default index.
// This will cause race conditions between migrators otherwise.
if (index === defaultIndex) {
obsoleteIndexTemplatePattern = 'kibana_index_template*';
}
return new IndexMigrator({
batchSize: config.get('migrations.batchSize'),
callCluster: server.plugins.elasticsearch!.getCluster('admin').callWithInternalUser,
Expand All @@ -110,7 +117,7 @@ export class KibanaMigrator {
pollInterval: config.get('migrations.pollInterval'),
scrollDuration: config.get('migrations.scrollDuration'),
serializer: this.serializer,
obsoleteIndexTemplatePattern: 'kibana_index_template*',
obsoleteIndexTemplatePattern,
convertToAliasScript: indexMap[index].script,
});
});
Expand Down