Repository: ambari Updated Branches: refs/heads/trunk accda5c15 -> 6672b74f9
AMBARI-16750: Activate HAWQSTANDBY fails on retry (mithmatt) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6672b74f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6672b74f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6672b74f Branch: refs/heads/trunk Commit: 6672b74f933f2eb8b436e709241e2cd1385f5894 Parents: accda5c Author: Matt <[email protected]> Authored: Wed May 18 23:22:45 2016 -0700 Committer: Matt <[email protected]> Committed: Wed May 18 23:22:45 2016 -0700 ---------------------------------------------------------------------- .../HAWQ/2.0.0/package/scripts/hawqstandby.py | 9 +++-- .../python/stacks/2.3/HAWQ/test_hawqstandby.py | 42 ++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6672b74f/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py index 45dcff0..119f2c7 100644 --- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py @@ -47,7 +47,6 @@ class HawqStandby(Script): common.start_component(hawq_constants.STANDBY, params.hawq_master_address_port, params.hawq_master_dir) def stop(self, env): - import params common.stop_component(hawq_constants.STANDBY, hawq_constants.FAST) def status(self, env): @@ -55,12 +54,16 @@ class HawqStandby(Script): assert_component_running(hawq_constants.STANDBY) def activate_hawq_standby(self, env): + import params import utils Logger.info("Activating HAWQ standby...") + params.XmlConfig("hawq-site.xml", + configurations=params.hawq_site, + configuration_attributes=params.config_attrs['hawq-site']) utils.exec_hawq_operation(hawq_constants.ACTIVATE, "{0} -a -M {1} -v --ignore-bad-hosts".format(hawq_constants.STANDBY, hawq_constants.FAST)) - # Stop the newly become master as the process might be running with an old port, - # which would cause a failure Start HAWQ Service step in Activate HAWQ Standby Master Wizard + # Stop the new HAWQMASTER as the process might be running at an old port, + # which might cause a failure in Start HAWQ Service step in the Activate HAWQ Standby Master Wizard common.stop_component(hawq_constants.MASTER, hawq_constants.FAST) if __name__ == "__main__": http://git-wip-us.apache.org/repos/asf/ambari/blob/6672b74f/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py index e247d28..4e2a9cd 100644 --- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py +++ b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py @@ -191,3 +191,45 @@ class TestHawqStandby(RMFTestCase): ) self.assertNoMoreResources() + + + @patch ('common.get_local_hawq_site_property_value') + def test_activate_hawq_standby(self, get_local_hawq_site_property_value_mock): + """Test Activate HAWQ Standby Command""" + + get_local_hawq_site_property_value_mock.return_value = 5432 + + self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + '/scripts/hawqstandby.py', + classname = 'HawqStandby', + command = 'activate_hawq_standby', + config_file ='hawq_default.json', + stack_version = self.STACK_VERSION, + target = RMFTestCase.TARGET_COMMON_SERVICES + ) + + self.assertResourceCalled('XmlConfig', 'hawq-site.xml', + conf_dir = '/usr/local/hawq/etc/', + configurations = self.getConfig()['configurations']['hawq-site'], + configuration_attributes = self.getConfig()['configuration_attributes']['hawq-site'], + group = self.GPADMIN, + owner = self.GPADMIN, + mode = 0644 + ) + + self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && hawq activate standby -a -M fast -v --ignore-bad-hosts', + logoutput = True, + not_if = None, + only_if = None, + user = self.GPADMIN, + timeout = 900 + ) + + self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && hawq stop master -M fast -a -v', + logoutput = True, + not_if = None, + only_if = "netstat -tupln | egrep ':5432\\s' | egrep postgres", + user = self.GPADMIN, + timeout = 900 + ) + + self.assertNoMoreResources() \ No newline at end of file
