Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A7E2018BDC for ; Wed, 13 May 2015 09:45:09 +0000 (UTC) Received: (qmail 75444 invoked by uid 500); 13 May 2015 09:45:09 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 75419 invoked by uid 500); 13 May 2015 09:45:09 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 75410 invoked by uid 99); 13 May 2015 09:45:09 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2015 09:45:09 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4F878E0F7D; Wed, 13 May 2015 09:45:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: onechiporenko@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-11066. ACID Transactions override issue (onechiporenko) Date: Wed, 13 May 2015 09:45:09 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/trunk 090d8b532 -> 1aa1ad292 AMBARI-11066. ACID Transactions override issue (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1aa1ad29 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1aa1ad29 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1aa1ad29 Branch: refs/heads/trunk Commit: 1aa1ad2927987a37685f1a11660ea0443794f292 Parents: 090d8b5 Author: Oleg Nechiporenko Authored: Tue May 12 17:51:58 2015 +0300 Committer: Oleg Nechiporenko Committed: Wed May 13 12:44:44 2015 +0300 ---------------------------------------------------------------------- .../services/HIVE/configuration/hive-env.xml | 2 +- .../stacks/HDP/2.2/services/stack_advisor.py | 2 +- .../stacks/HDPWIN/2.2/services/stack_advisor.py | 2 +- .../stacks/2.2/common/test_stack_advisor.py | 2 +- .../configs/objects/service_config_property.js | 62 ++++++----- .../objects/service_config_property_test.js | 103 +++++++++++++++++++ .../widgets/list_config_widget_view_test.js | 1 + 7 files changed, 147 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1aa1ad29/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-env.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-env.xml index ce60563..f542bda 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-env.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-env.xml @@ -90,7 +90,7 @@ export METASTORE_PORT={{hive_metastore_port}} hive_txn_acid ACID Transactions - Off + off value-list http://git-wip-us.apache.org/repos/asf/ambari/blob/1aa1ad29/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py index 5a49fda..4366def 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py @@ -248,7 +248,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor): putHiveSiteProperty("hive.vectorized.execution.reduce.enabled", "false") # Transactions - putHiveEnvProperty("hive_txn_acid", "Off") + putHiveEnvProperty("hive_txn_acid", "off") if str(configurations["hive-env"]["properties"]["hive_txn_acid"]).lower() == "on": putHiveSiteProperty("hive.txn.manager", "org.apache.hadoop.hive.ql.lockmgr.DbTxnManager") putHiveSiteProperty("hive.support.concurrency", "true") http://git-wip-us.apache.org/repos/asf/ambari/blob/1aa1ad29/ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/stack_advisor.py index 357f544..0bad45a 100644 --- a/ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/stack_advisor.py @@ -218,7 +218,7 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor): putHiveSiteProperty("hive.exec.reducers.bytes.per.reducer", "67108864") # Transactions - putHiveEnvProperty("hive_txn_acid", "Off") + putHiveEnvProperty("hive_txn_acid", "off") if str(configurations["hive-env"]["properties"]["hive_txn_acid"]).lower() == "on": putHiveSiteProperty("hive.txn.manager", "org.apache.hadoop.hive.ql.lockmgr.DbTxnManager") putHiveSiteProperty("hive.support.concurrency", "true") http://git-wip-us.apache.org/repos/asf/ambari/blob/1aa1ad29/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py index 05bded6..4abae12 100644 --- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py +++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py @@ -946,7 +946,7 @@ class TestHDP22StackAdvisor(TestCase): 'hive_exec_orc_storage_strategy': 'SPEED', 'hive_security_authorization': 'None', 'hive_timeline_logging_enabled': 'true', - 'hive_txn_acid': 'Off' + 'hive_txn_acid': 'off' } }, 'hive-site': { http://git-wip-us.apache.org/repos/asf/ambari/blob/1aa1ad29/ambari-web/app/models/configs/objects/service_config_property.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js index c04b85b..455485a 100644 --- a/ambari-web/app/models/configs/objects/service_config_property.js +++ b/ambari-web/app/models/configs/objects/service_config_property.js @@ -342,28 +342,7 @@ App.ServiceConfigProperty = Em.Object.extend({ } if (!isError) { - // Check if this value is already in any of the overrides - var self = this; - var isOriginalSCP = this.get('isOriginalSCP'); - var parentSCP = this.get('parentSCP'); - if (!isOriginalSCP) { - if (!Em.isNone(parentSCP)) { - if (value === parentSCP.get('value') && supportsFinal && isFinal === parentSCP.get('isFinal')) { - this.set('errorMessage', Em.I18n.t('config.override.valueEqualToParentConfig')); - isError = true; - } else { - var overrides = parentSCP.get('overrides'); - if (overrides) { - overrides.forEach(function (override) { - if (self != override && value === override.get('value') && supportsFinal && isFinal === parentSCP.get('isFinal')) { - self.set('errorMessage', Em.I18n.t('config.override.valueEqualToAnotherOverrideConfig')); - isError = true; - } - }); - } - } - } - } + isError = this._validateOverrides(); } if (!isWarn || isError) { // Errors get priority @@ -379,6 +358,43 @@ App.ServiceConfigProperty = Em.Object.extend({ } else { this.set('error', true); } - }.observes('value', 'isFinal', 'retypedPassword') + }.observes('value', 'isFinal', 'retypedPassword'), + + /** + * Check config overrides and parent config overrides (if exist) + * @returns {boolean} + * @private + * @method _validateOverrides + */ + _validateOverrides: function () { + var self = this; + var isError = false; + var value = this.get('value'); + var isOriginalSCP = this.get('isOriginalSCP'); + var supportsFinal = this.get('supportsFinal'); + var isFinal = this.get('isFinal'); + var parentSCP = this.get('parentSCP'); + if (!isOriginalSCP) { + if (!Em.isNone(parentSCP)) { + if (value === parentSCP.get('value') || supportsFinal && isFinal === parentSCP.get('isFinal')) { + this.set('errorMessage', Em.I18n.t('config.override.valueEqualToParentConfig')); + isError = true; + } + else { + var overrides = parentSCP.get('overrides'); + if (overrides) { + overrides.forEach(function (override) { + if (self == override) return; + if (value === override.get('value') || supportsFinal && isFinal === parentSCP.get('isFinal')) { + self.set('errorMessage', Em.I18n.t('config.override.valueEqualToAnotherOverrideConfig')); + isError = true; + } + }); + } + } + } + } + return isError; + } }); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/1aa1ad29/ambari-web/test/models/configs/objects/service_config_property_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/models/configs/objects/service_config_property_test.js b/ambari-web/test/models/configs/objects/service_config_property_test.js index 9235d6e..a71e838 100644 --- a/ambari-web/test/models/configs/objects/service_config_property_test.js +++ b/ambari-web/test/models/configs/objects/service_config_property_test.js @@ -471,4 +471,107 @@ describe('App.ServiceConfigProperty', function () { }); }); + describe('#_validateOverrides', function () { + + Em.A([ + { + m: 'original config', + e: false, + c: { + value: 'on', + isOriginalSCP: true, + supportsFinal: false, + isFinal: false, + parentSCP: null + } + }, + { + m: 'not original config, value equal to parent', + e: true, + c: { + value: 'on', + isOriginalSCP: false, + supportsFinal: false, + isFinal: false, + parentSCP: App.ServiceConfigProperty.create({ + value: 'on' + }) + } + }, + { + m: 'not original config, isFinal equal to parent', + e: true, + c: { + value: 'on', + isOriginalSCP: false, + supportsFinal: true, + isFinal: false, + parentSCP: App.ServiceConfigProperty.create({ + value: 'off', + isFinal: false + }) + } + }, + { + m: 'not original config, isFinal equal to parent, but final not supported', + e: false, + c: { + value: 'on', + isOriginalSCP: false, + supportsFinal: false, + isFinal: false, + parentSCP: App.ServiceConfigProperty.create({ + value: 'off', + isFinal: false + }) + } + }, + { + m: 'not original config, parent override has same value', + e: true, + c: { + value: 'on', + isOriginalSCP: false, + supportsFinal: true, + isFinal: false, + parentSCP: App.ServiceConfigProperty.create({ + value: 'off', + overrides: [ + App.ServiceConfigProperty.create({ + value: 'on', + isOriginalSCP: false + }) + ] + }) + } + }, + { + m: 'not original config, parent override doesn\'t have same value', + e: false, + c: { + value: 'on', + isOriginalSCP: false, + supportsFinal: true, + isFinal: false, + parentSCP: App.ServiceConfigProperty.create({ + value: 'off', + isFinal: true, + overrides: [ + App.ServiceConfigProperty.create({ + value: 'another', + isOriginalSCP: false + }) + ] + }) + } + } + ]).forEach(function (test) { + it(test.m, function () { + serviceConfigProperty.reopen(test.c); + expect(serviceConfigProperty._validateOverrides()).to.equal(test.e); + }); + }); + + }); + }); http://git-wip-us.apache.org/repos/asf/ambari/blob/1aa1ad29/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js index 8fa6991..3e301d6 100644 --- a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js +++ b/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js @@ -26,6 +26,7 @@ describe('App.ListConfigWidgetView', function () { view = App.ListConfigWidgetView.create({ initPopover: Em.K, config: Em.Object.create({ + _validateOverrides: App.ServiceConfigProperty.prototype._validateOverrides, validate: App.ServiceConfigProperty.prototype.validate, name: 'a.b.c', defaultValue: '2,1',