Skip to content

Commit

Permalink
[saved objects] Remove migrations enableV2 config. (#115655)
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/core/server/saved_objects/migrationsv2/integration_tests/migration_from_older_v1.test.ts
#	src/core/server/saved_objects/migrationsv2/integration_tests/migration_from_same_v1.test.ts
  • Loading branch information
lukeelmers committed Oct 20, 2021
1 parent 6044b8c commit 412e2f9
Show file tree
Hide file tree
Showing 33 changed files with 129 additions and 368 deletions.
3 changes: 0 additions & 3 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,6 @@ override this parameter to use their own Tile Map Service. For example:
| `migrations.maxBatchSizeBytes:`
| Defines the maximum payload size for indexing batches of upgraded saved objects to avoid migrations failing due to a 413 Request Entity Too Large response from Elasticsearch. This value should be lower than or equal to your Elasticsearch cluster's `http.max_content_length` configuration option. *Default: `100mb`*

| `migrations.enableV2:`
| experimental[]. Enables the new Saved Objects migration algorithm. For information about the migration algorithm, refer to <<upgrade-migrations>>. When `migrations v2` is stable, the setting will be removed in an upcoming release without any further notice. Setting the value to `false` causes {kib} to use the legacy migration algorithm, which shipped in 7.11 and earlier versions. *Default: `true`*

| `migrations.retryAttempts:`
| The number of times migrations retry temporary failures, such as a network timeout, 503 status code, or `snapshot_in_progress_exception`. When upgrade migrations frequently fail after exhausting all retry attempts with a message such as `Unable to complete the [...] step after 15 attempts, terminating.`, increase the setting value. *Default: `15`*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { deleteUnknownTypeObjects, getUnknownTypesDeprecations } from './unknown
import { typeRegistryMock } from '../saved_objects_type_registry.mock';
import { elasticsearchClientMock } from '../../elasticsearch/client/mocks';
import type { KibanaConfigType } from '../../kibana_config';
import type { SavedObjectConfig } from '../saved_objects_config';
import { SavedObjectsType } from 'kibana/server';

const createSearchResponse = (count: number): estypes.SearchResponse => {
Expand All @@ -32,7 +31,6 @@ describe('unknown saved object types deprecation', () => {
let typeRegistry: ReturnType<typeof typeRegistryMock.create>;
let esClient: ReturnType<typeof elasticsearchClientMock.createScopedClusterClient>;
let kibanaConfig: KibanaConfigType;
let savedObjectsConfig: SavedObjectConfig;

beforeEach(() => {
typeRegistry = typeRegistryMock.create();
Expand All @@ -48,12 +46,6 @@ describe('unknown saved object types deprecation', () => {
index: '.kibana',
enabled: true,
};

savedObjectsConfig = {
migration: {
enableV2: true,
},
} as SavedObjectConfig;
});

afterEach(() => {
Expand All @@ -69,7 +61,6 @@ describe('unknown saved object types deprecation', () => {

it('calls `esClient.asInternalUser.search` with the correct parameters', async () => {
await getUnknownTypesDeprecations({
savedObjectsConfig,
esClient,
typeRegistry,
kibanaConfig,
Expand All @@ -96,7 +87,6 @@ describe('unknown saved object types deprecation', () => {
);

const deprecations = await getUnknownTypesDeprecations({
savedObjectsConfig,
esClient,
typeRegistry,
kibanaConfig,
Expand All @@ -112,7 +102,6 @@ describe('unknown saved object types deprecation', () => {
);

const deprecations = await getUnknownTypesDeprecations({
savedObjectsConfig,
esClient,
typeRegistry,
kibanaConfig,
Expand Down Expand Up @@ -141,7 +130,6 @@ describe('unknown saved object types deprecation', () => {
describe('deleteUnknownTypeObjects', () => {
it('calls `esClient.asInternalUser.search` with the correct parameters', async () => {
await deleteUnknownTypeObjects({
savedObjectsConfig,
esClient,
typeRegistry,
kibanaConfig,
Expand Down
10 changes: 0 additions & 10 deletions src/core/server/saved_objects/deprecations/unknown_object_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ import { IScopedClusterClient } from '../../elasticsearch';
import { ISavedObjectTypeRegistry } from '../saved_objects_type_registry';
import { SavedObjectsRawDocSource } from '../serialization';
import type { KibanaConfigType } from '../../kibana_config';
import type { SavedObjectConfig } from '../saved_objects_config';
import { getIndexForType } from '../service/lib';

interface UnknownTypesDeprecationOptions {
typeRegistry: ISavedObjectTypeRegistry;
esClient: IScopedClusterClient;
kibanaConfig: KibanaConfigType;
savedObjectsConfig: SavedObjectConfig;
kibanaVersion: string;
}

Expand All @@ -32,11 +30,9 @@ const getTargetIndices = ({
typeRegistry,
kibanaVersion,
kibanaConfig,
savedObjectsConfig,
}: {
types: string[];
typeRegistry: ISavedObjectTypeRegistry;
savedObjectsConfig: SavedObjectConfig;
kibanaConfig: KibanaConfigType;
kibanaVersion: string;
}) => {
Expand All @@ -46,7 +42,6 @@ const getTargetIndices = ({
getIndexForType({
type,
typeRegistry,
migV2Enabled: savedObjectsConfig.migration.enableV2,
kibanaVersion,
defaultIndex: kibanaConfig.index,
})
Expand All @@ -69,7 +64,6 @@ const getUnknownSavedObjects = async ({
typeRegistry,
esClient,
kibanaConfig,
savedObjectsConfig,
kibanaVersion,
}: UnknownTypesDeprecationOptions) => {
const knownTypes = getKnownTypes(typeRegistry);
Expand All @@ -78,7 +72,6 @@ const getUnknownSavedObjects = async ({
typeRegistry,
kibanaConfig,
kibanaVersion,
savedObjectsConfig,
});
const query = getUnknownTypesQuery(knownTypes);

Expand Down Expand Up @@ -141,15 +134,13 @@ interface DeleteUnknownTypesOptions {
typeRegistry: ISavedObjectTypeRegistry;
esClient: IScopedClusterClient;
kibanaConfig: KibanaConfigType;
savedObjectsConfig: SavedObjectConfig;
kibanaVersion: string;
}

export const deleteUnknownTypeObjects = async ({
esClient,
typeRegistry,
kibanaConfig,
savedObjectsConfig,
kibanaVersion,
}: DeleteUnknownTypesOptions) => {
const knownTypes = getKnownTypes(typeRegistry);
Expand All @@ -158,7 +149,6 @@ export const deleteUnknownTypeObjects = async ({
typeRegistry,
kibanaConfig,
kibanaVersion,
savedObjectsConfig,
});
const query = getUnknownTypesQuery(knownTypes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ const createMigrator = (
scrollDuration: '15m',
pollInterval: 1500,
skip: false,
// TODO migrationsV2: remove/deprecate once we remove migrations v1
enableV2: false,
retryAttempts: 10,
},
runMigrations: jest.fn(),
Expand Down
Loading

0 comments on commit 412e2f9

Please sign in to comment.