From 0244c9498ae0a1f1d66124578ef614d326bfbc88 Mon Sep 17 00:00:00 2001 From: Patrick Mueller Date: Wed, 9 Dec 2020 14:44:10 -0500 Subject: [PATCH] [task manager] provide warning when setting max_workers greater than limit resolves https://github.com/elastic/kibana/issues/56573 In this PR we create a new task manager limit on the config property `xpack.task_manager.max_workers` of 100, but only log a deprecation warning if that property exceeds the limit. We'll enforce the limit in 8.0. The rationale is that it's unlikely going to be useful to run with more than some number of workers, due to the amount of simultaneous work that would end up happening. In practice, too many workers can slow things down more than speed them up. We're setting the limit to 100 for now, but may increase / decrease it based on further research. --- x-pack/plugins/task_manager/server/config.ts | 1 + x-pack/plugins/task_manager/server/index.test.ts | 9 +++++++++ x-pack/plugins/task_manager/server/index.ts | 7 ++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/task_manager/server/config.ts b/x-pack/plugins/task_manager/server/config.ts index 157f01281836d..5f13193332ab5 100644 --- a/x-pack/plugins/task_manager/server/config.ts +++ b/x-pack/plugins/task_manager/server/config.ts @@ -6,6 +6,7 @@ import { schema, TypeOf } from '@kbn/config-schema'; +export const MAX_MAX_WORKERS = 100; export const DEFAULT_MAX_WORKERS = 10; export const DEFAULT_POLL_INTERVAL = 3000; export const DEFAULT_MAX_POLL_INACTIVITY_CYCLES = 10; diff --git a/x-pack/plugins/task_manager/server/index.test.ts b/x-pack/plugins/task_manager/server/index.test.ts index 3f25f4403d358..873950f229147 100644 --- a/x-pack/plugins/task_manager/server/index.test.ts +++ b/x-pack/plugins/task_manager/server/index.test.ts @@ -40,4 +40,13 @@ describe('deprecations', () => { `); }); }); + + it('logs a warning if max_workers is over limit', () => { + const { messages } = applyTaskManagerDeprecations({ max_workers: 1000 }); + expect(messages).toMatchInlineSnapshot(` + Array [ + "setting \\"xpack.task_manager.max_workers\\" (1000) greater than 100 is deprecated. Values greater than 100 will not be supported starting in 8.0.", + ] + `); + }); }); diff --git a/x-pack/plugins/task_manager/server/index.ts b/x-pack/plugins/task_manager/server/index.ts index 8f96e10430b39..f6fee68269cfb 100644 --- a/x-pack/plugins/task_manager/server/index.ts +++ b/x-pack/plugins/task_manager/server/index.ts @@ -7,7 +7,7 @@ import { get } from 'lodash'; import { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server'; import { TaskManagerPlugin } from './plugin'; -import { configSchema, TaskManagerConfig } from './config'; +import { configSchema, TaskManagerConfig, MAX_MAX_WORKERS } from './config'; export const plugin = (initContext: PluginInitializerContext) => new TaskManagerPlugin(initContext); @@ -37,6 +37,11 @@ export const config: PluginConfigDescriptor = { `"${fromPath}.index" is deprecated. Multitenancy by changing "kibana.index" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details` ); } + if (taskManager?.max_workers > MAX_MAX_WORKERS) { + log( + `setting "${fromPath}.max_workers" (${taskManager?.max_workers}) greater than ${MAX_MAX_WORKERS} is deprecated. Values greater than ${MAX_MAX_WORKERS} will not be supported starting in 8.0.` + ); + } return settings; }, ],