Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 1 addition & 4 deletions docs/setup/upgrade/resolving-migration-failures.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ If you fail to remedy this, your upgrade to 8.0+ will fail with a message like:

[source,sh]
--------------------------------------------
Unable to complete saved object migrations for the [.kibana] index: Migration failed because some documents were found which use unknown saved object types:
- "firstDocId" (type "someType")
- "secondtDocId" (type "someType")
- "thirdDocId" (type "someOtherType")
Unable to complete saved object migrations for the [.kibana] index: Migration failed because some documents were found which use unknown saved object types: someType,someOtherType

To proceed with the migration you can configure Kibana to discard unknown saved objects for this migration.
--------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ describe('extractUnknownDocFailureReason', () => {
},
])
).toMatchInlineSnapshot(`
"Migration failed because some documents were found which use unknown saved object types:
- \\"unknownType:12\\" (type: \\"unknownType\\")
- \\"anotherUnknownType:42\\" (type: \\"anotherUnknownType\\")

"Migration failed because some documents were found which use unknown saved object types: unknownType,anotherUnknownType
To proceed with the migration you can configure Kibana to discard unknown saved objects for this migration.
Please refer to some-url.co for more information."
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ export function extractUnknownDocFailureReason(
resolveMigrationFailuresUrl: string,
unknownDocs: DocumentIdAndType[]
): string {
const typesSet = new Set(unknownDocs.map(({ type }) => type));
return (
`Migration failed because some documents were found which use unknown saved object types:\n` +
unknownDocs.map((doc) => `- "${doc.id}" (type: "${doc.type}")\n`).join('') +
`\nTo proceed with the migration you can configure Kibana to discard unknown saved objects for this migration.\n` +
`Migration failed because some documents were found which use unknown saved object types: ${Array.from(
typesSet.values()
)}\n` +
`To proceed with the migration you can configure Kibana to discard unknown saved objects for this migration.\n` +
`Please refer to ${resolveMigrationFailuresUrl} for more information.`
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,13 +559,21 @@ export const model = (currentState: State, resW: ResponseType<AllActionStates>):
deleteByQueryTaskId: res.right.taskId,
};
} else {
const reason = extractUnknownDocFailureReason(
stateP.migrationDocLinks.resolveMigrationFailures,
res.left.unknownDocs
);
return {
...stateP,
controlState: 'FATAL',
reason: extractUnknownDocFailureReason(
stateP.migrationDocLinks.resolveMigrationFailures,
res.left.unknownDocs
),
reason,
logs: [
...logs,
{
level: 'error',
message: reason,
},
],
};
}
} else if (stateP.controlState === 'CLEANUP_UNKNOWN_AND_EXCLUDED_WAIT_FOR_TASK') {
Expand Down Expand Up @@ -700,13 +708,22 @@ export const model = (currentState: State, resW: ResponseType<AllActionStates>):

if (isTypeof(res.right, 'unknown_docs_found')) {
if (!stateP.discardUnknownObjects) {
const reason = extractUnknownDocFailureReason(
stateP.migrationDocLinks.resolveMigrationFailures,
res.right.unknownDocs
);

return {
...stateP,
controlState: 'FATAL',
reason: extractUnknownDocFailureReason(
stateP.migrationDocLinks.resolveMigrationFailures,
res.right.unknownDocs
),
reason,
logs: [
...logs,
{
level: 'error',
message: reason,
},
],
};
}

Expand Down Expand Up @@ -879,6 +896,13 @@ export const model = (currentState: State, resW: ResponseType<AllActionStates>):
corruptDocumentIds: [],
transformErrors: [],
progress: createInitialProgress(),
logs: [
...logs,
{
level: 'info',
message: `REINDEX_SOURCE_TO_TEMP_OPEN_PIT PitId:${res.right.pitId}`,
},
],
};
} else {
throwBadResponse(stateP, res);
Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-test/src/es/test_es_cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface CreateTestEsClusterOptions {
* `['key.1=val1', 'key.2=val2']`
*/
esArgs?: string[];
esVersion?: string;
esFrom?: string;
esServerlessOptions?: Pick<
ServerlessOptions,
Expand Down Expand Up @@ -169,6 +170,7 @@ export function createTestEsCluster<
log,
writeLogsToPath,
basePath = Path.resolve(REPO_ROOT, '.es'),
esVersion = esTestConfig.getVersion(),
esFrom = esTestConfig.getBuildFrom(),
esServerlessOptions,
dataArchive,
Expand Down Expand Up @@ -196,7 +198,7 @@ export function createTestEsCluster<
const esArgs = assignArgs(defaultEsArgs, customEsArgs);

const config = {
version: esTestConfig.getVersion(),
version: esVersion,
installPath: Path.resolve(basePath, clusterName),
sourcePath: Path.resolve(REPO_ROOT, '../elasticsearch'),
password,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Loading