From 838b16eda53e00c2e310ded6ea086b46a84ce757 Mon Sep 17 00:00:00 2001 From: jasper Date: Fri, 4 Nov 2016 20:07:31 -0400 Subject: [PATCH] Allow patch level mismatch between Kibana and Elasticsearch (#8980) Backports PR #8976 **Commit 1:** Allow patch level mismatch between Kibana and Elasticsearch Kibana should be able to run against Elasticsearch nodes that are at the same minor version regardless of whether they are at the same patch version. In the event that their patch versions differ, we render a warning. * Original sha: 79ea67f4c987a42e3f34c0620bd6683e5a55f202 * Authored by Court Ewing on 2016-11-04T21:28:46Z --- README.md | 2 +- .../lib/__tests__/is_es_compatible_with_kibana.js | 8 ++++---- .../elasticsearch/lib/check_es_version.js | 13 ++++++------- .../lib/is_es_compatible_with_kibana.js | 5 ----- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 3ca34e1328c7b..06b824db25acf 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ _Note: The version numbers below are only examples, meant to illustrate the rela | ES patch number is newer. | 5.1.__2__ | 5.1.__5__ | ⚠️ Logged warning | | ES minor number is newer. | 5.__1__.2 | 5.__5__.0 | ⚠️ Logged warning | | ES major number is newer. | __5__.1.2 | __6__.0.0 | 🚫 Fatal error | -| ES patch number is older. | 5.1.__2__ | 5.1.__0__ | 🚫 Fatal error | +| ES patch number is older. | 5.1.__2__ | 5.1.__0__ | ⚠️ Logged warning | | ES minor number is older. | 5.__1__.2 | 5.__0__.0 | 🚫 Fatal error | | ES major number is older. | __5__.1.2 | __4__.0.0 | 🚫 Fatal error | diff --git a/src/core_plugins/elasticsearch/lib/__tests__/is_es_compatible_with_kibana.js b/src/core_plugins/elasticsearch/lib/__tests__/is_es_compatible_with_kibana.js index 6445f3245168b..d8b76e14d7d45 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/is_es_compatible_with_kibana.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/is_es_compatible_with_kibana.js @@ -17,10 +17,6 @@ describe('plugins/elasticsearch', () => { it('when majors are equal, but ES minor is less than Kibana minor', () => { expect(isEsCompatibleWithKibana('1.0.0', '1.1.0')).to.be(false); }); - - it('when majors and minors are equal, but ES patch is less than Kibana patch', () => { - expect(isEsCompatibleWithKibana('1.1.0', '1.1.1')).to.be(false); - }); }); describe('returns true', () => { @@ -35,6 +31,10 @@ describe('plugins/elasticsearch', () => { it('when majors and minors are equal, and ES patch is greater than Kibana patch', () => { expect(isEsCompatibleWithKibana('1.1.1', '1.1.0')).to.be(true); }); + + it('when majors and minors are equal, but ES patch is less than Kibana patch', () => { + expect(isEsCompatibleWithKibana('1.1.0', '1.1.1')).to.be(true); + }); }); }); }); diff --git a/src/core_plugins/elasticsearch/lib/check_es_version.js b/src/core_plugins/elasticsearch/lib/check_es_version.js index a8d4ce5e7c0ad..d329f7de6f283 100644 --- a/src/core_plugins/elasticsearch/lib/check_es_version.js +++ b/src/core_plugins/elasticsearch/lib/check_es_version.js @@ -5,7 +5,6 @@ import _ from 'lodash'; import esBool from './es_bool'; -import semver from 'semver'; import isEsCompatibleWithKibana from './is_es_compatible_with_kibana'; import SetupError from './setup_error'; @@ -38,9 +37,9 @@ module.exports = function checkEsVersion(server, kibanaVersion) { return incompatibleNodes.push(esNode); } - // It's acceptable if ES is ahead of Kibana, but we want to prompt users to upgrade Kibana - // to match it. - if (semver.gt(esNode.version, kibanaVersion)) { + // It's acceptable if ES and Kibana versions are not the same so long as + // they are not incompatible, but we should warn about it + if (esNode.version !== kibanaVersion) { warningNodes.push(esNode); } }); @@ -66,9 +65,9 @@ module.exports = function checkEsVersion(server, kibanaVersion) { lastWarnedNodesForServer.set(server, warningNodeNames); server.log(['warning'], { tmpl: ( - `You're running Kibana ${kibanaVersion} with some newer versions of ` + - 'Elasticsearch. Update Kibana to the latest version to prevent compatibility issues: ' + - warningNodeNames + `You're running Kibana ${kibanaVersion} with some different versions of ` + + 'Elasticsearch. Update Kibana or Elasticsearch to the same ' + + `version to prevent compatibility issues: ${warningNodeNames}` ), kibanaVersion, nodes: simplifiedNodes, diff --git a/src/core_plugins/elasticsearch/lib/is_es_compatible_with_kibana.js b/src/core_plugins/elasticsearch/lib/is_es_compatible_with_kibana.js index 21bec63869e5a..954e25033ee00 100644 --- a/src/core_plugins/elasticsearch/lib/is_es_compatible_with_kibana.js +++ b/src/core_plugins/elasticsearch/lib/is_es_compatible_with_kibana.js @@ -29,10 +29,5 @@ export default function isEsCompatibleWithKibana(esVersion, kibanaVersion) { return false; } - // Reject older patch versions of ES. - if (esVersionNumbers.patch < kibanaVersionNumbers.patch) { - return false; - } - return true; }