-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Migrations: Don't auto-create temp index #158182
Changes from all commits
ef4aa10
1314315
2c57bc0
2cf38ce
e40d63f
1108baa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,6 +139,7 @@ export const nextActionMap = ( | |
Actions.createIndex({ | ||
client, | ||
indexName: state.tempIndex, | ||
aliases: [state.tempIndexAlias], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the alias automatically deleted when we associated index is removed (asking before the PR apparently doesn't add logic to delete the alias when the temp index is delete)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, aliases are "attached" to an index. |
||
mappings: state.tempIndexMappings, | ||
}), | ||
READY_TO_REINDEX_SYNC: () => Actions.synchronizeMigrators(readyToReindex), | ||
|
@@ -163,7 +164,13 @@ export const nextActionMap = ( | |
REINDEX_SOURCE_TO_TEMP_INDEX_BULK: (state: ReindexSourceToTempIndexBulk) => | ||
Actions.bulkOverwriteTransformedDocuments({ | ||
client, | ||
index: state.tempIndex, | ||
/* | ||
* Since other nodes can delete the temp index while we're busy writing | ||
* to it, we use the alias to prevent the auto-creation of the index if | ||
* it doesn't exist. | ||
*/ | ||
index: state.tempIndexAlias, | ||
useAliasToPreventAutoCreate: true, | ||
operations: state.bulkOperationBatches[state.currentBatch], | ||
/** | ||
* Since we don't run a search against the target index, we disable "refresh" to speed up | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,10 +132,16 @@ export interface BaseState extends ControlState { | |
*/ | ||
readonly versionIndex: string; | ||
/** | ||
* An alias on the target index used as part of an "reindex block" that | ||
* A temporary index used as part of an "reindex block" that | ||
* prevents lost deletes e.g. `.kibana_7.11.0_reindex`. | ||
*/ | ||
readonly tempIndex: string; | ||
/** | ||
* An alias to the tempIndex used to prevent ES from auto-creating the temp | ||
* index if one node deletes it while another writes to it | ||
* e.g. `.kibana_7.11.0_reindex_temp_alias`. | ||
*/ | ||
readonly tempIndexAlias: string; | ||
Comment on lines
+139
to
+144
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still amazed this is the 'only' way to prevent automatic index creation... |
||
/** | ||
* When upgrading to a more recent kibana version, some saved object types | ||
* might be conflicting or no longer used. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: personal opinion, but given it's a 1-1 mapping to an ES option and it's only used internally, I would have just called this
requireAlias
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I was going back and forth... this
requireAlias
"hack" / workaround / trick is so weird that it felt like I need to explain it because we don't actually care about using an alias...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I would have gone with the actual option name + your tsdoc to explain why it should be used, but I'm fine with both