You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/02/24 16:08:22 UTC
[35/50] [abbrv] ambari git commit: Merge with trunk
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
index 3cc7516..105d695 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
@@ -202,8 +202,10 @@ CREATE TABLE ambari.servicecomponentdesiredstate (
desired_stack_id BIGINT NOT NULL,
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
+ recovery_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT pk_sc_desiredstate PRIMARY KEY (id),
CONSTRAINT unq_scdesiredstate_name UNIQUE(component_name, service_name, cluster_id)
+ PRIMARY KEY (component_name, cluster_id, service_name)
);
GRANT ALL PRIVILEGES ON TABLE ambari.servicecomponentdesiredstate TO :username;
@@ -758,6 +760,7 @@ GRANT ALL PRIVILEGES ON TABLE ambari.setting TO :username;
-- tasks indices --
CREATE INDEX idx_stage_request_id ON ambari.stage (request_id);
CREATE INDEX idx_hrc_request_id ON ambari.host_role_command (request_id);
+CREATE INDEX idx_hrc_status_role ON ambari.host_role_command (status, role);
CREATE INDEX idx_rsc_request_id ON ambari.role_success_criteria (request_id);
--------altering tables by creating unique constraints----------
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index a5bfdc2..a897454 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -167,8 +167,10 @@ CREATE TABLE servicecomponentdesiredstate (
desired_stack_id NUMERIC(19) NOT NULL,
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
+ recovery_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT pk_sc_desiredstate PRIMARY KEY (id),
CONSTRAINT unq_scdesiredstate_name UNIQUE(component_name, service_name, cluster_id)
+ PRIMARY KEY (component_name, cluster_id, service_name)
);
CREATE TABLE servicedesiredstate (
@@ -673,6 +675,7 @@ CREATE TABLE setting (
-- tasks indices --
CREATE INDEX idx_stage_request_id ON stage (request_id);
CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
+CREATE INDEX idx_hrc_status_role ON host_role_command (status, role);
CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
-- altering tables by creating unique constraints----------
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index 8e5b2f8..a8bda7c 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -187,10 +187,12 @@ CREATE TABLE servicecomponentdesiredstate (
desired_stack_id BIGINT NOT NULL,
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
+ recovery_enabled SMALLINT NOT NULL DEFAULT 0,
PRIMARY KEY CLUSTERED (id),
CONSTRAINT pk_sc_desiredstate PRIMARY KEY (id),
CONSTRAINT unq_scdesiredstate_name UNIQUE(component_name, service_name, cluster_id)
-);
+ PRIMARY KEY CLUSTERED (component_name, cluster_id, service_name)
+ );
CREATE TABLE servicedesiredstate (
cluster_id BIGINT NOT NULL,
@@ -782,6 +784,7 @@ CREATE TABLE setting (
-- tasks indices --
CREATE INDEX idx_stage_request_id ON stage (request_id);
CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
+CREATE INDEX idx_hrc_status_role ON host_role_command (status, role);
CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/main/resources/alert-templates.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/alert-templates.xml b/ambari-server/src/main/resources/alert-templates.xml
index d7fe320..2e8fc71 100644
--- a/ambari-server/src/main/resources/alert-templates.xml
+++ b/ambari-server/src/main/resources/alert-templates.xml
@@ -158,6 +158,20 @@
<div class="label-small">
$alert.getAlertText()
</div>
+ <div class="label-small">
+ Cluster: $alert.getAlertDefinition().getCluster().getClusterName()
+ </div>
+ #if( $alert.getHostName() )
+ #if( $ambari.hasUrl() )
+ <div class="label-small">
+ Host: <a href=$ambari.getUrl()/#/main/hosts/$alert.getHostName()/summary>$ambari.getUrl()/#/main/hosts/$alert.getHostName()/summary</a>
+ </div>
+ #else
+ <div class="label-small">
+ Host: $alert.getHostName()
+ </div>
+ #end
+ #end
</td>
</tr>
#end
@@ -170,6 +184,10 @@
This notification was sent to $dispatch.getTargetName()
<br/>
Apache Ambari $ambari.getServerVersion()
+ #if( $ambari.hasUrl() )
+ <br/>
+ Ambari Server link: <a href=$ambari.getUrl()>$ambari.getUrl()</a>
+ #end
</div>
</html>
]]>
@@ -193,4 +211,4 @@
$alert.getAlertText()]]>
</body>
</alert-template>
-</alert-templates>
\ No newline at end of file
+</alert-templates>
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-broker.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-broker.xml b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-broker.xml
index 704d73f..857f40e 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-broker.xml
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-broker.xml
@@ -325,7 +325,6 @@
<description>Timeline port</description>
</property>
<property>
- <property>
<name>kafka.timeline.metrics.protocol</name>
<value>{{metric_collector_protocol}}</value>
<description>Timeline protocol(http or https)</description>
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index 4052ad2..8ccae05 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -62,6 +62,7 @@
"ServiceComponentInfo/total_count",
"ServiceComponentInfo/started_count",
"ServiceComponentInfo/installed_count",
+ "ServiceComponentInfo/recovery_enabled",
"params/run_smoke_test",
"_"
],
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/main/resources/scripts/Ambaripreupload.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/Ambaripreupload.py b/ambari-server/src/main/resources/scripts/Ambaripreupload.py
index cc6213e..fb0c3e1 100644
--- a/ambari-server/src/main/resources/scripts/Ambaripreupload.py
+++ b/ambari-server/src/main/resources/scripts/Ambaripreupload.py
@@ -132,6 +132,7 @@ with Environment() as env:
TAR_DESTINATION_FOLDER_SUFFIX = "_tar_destination_folder"
class params:
+ hdfs_path_prefix = hdfs_path_prefix
hdfs_user = "hdfs"
mapred_user ="mapred"
hadoop_bin_dir="/usr/hdp/" + hdp_version + "/hadoop/bin"
@@ -236,23 +237,23 @@ with Environment() as env:
return _copy_files(source_and_dest_pairs, file_owner, group_owner, kinit_if_needed)
def createHdfsResources():
- params.HdfsResource('/atshistory', user='hdfs', change_permissions_for_parents=True, owner='yarn', group='hadoop', type='directory', action= ['create_on_execute'], mode=0755)
- params.HdfsResource('/user/hcat', owner='hcat', type='directory', action=['create_on_execute'], mode=0755)
- params.HdfsResource('/hive/warehouse', owner='hive', type='directory', action=['create_on_execute'], mode=0777)
- params.HdfsResource('/user/hive', owner='hive', type='directory', action=['create_on_execute'], mode=0755)
- params.HdfsResource('/tmp', mode=0777, action=['create_on_execute'], type='directory', owner='hdfs')
- params.HdfsResource('/user/ambari-qa', type='directory', action=['create_on_execute'], mode=0770)
- params.HdfsResource('/user/oozie', owner='oozie', type='directory', action=['create_on_execute'], mode=0775)
- params.HdfsResource('/app-logs', recursive_chmod=True, owner='yarn', group='hadoop', type='directory', action=['create_on_execute'], mode=0777)
- params.HdfsResource('/tmp/entity-file-history/active', owner='yarn', group='hadoop', type='directory', action=['create_on_execute'])
- params.HdfsResource('/mapred', owner='mapred', type='directory', action=['create_on_execute'])
- params.HdfsResource('/mapred/system', owner='hdfs', type='directory', action=['create_on_execute'])
- params.HdfsResource('/mr-history/done', change_permissions_for_parents=True, owner='mapred', group='hadoop', type='directory', action=['create_on_execute'], mode=0777)
- params.HdfsResource('/atshistory/done', owner='yarn', group='hadoop', type='directory', action=['create_on_execute'], mode=0700)
- params.HdfsResource('/atshistory/active', owner='yarn', group='hadoop', type='directory', action=['create_on_execute'], mode=01777)
- params.HdfsResource('/ams/hbase', owner='ams', type='directory', action=['create_on_execute'], mode=0775)
- params.HdfsResource('/amshbase/staging', owner='ams', type='directory', action=['create_on_execute'], mode=0711)
- params.HdfsResource('/user/ams/hbase', owner='ams', type='directory', action=['create_on_execute'], mode=0775)
+ params.HdfsResource(format('{hdfs_path_prefix}/atshistory'), user='hdfs', change_permissions_for_parents=True, owner='yarn', group='hadoop', type='directory', action= ['create_on_execute'], mode=0755)
+ params.HdfsResource(format('{hdfs_path_prefix}/user/hcat'), owner='hcat', type='directory', action=['create_on_execute'], mode=0755)
+ params.HdfsResource(format('{hdfs_path_prefix}/hive/warehouse'), owner='hive', type='directory', action=['create_on_execute'], mode=0777)
+ params.HdfsResource(format('{hdfs_path_prefix}/user/hive'), owner='hive', type='directory', action=['create_on_execute'], mode=0755)
+ params.HdfsResource(format('{hdfs_path_prefix}/tmp'), mode=0777, action=['create_on_execute'], type='directory', owner='hdfs')
+ params.HdfsResource(format('{hdfs_path_prefix}/user/ambari-qa'), type='directory', action=['create_on_execute'], mode=0770)
+ params.HdfsResource(format('{hdfs_path_prefix}/user/oozie'), owner='oozie', type='directory', action=['create_on_execute'], mode=0775)
+ params.HdfsResource(format('{hdfs_path_prefix}/app-logs'), recursive_chmod=True, owner='yarn', group='hadoop', type='directory', action=['create_on_execute'], mode=0777)
+ params.HdfsResource(format('{hdfs_path_prefix}/tmp/entity-file-history/active'), owner='yarn', group='hadoop', type='directory', action=['create_on_execute'])
+ params.HdfsResource(format('{hdfs_path_prefix}/mapred'), owner='mapred', type='directory', action=['create_on_execute'])
+ params.HdfsResource(format('{hdfs_path_prefix}/mapred/system'), owner='hdfs', type='directory', action=['create_on_execute'])
+ params.HdfsResource(format('{hdfs_path_prefix}/mr-history/done'), change_permissions_for_parents=True, owner='mapred', group='hadoop', type='directory', action=['create_on_execute'], mode=0777)
+ params.HdfsResource(format('{hdfs_path_prefix}/atshistory/done'), owner='yarn', group='hadoop', type='directory', action=['create_on_execute'], mode=0700)
+ params.HdfsResource(format('{hdfs_path_prefix}/atshistory/active'), owner='yarn', group='hadoop', type='directory', action=['create_on_execute'], mode=01777)
+ params.HdfsResource(format('{hdfs_path_prefix}/ams/hbase'), owner='ams', type='directory', action=['create_on_execute'], mode=0775)
+ params.HdfsResource(format('{hdfs_path_prefix}/amshbase/staging'), owner='ams', type='directory', action=['create_on_execute'], mode=0711)
+ params.HdfsResource(format('{hdfs_path_prefix}/user/ams/hbase'), owner='ams', type='directory', action=['create_on_execute'], mode=0775)
def putCreatedHdfsResourcesToIgnore(env):
@@ -262,14 +263,16 @@ with Environment() as env:
file_content = ""
for file in env.config['hdfs_files']:
- file_content += file['target']
+ if not file['target'].startswith(hdfs_path_prefix):
+ raise Exception("Something created outside hdfs_path_prefix!")
+ file_content += file['target'][len(hdfs_path_prefix):]
file_content += "\n"
with open("/var/lib/ambari-agent/data/.hdfs_resource_ignore", "a+") as fp:
fp.write(file_content)
def putSQLDriverToOozieShared():
- params.HdfsResource('/user/oozie/share/lib/sqoop/{0}'.format(os.path.basename(SQL_DRIVER_PATH)),
+ params.HdfsResource(hdfs_path_prefix + '/user/oozie/share/lib/sqoop/{0}'.format(os.path.basename(SQL_DRIVER_PATH)),
owner='hdfs', type='file', action=['create_on_execute'], mode=0644, source=SQL_DRIVER_PATH)
env.set_params(params)
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 7c69ac9..f6f8cde 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -581,8 +581,8 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
putAmsHbaseSiteProperty("hbase.regionserver.global.memstore.upperLimit", 0.3)
putAmsHbaseSiteProperty("hbase.regionserver.global.memstore.lowerLimit", 0.25)
putAmsHbaseSiteProperty("phoenix.query.maxGlobalMemoryPercentage", 20)
- putAmsSiteProperty("phoenix.query.maxGlobalMemoryPercentage", 30)
putAmsHbaseSiteProperty("phoenix.coprocessor.maxMetaDataCacheSize", 81920000)
+ putAmsSiteProperty("phoenix.query.maxGlobalMemoryPercentage", 30)
elif total_sinks_count >= 500:
putAmsHbaseSiteProperty("hbase.regionserver.handler.count", 60)
putAmsHbaseSiteProperty("hbase.regionserver.hlog.blocksize", 134217728)
@@ -593,6 +593,9 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
putAmsHbaseSiteProperty("phoenix.coprocessor.maxMetaDataCacheSize", 20480000)
pass
+ metrics_api_handlers = min(50, max(20, int(total_sinks_count / 100)))
+ putAmsSiteProperty("timeline.metrics.service.handler.thread.count", metrics_api_handlers)
+
# Distributed mode heap size
if operatingMode == "distributed":
hbase_heapsize = max(hbase_heapsize, 756)
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/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 dc968cc..cd25d77 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
@@ -367,13 +367,16 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
yarn_queues = "default"
capacitySchedulerProperties = {}
- if "capacity-scheduler" in services['configurations'] and "capacity-scheduler" in services['configurations']["capacity-scheduler"]["properties"]:
- properties = str(services['configurations']["capacity-scheduler"]["properties"]["capacity-scheduler"]).split('\n')
- for property in properties:
- key,sep,value = property.partition("=")
- capacitySchedulerProperties[key] = value
- if "yarn.scheduler.capacity.root.queues" in capacitySchedulerProperties:
- yarn_queues = str(capacitySchedulerProperties["yarn.scheduler.capacity.root.queues"])
+ if "capacity-scheduler" in services['configurations']:
+ if "capacity-scheduler" in services['configurations']["capacity-scheduler"]["properties"]:
+ properties = str(services['configurations']["capacity-scheduler"]["properties"]["capacity-scheduler"]).split('\n')
+ for property in properties:
+ key,sep,value = property.partition("=")
+ capacitySchedulerProperties[key] = value
+ if "yarn.scheduler.capacity.root.queues" in capacitySchedulerProperties:
+ yarn_queues = str(capacitySchedulerProperties["yarn.scheduler.capacity.root.queues"])
+ elif "yarn.scheduler.capacity.root.queues" in services['configurations']["capacity-scheduler"]["properties"]:
+ yarn_queues = services['configurations']["capacity-scheduler"]["properties"]["yarn.scheduler.capacity.root.queues"]
# Interactive Queues property attributes
putHiveServerPropertyAttribute = self.putPropertyAttribute(configurations, "hiveserver2-site")
toProcessQueues = yarn_queues.split(",")
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index b354378..34e4cfa 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -943,31 +943,31 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
"HAWQ Master or Standby Master cannot use the port 5432 when installed on the same host as the Ambari Server. Ambari Postgres DB uses the same port. Please choose a different value (e.g. 10432)")})
# 2. Check if any data directories are pointing to root dir '/'
- prop_name = 'hawq_master_directory'
- display_name = 'HAWQ Master directory'
- self.validateIfRootDir (properties, validationItems, prop_name, display_name)
-
- prop_name = 'hawq_master_temp_directory'
- display_name = 'HAWQ Master temp directory'
- self.validateIfRootDir (properties, validationItems, prop_name, display_name)
-
- prop_name = 'hawq_segment_directory'
- display_name = 'HAWQ Segment directory'
- self.validateIfRootDir (properties, validationItems, prop_name, display_name)
-
- prop_name = 'hawq_segment_temp_directory'
- display_name = 'HAWQ Segment temp directory'
- self.validateIfRootDir (properties, validationItems, prop_name, display_name)
+ directories = {
+ 'hawq_master_directory': 'HAWQ Master directory',
+ 'hawq_master_temp_directory': 'HAWQ Master temp directory',
+ 'hawq_segment_directory': 'HAWQ Segment directory',
+ 'hawq_segment_temp_directory': 'HAWQ Segment temp directory'
+ }
+ for property_name, display_name in directories.iteritems():
+ self.validateIfRootDir(properties, validationItems, property_name, display_name)
# 3. Check YARN RM address properties
+ YARN = "YARN"
servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
- if "YARN" in servicesList and "yarn-site" in configurations:
+ if YARN in servicesList and "yarn-site" in configurations:
yarn_site = getSiteProperties(configurations, "yarn-site")
for hs_prop, ys_prop in self.getHAWQYARNPropertyMapping().items():
if hs_prop in hawq_site and ys_prop in yarn_site and hawq_site[hs_prop] != yarn_site[ys_prop]:
message = "Expected value: {0} (this property should have the same value as the property {1} in yarn-site)".format(yarn_site[ys_prop], ys_prop)
validationItems.append({"config-name": hs_prop, "item": self.getWarnItem(message)})
+ # 4. Check HAWQ Resource Manager type
+ HAWQ_GLOBAL_RM_TYPE = "hawq_global_rm_type"
+ if YARN not in servicesList and HAWQ_GLOBAL_RM_TYPE in hawq_site and hawq_site[HAWQ_GLOBAL_RM_TYPE].upper() == YARN:
+ message = "{0} must be set to none if YARN service is not installed".format(HAWQ_GLOBAL_RM_TYPE)
+ validationItems.append({"config-name": HAWQ_GLOBAL_RM_TYPE, "item": self.getErrorItem(message)})
+
return self.toConfigurationValidationProblems(validationItems, "hawq-site")
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/main/resources/stacks/HDP/2.4/services/HIVE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/services/HIVE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/services/HIVE/metainfo.xml
index ee973ed..93728fd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/services/HIVE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/services/HIVE/metainfo.xml
@@ -26,7 +26,7 @@
<name>HIVE_SERVER_INTERACTIVE</name>
<displayName>HiveServer2 Interactive</displayName>
<category>MASTER</category>
- <cardinality>1</cardinality>
+ <cardinality>0+</cardinality>
<versionAdvertised>true</versionAdvertised>
<clientsToUpdateConfigs></clientsToUpdateConfigs>
<dependencies>
@@ -35,7 +35,7 @@
<scope>cluster</scope>
<auto-deploy>
<enabled>true</enabled>
- <co-locate>HIVE/HIVE_SERVER</co-locate>
+ <co-locate>HIVE/HIVE_SERVER_INTERACTIVE</co-locate>
</auto-deploy>
</dependency>
<dependency>
@@ -43,6 +43,15 @@
<scope>host</scope>
<auto-deploy>
<enabled>true</enabled>
+ <co-locate>HIVE/HIVE_SERVER_INTERACTIVE</co-locate>
+ </auto-deploy>
+ </dependency>
+ <dependency>
+ <name>HDFS/HDFS_CLIENT</name>
+ <scope>host</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ <co-locate>HIVE/HIVE_SERVER_INTERACTIVE</co-locate>
</auto-deploy>
</dependency>
<dependency>
@@ -50,6 +59,7 @@
<scope>host</scope>
<auto-deploy>
<enabled>true</enabled>
+ <co-locate>HIVE/HIVE_SERVER_INTERACTIVE</co-locate>
</auto-deploy>
</dependency>
<dependency>
@@ -57,9 +67,26 @@
<scope>host</scope>
<auto-deploy>
<enabled>true</enabled>
+ <co-locate>HIVE/HIVE_SERVER_INTERACTIVE</co-locate>
+ </auto-deploy>
+ </dependency>
+ <dependency>
+ <name>PIG/PIG</name>
+ <scope>host</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ <co-locate>HIVE/HIVE_SERVER_INTERACTIVE</co-locate>
+ </auto-deploy>
+ </dependency>
+ <dependency>
+ <name>SLIDER/SLIDER</name>
+ <scope>host</scope>
+ <auto-deploy>
+ <enabled>true</enabled>
+ <co-locate>HIVE/HIVE_SERVER_INTERACTIVE</co-locate>
</auto-deploy>
</dependency>
- </dependencies>
+ </dependencies>
<commandScript>
<script>scripts/hive_server_interactive.py</script>
<scriptType>PYTHON</scriptType>
@@ -70,6 +97,14 @@
</configuration-dependencies>
</component>
</components>
+ <requiredServices>
+ <service>ZOOKEEPER</service>
+ <service>HDFS</service>
+ <service>YARN</service>
+ <service>TEZ</service>
+ <service>PIG</service>
+ <service>SLIDER</service>
+ </requiredServices>
</service>
</services>
</metainfo>
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
index bc4d397..af6fb9b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
@@ -607,8 +607,8 @@ public class TestActionScheduler {
doAnswer(new Answer<List<HostRoleCommand>>() {
@Override
public List<HostRoleCommand> answer(InvocationOnMock invocation) throws Throwable {
- String role = (String) invocation.getArguments()[1];
- HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[2];
+ String role = (String) invocation.getArguments()[0];
+ HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[1];
HostRoleCommand task = s.getHostRoleCommand(null, role);
@@ -618,7 +618,7 @@ public class TestActionScheduler {
return Collections.emptyList();
}
}
- }).when(db).getTasksByHostRoleAndStatus(anyString(), anyString(), any(HostRoleStatus.class));
+ }).when(db).getTasksByRoleAndStatus(anyString(), any(HostRoleStatus.class));
ServerActionExecutor.init(injector);
ActionScheduler scheduler = new ActionScheduler(100, 50, db, aq, fsm, 3,
@@ -762,8 +762,8 @@ public class TestActionScheduler {
doAnswer(new Answer<List<HostRoleCommand>>() {
@Override
public List<HostRoleCommand> answer(InvocationOnMock invocation) throws Throwable {
- String role = (String) invocation.getArguments()[1];
- HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[2];
+ String role = (String) invocation.getArguments()[0];
+ HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[1];
HostRoleCommand task = s.getHostRoleCommand(null, role);
@@ -774,7 +774,7 @@ public class TestActionScheduler {
}
}
- }).when(db).getTasksByHostRoleAndStatus(anyString(), anyString(), any(HostRoleStatus.class));
+ }).when(db).getTasksByRoleAndStatus(anyString(), any(HostRoleStatus.class));
ServerActionExecutor.init(injector);
ActionScheduler scheduler = new ActionScheduler(100, 50, db, aq, fsm, 3,
@@ -843,8 +843,8 @@ public class TestActionScheduler {
doAnswer(new Answer<List<HostRoleCommand>>() {
@Override
public List<HostRoleCommand> answer(InvocationOnMock invocation) throws Throwable {
- String role = (String) invocation.getArguments()[1];
- HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[2];
+ String role = (String) invocation.getArguments()[0];
+ HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[1];
HostRoleCommand task = s.getHostRoleCommand(null, role);
@@ -854,7 +854,7 @@ public class TestActionScheduler {
return Collections.emptyList();
}
}
- }).when(db).getTasksByHostRoleAndStatus(anyString(), anyString(), any(HostRoleStatus.class));
+ }).when(db).getTasksByRoleAndStatus(anyString(), any(HostRoleStatus.class));
ActionScheduler scheduler = new ActionScheduler(100, 50, db, aq, fsm, 3,
new HostsMap((String) null), unitOfWork, null, conf);
@@ -1951,8 +1951,8 @@ public class TestActionScheduler {
doAnswer(new Answer<List<HostRoleCommand>>() {
@Override
public List<HostRoleCommand> answer(InvocationOnMock invocation) throws Throwable {
- String role = (String) invocation.getArguments()[1];
- HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[2];
+ String role = (String) invocation.getArguments()[0];
+ HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[1];
HostRoleCommand task = s.getHostRoleCommand(null, role);
@@ -1962,7 +1962,7 @@ public class TestActionScheduler {
return Collections.emptyList();
}
}
- }).when(db).getTasksByHostRoleAndStatus(anyString(), anyString(), any(HostRoleStatus.class));
+ }).when(db).getTasksByRoleAndStatus(anyString(), any(HostRoleStatus.class));
doAnswer(new Answer<HostRoleCommand>() {
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
index 510e1fb..6cb9e6f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
@@ -36,6 +36,7 @@ import org.apache.ambari.server.agent.rest.AgentResource;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
import org.apache.ambari.server.orm.DBAccessor;
+import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
import org.apache.ambari.server.security.SecurityHelper;
import org.apache.ambari.server.security.SecurityHelperImpl;
import org.apache.ambari.server.stack.StackManagerFactory;
@@ -308,6 +309,7 @@ public class AgentResourceTest extends RandomPortJerseyTest {
bind(HeartBeatHandler.class).toInstance(handler);
bind(AmbariMetaInfo.class).toInstance(ambariMetaInfo);
bind(DBAccessor.class).toInstance(mock(DBAccessor.class));
+ bind(HostRoleCommandDAO.class).toInstance(mock(HostRoleCommandDAO.class));
}
private void installDependencies() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
index 4e236f3..3ecb5aa 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
@@ -563,4 +563,99 @@ public class ConfigurationTest {
Assert.assertEquals(44, configuration.getPropertyProvidersThreadPoolMaxSize());
}
+
+ public void testGetHostRoleCommandStatusSummaryCacheSize() throws Exception {
+ // Given
+ final Properties ambariProperties = new Properties();
+ final Configuration configuration = new Configuration(ambariProperties);
+ ambariProperties.setProperty(Configuration.SERVER_HRC_STATUS_SUMMARY_CACHE_SIZE, "3000");
+
+ // When
+ long actualCacheSize = configuration.getHostRoleCommandStatusSummaryCacheSize();
+
+ // Then
+ Assert.assertEquals(actualCacheSize, 3000L);
+ }
+
+ @Test
+ public void testGetHostRoleCommandStatusSummaryCacheSizeDefault() throws Exception {
+ // Given
+ final Properties ambariProperties = new Properties();
+ final Configuration configuration = new Configuration(ambariProperties);
+
+ // When
+ long actualCacheSize = configuration.getHostRoleCommandStatusSummaryCacheSize();
+
+ // Then
+ Assert.assertEquals(actualCacheSize, Configuration.SERVER_HRC_STATUS_SUMMARY_CACHE_SIZE_DEFAULT);
+ }
+
+ @Test
+ public void testGetHostRoleCommandStatusSummaryCacheExpiryDuration() throws Exception {
+ // Given
+ final Properties ambariProperties = new Properties();
+ final Configuration configuration = new Configuration(ambariProperties);
+ ambariProperties.setProperty(Configuration.SERVER_HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION, "60");
+
+ // When
+ long actualCacheExpiryDuration = configuration.getHostRoleCommandStatusSummaryCacheExpiryDuration();
+
+ // Then
+ Assert.assertEquals(actualCacheExpiryDuration, 60L);
+ }
+
+ @Test
+ public void testGetHostRoleCommandStatusSummaryCacheExpiryDurationDefault() throws Exception {
+ // Given
+ final Properties ambariProperties = new Properties();
+ final Configuration configuration = new Configuration(ambariProperties);
+
+ // When
+ long actualCacheExpiryDuration = configuration.getHostRoleCommandStatusSummaryCacheExpiryDuration();
+
+ // Then
+ Assert.assertEquals(actualCacheExpiryDuration, Configuration.SERVER_HRC_STATUS_SUMMARY_CACHE_EXPIRY_DURATION_DEFAULT);
+ }
+
+ @Test
+ public void testGetHostRoleCommandStatusSummaryCacheEnabled() throws Exception {
+ // Given
+ final Properties ambariProperties = new Properties();
+ final Configuration configuration = new Configuration(ambariProperties);
+ ambariProperties.setProperty(Configuration.SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED, "true");
+
+ // When
+ boolean actualCacheEnabledConfig = configuration.getHostRoleCommandStatusSummaryCacheEnabled();
+
+ // Then
+ Assert.assertEquals(actualCacheEnabledConfig, true);
+ }
+
+ @Test
+ public void testGetHostRoleCommandStatusSummaryCacheDisabled() throws Exception {
+ // Given
+ final Properties ambariProperties = new Properties();
+ final Configuration configuration = new Configuration(ambariProperties);
+ ambariProperties.setProperty(Configuration.SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED, "false");
+
+ // When
+ boolean actualCacheEnabledConfig = configuration.getHostRoleCommandStatusSummaryCacheEnabled();
+
+ // Then
+ Assert.assertEquals(actualCacheEnabledConfig, false);
+ }
+
+ @Test
+ public void testGetHostRoleCommandStatusSummaryCacheEnabledDefault() throws Exception {
+ // Given
+ final Properties ambariProperties = new Properties();
+ final Configuration configuration = new Configuration(ambariProperties);
+
+ // When
+ boolean actualCacheEnabledConfig = configuration.getHostRoleCommandStatusSummaryCacheEnabled();
+
+ // Then
+ Assert.assertEquals(actualCacheEnabledConfig, Configuration.SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED_DEFAULT);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 7b26f23..992150c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -5679,6 +5679,7 @@ public class AmbariManagementControllerTest {
clusters.getCluster(clusterName).getService(serviceName)
.getServiceComponents().values()) {
Assert.assertEquals(State.INSTALLED, sc.getDesiredState());
+ Assert.assertFalse(sc.isRecoveryEnabled()); // default value of recoveryEnabled
for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
Assert.assertEquals(State.INSTALLED, sch.getDesiredState());
Assert.assertEquals(State.INIT, sch.getState());
@@ -5695,6 +5696,7 @@ public class AmbariManagementControllerTest {
for (ServiceComponent sc :
clusters.getCluster(clusterName).getService(serviceName)
.getServiceComponents().values()) {
+ sc.setRecoveryEnabled(true);
for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
sch.setState(State.INSTALLED);
}
@@ -5714,6 +5716,7 @@ public class AmbariManagementControllerTest {
clusters.getCluster(clusterName).getService(serviceName)
.getServiceComponents().values()) {
Assert.assertEquals(State.INSTALLED, sc.getDesiredState());
+ Assert.assertTrue(sc.isRecoveryEnabled());
for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
Assert.assertEquals(State.INSTALLED, sch.getDesiredState());
Assert.assertEquals(State.INSTALLED, sch.getState());
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
index 2dcde00..f6027f3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
@@ -42,6 +42,7 @@ import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.controller.spi.ResourceProvider;
import org.apache.ambari.server.metadata.RoleCommandOrder;
import org.apache.ambari.server.orm.DBAccessor;
+import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
import org.apache.ambari.server.security.SecurityHelper;
import org.apache.ambari.server.security.credential.PrincipalKeyCredential;
import org.apache.ambari.server.security.encryption.CredentialStoreService;
@@ -215,6 +216,7 @@ public class KerberosHelperTest extends EasyMockSupport {
bind(CreatePrincipalsServerAction.class).toInstance(createMock(CreatePrincipalsServerAction.class));
bind(CreateKeytabFilesServerAction.class).toInstance(createMock(CreateKeytabFilesServerAction.class));
bind(StackAdvisorHelper.class).toInstance(createMock(StackAdvisorHelper.class));
+ bind(HostRoleCommandDAO.class).toInstance(createNiceMock(HostRoleCommandDAO.class));
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
index f38fab1..d24ca09 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
@@ -225,11 +225,14 @@ public class ComponentResourceProviderTest {
expect(service.getServiceComponents()).andReturn(serviceComponentMap).anyTimes();
expect(serviceComponent1.convertToResponse()).andReturn(
- new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component100", null, "", 1, 1, 0));
+ new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component100", null, "", 1, 1, 0,
+ true /* recovery enabled */));
expect(serviceComponent2.convertToResponse()).andReturn(
- new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", null, "", 1, 1, 0));
+ new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", null, "", 1, 1, 0,
+ false /* recovery not enabled */));
expect(serviceComponent3.convertToResponse()).andReturn(
- new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component102", null, "", 1, 1, 0));
+ new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component102", null, "", 1, 1, 0,
+ true /* recovery enabled */));
expect(ambariMetaInfo.getComponent((String) anyObject(),
(String) anyObject(), (String) anyObject(), (String) anyObject()))
@@ -258,6 +261,7 @@ public class ComponentResourceProviderTest {
propertyIds.add(ComponentResourceProvider.COMPONENT_TOTAL_COUNT_PROPERTY_ID);
propertyIds.add(ComponentResourceProvider.COMPONENT_STARTED_COUNT_PROPERTY_ID);
propertyIds.add(ComponentResourceProvider.COMPONENT_INSTALLED_COUNT_PROPERTY_ID);
+ propertyIds.add(ComponentResourceProvider.COMPONENT_RECOVERY_ENABLED_ID);
Predicate predicate = new PredicateBuilder()
.property(ComponentResourceProvider.COMPONENT_CLUSTER_NAME_PROPERTY_ID)
@@ -282,6 +286,8 @@ public class ComponentResourceProviderTest {
ComponentResourceProvider.COMPONENT_STARTED_COUNT_PROPERTY_ID));
Assert.assertEquals(0, resource.getPropertyValue(
ComponentResourceProvider.COMPONENT_INSTALLED_COUNT_PROPERTY_ID));
+ Assert.assertEquals(String.valueOf(true), resource.getPropertyValue(
+ ComponentResourceProvider.COMPONENT_RECOVERY_ENABLED_ID));
}
// verify
@@ -364,11 +370,14 @@ public class ComponentResourceProviderTest {
expect(component3Info.getCategory()).andReturn(null);
expect(serviceComponent1.convertToResponse()).andReturn(
- new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", null, "", 1, 0, 1));
+ new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", null, "", 1, 0, 1,
+ false /* recovery not enabled */));
expect(serviceComponent2.convertToResponse()).andReturn(
- new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component102", null, "", 1, 0, 1));
+ new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component102", null, "", 1, 0, 1,
+ false /* recovery not enabled */));
expect(serviceComponent3.convertToResponse()).andReturn(
- new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component103", null, "", 1, 0, 1));
+ new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component103", null, "", 1, 0, 1,
+ false /* recovery not enabled */));
expect(serviceComponent1.getDesiredState()).andReturn(State.INSTALLED).anyTimes();
expect(serviceComponent2.getDesiredState()).andReturn(State.INSTALLED).anyTimes();
expect(serviceComponent3.getDesiredState()).andReturn(State.INSTALLED).anyTimes();
@@ -412,6 +421,7 @@ public class ComponentResourceProviderTest {
Map<String, Object> properties = new LinkedHashMap<String, Object>();
+ properties.put(ComponentResourceProvider.COMPONENT_RECOVERY_ENABLED_ID, String.valueOf(true) /* recovery enabled */);
properties.put(ComponentResourceProvider.COMPONENT_STATE_PROPERTY_ID, "STARTED");
properties.put(ComponentResourceProvider.COMPONENT_CLUSTER_NAME_PROPERTY_ID, "Cluster100");
@@ -607,7 +617,7 @@ public class ComponentResourceProviderTest {
// requests
ServiceComponentRequest request1 = new ServiceComponentRequest("cluster1", "service1", "component1",
- null);
+ null, String.valueOf(true /* recovery enabled */));
Set<ServiceComponentRequest> setRequests = new HashSet<ServiceComponentRequest>();
setRequests.add(request1);
@@ -667,14 +677,15 @@ public class ComponentResourceProviderTest {
// requests
ServiceComponentRequest request1 = new ServiceComponentRequest("cluster1", "service1", "component1",
- null);
+ null, String.valueOf(true /* recovery enabled */));
ServiceComponentRequest request2 = new ServiceComponentRequest("cluster1", "service1", "component2",
- null);
+ null, String.valueOf(true /* recovery enabled */));
ServiceComponentRequest request3 = new ServiceComponentRequest("cluster1", "service1", "component3",
- null);
+ null, String.valueOf(true /* recovery enabled */));
ServiceComponentRequest request4 = new ServiceComponentRequest("cluster1", "service1", "component4",
- null);
- ServiceComponentRequest request5 = new ServiceComponentRequest("cluster1", "service2", null, null);
+ null, String.valueOf(true /* recovery enabled */));
+ ServiceComponentRequest request5 = new ServiceComponentRequest("cluster1", "service2", null, null,
+ String.valueOf(true /* recovery enabled */));
Set<ServiceComponentRequest> setRequests = new HashSet<ServiceComponentRequest>();
setRequests.add(request1);
@@ -758,7 +769,7 @@ public class ComponentResourceProviderTest {
// requests
ServiceComponentRequest request1 = new ServiceComponentRequest("cluster1", "service1", "component1",
- null);
+ null, String.valueOf(true /* recovery enabled */));
Set<ServiceComponentRequest> setRequests = new HashSet<ServiceComponentRequest>();
setRequests.add(request1);
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
index 455652b..d7a15e2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
@@ -31,6 +31,7 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileReader;
import java.lang.reflect.Type;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -62,6 +63,7 @@ import org.apache.commons.lang.StringUtils;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.util.Assert;
/**
* StackManager unit tests.
@@ -641,12 +643,16 @@ public class StackManagerTest {
stack.getKerberosDescriptorFileLocation());
}
- @Ignore
@Test
public void testMetricsLoaded() throws Exception {
- String stackRoot = ClassLoader.getSystemClassLoader().getResource("stacks").getPath().replace("test-classes","classes");
- String commonServices = ClassLoader.getSystemClassLoader().getResource("common-services").getPath().replace("test-classes","classes");
+ URL rootDirectoryURL = StackManagerTest.class.getResource("/");
+ Assert.notNull(rootDirectoryURL);
+
+ File resourcesDirectory = new File(new File(rootDirectoryURL.getFile()).getParentFile().getParentFile(), "src/main/resources");
+
+ File stackRoot = new File(resourcesDirectory, "stacks");
+ File commonServices = new File(resourcesDirectory, "common-services");
MetainfoDAO metaInfoDao = createNiceMock(MetainfoDAO.class);
StackDAO stackDao = createNiceMock(StackDAO.class);
@@ -660,7 +666,7 @@ public class StackManagerTest {
OsFamily osFamily = new OsFamily(config);
- StackManager stackManager = new StackManager(new File(stackRoot), new File(commonServices),
+ StackManager stackManager = new StackManager(stackRoot, commonServices,
osFamily, metaInfoDao, actionMetadata, stackDao);
for (StackInfo stackInfo : stackManager.getStacks()) {
@@ -682,12 +688,15 @@ public class StackManagerTest {
}
}
- @Ignore
@Test
public void testServicesWithRangerPluginRoleCommandOrder() throws AmbariException {
- // Given
- String stackRoot = ClassLoader.getSystemClassLoader().getResource("stacks").getPath().replace("test-classes","classes");
- String commonServices = ClassLoader.getSystemClassLoader().getResource("common-services").getPath().replace("test-classes","classes");
+ URL rootDirectoryURL = StackManagerTest.class.getResource("/");
+ Assert.notNull(rootDirectoryURL);
+
+ File resourcesDirectory = new File(new File(rootDirectoryURL.getFile()).getParentFile().getParentFile(), "src/main/resources");
+
+ File stackRoot = new File(resourcesDirectory, "stacks");
+ File commonServices = new File(resourcesDirectory, "common-services");
MetainfoDAO metaInfoDao = createNiceMock(MetainfoDAO.class);
StackDAO stackDao = createNiceMock(StackDAO.class);
@@ -701,7 +710,7 @@ public class StackManagerTest {
OsFamily osFamily = new OsFamily(config);
- StackManager stackManager = new StackManager(new File(stackRoot), new File(commonServices), osFamily, metaInfoDao, actionMetadata, stackDao);
+ StackManager stackManager = new StackManager(stackRoot, commonServices, osFamily, metaInfoDao, actionMetadata, stackDao);
String rangerUserSyncRoleCommand = Role.RANGER_USERSYNC + "-" + RoleCommand.START;
String rangerAdminRoleCommand = Role.RANGER_ADMIN + "-" + RoleCommand.START;
@@ -783,14 +792,6 @@ public class StackManagerTest {
assertTrue(rangerUserSyncRoleCommand + " should be dependent of " + rangerAdminRoleCommand, rangerUserSyncBlockers.contains(rangerAdminRoleCommand));
assertTrue(rangerUserSyncRoleCommand + " should be dependent of " + kmsRoleCommand, rangerUserSyncBlockers.contains(kmsRoleCommand));
-
- // Zookeeper Server
- ArrayList<String> zookeeperBlockers = (ArrayList<String>)generalDeps.get(zookeeperServerRoleCommand);
-
- assertTrue(zookeeperServerRoleCommand + " should be dependent of " + rangerUserSyncRoleCommand, zookeeperBlockers.contains(rangerUserSyncRoleCommand));
-
}
-
-
//todo: component override assertions
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
index 98424b7..9fe0fc3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
@@ -48,6 +48,7 @@ import org.apache.ambari.server.controller.spi.ClusterController;
import org.apache.ambari.server.orm.DBAccessor;
import org.apache.ambari.server.orm.GuiceJpaInitializer;
import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
+import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
import org.apache.ambari.server.security.SecurityHelper;
import org.apache.ambari.server.security.TestAuthenticationFactory;
import org.apache.ambari.server.stack.StackManagerFactory;
@@ -754,6 +755,7 @@ public class ConfigHelperTest {
bind(Clusters.class).toInstance(createNiceMock(ClustersImpl.class));
bind(ClusterController.class).toInstance(clusterController);
bind(StackManagerFactory.class).toInstance(createNiceMock(StackManagerFactory.class));
+ bind(HostRoleCommandDAO.class).toInstance(createNiceMock(HostRoleCommandDAO.class));
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
index 6061e06..077df33 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
@@ -19,12 +19,12 @@
package org.apache.ambari.server.upgrade;
-import com.google.common.collect.Maps;
-import com.google.gson.Gson;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Provider;
-import com.google.inject.persist.PersistService;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+
import org.apache.ambari.server.actionmanager.ActionManager;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.controller.AmbariManagementController;
@@ -33,6 +33,7 @@ import org.apache.ambari.server.controller.ConfigurationRequest;
import org.apache.ambari.server.controller.ConfigurationResponse;
import org.apache.ambari.server.controller.KerberosHelper;
import org.apache.ambari.server.controller.MaintenanceStateHelper;
+import org.apache.ambari.server.orm.DBAccessor;
import org.apache.ambari.server.orm.GuiceJpaInitializer;
import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
import org.apache.ambari.server.orm.dao.StackDAO;
@@ -40,6 +41,7 @@ import org.apache.ambari.server.orm.entities.StackEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.stack.OsFamily;
import org.easymock.Capture;
import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
@@ -47,10 +49,14 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import javax.persistence.EntityManager;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
+import com.google.common.collect.Maps;
+import com.google.gson.Gson;
+import com.google.inject.Binder;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import com.google.inject.Provider;
+import com.google.inject.persist.PersistService;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.anyString;
@@ -58,6 +64,7 @@ import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.createMockBuilder;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
@@ -101,6 +108,7 @@ public class UpgradeCatalog222Test {
Method updateAlerts = UpgradeCatalog222.class.getDeclaredMethod("updateAlerts");
Method updateStormConfigs = UpgradeCatalog222.class.getDeclaredMethod("updateStormConfigs");
Method updateAMSConfigs = UpgradeCatalog222.class.getDeclaredMethod("updateAMSConfigs");
+ Method updateHostRoleCommands = UpgradeCatalog222.class.getDeclaredMethod("updateHostRoleCommands");
UpgradeCatalog222 upgradeCatalog222 = createMockBuilder(UpgradeCatalog222.class)
@@ -108,6 +116,7 @@ public class UpgradeCatalog222Test {
.addMockedMethod(updateAlerts)
.addMockedMethod(updateStormConfigs)
.addMockedMethod(updateAMSConfigs)
+ .addMockedMethod(updateHostRoleCommands)
.createMock();
upgradeCatalog222.addNewConfigurationsFromXml();
@@ -118,6 +127,8 @@ public class UpgradeCatalog222Test {
expectLastCall().once();
upgradeCatalog222.updateAMSConfigs();
expectLastCall().once();
+ upgradeCatalog222.updateHostRoleCommands();
+ expectLastCall().once();
replay(upgradeCatalog222);
@@ -203,4 +214,28 @@ public class UpgradeCatalog222Test {
}
+ @Test
+ public void testUpdateHostRoleCommands() throws Exception {
+ final DBAccessor dbAccessor = createNiceMock(DBAccessor.class);
+ dbAccessor.createIndex(eq("idx_hrc_status"), eq("host_role_command"), eq("status"), eq("role"));
+ expectLastCall().once();
+
+ replay(dbAccessor);
+
+ Module module = new Module() {
+ @Override
+ public void configure(Binder binder) {
+ binder.bind(DBAccessor.class).toInstance(dbAccessor);
+ binder.bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
+ }
+ };
+
+ Injector injector = Guice.createInjector(module);
+ UpgradeCatalog222 upgradeCatalog222 = injector.getInstance(UpgradeCatalog222.class);
+ upgradeCatalog222.updateHostRoleCommands();
+
+
+ verify(dbAccessor);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
index 95ae8d8..f5fafbc 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
@@ -103,6 +103,7 @@ public class UpgradeCatalog240Test {
@Test
public void testExecuteDDLUpdates() throws SQLException, AmbariException {
Capture<DBAccessor.DBColumnInfo> capturedColumnInfo = newCapture();
+ Capture<DBAccessor.DBColumnInfo> capturedScColumnInfo = newCapture();
final DBAccessor dbAccessor = createStrictMock(DBAccessor.class);
Configuration configuration = createNiceMock(Configuration.class);
Connection connection = createNiceMock(Connection.class);
@@ -111,6 +112,8 @@ public class UpgradeCatalog240Test {
Capture<List<DBAccessor.DBColumnInfo>> capturedSettingColumns = EasyMock.newCapture();
dbAccessor.addColumn(eq("adminpermission"), capture(capturedColumnInfo));
+ dbAccessor.addColumn(eq(UpgradeCatalog240.SERVICE_COMPONENT_DESIRED_STATE_TABLE), capture(capturedScColumnInfo));
+
dbAccessor.createTable(eq("setting"), capture(capturedSettingColumns), eq("id"));
expect(configuration.getDatabaseUrl()).andReturn(Configuration.JDBC_IN_MEMORY_URL).anyTimes();
expect(dbAccessor.getConnection()).andReturn(connection);
@@ -176,6 +179,15 @@ public class UpgradeCatalog240Test {
Assert.assertEquals(1, columnInfo.getDefaultValue());
Assert.assertEquals(false, columnInfo.isNullable());
+ // Verify if recovery_enabled column was added to servicecomponentdesiredstate table
+ DBAccessor.DBColumnInfo columnScInfo = capturedScColumnInfo.getValue();
+ Assert.assertNotNull(columnScInfo);
+ Assert.assertEquals(UpgradeCatalog240.RECOVERY_ENABLED_COL, columnScInfo.getName());
+ Assert.assertEquals(null, columnScInfo.getLength());
+ Assert.assertEquals(Short.class, columnScInfo.getType());
+ Assert.assertEquals(0, columnScInfo.getDefaultValue());
+ Assert.assertEquals(false, columnScInfo.isNullable());
+
Map<String, Class> expectedCaptures = new HashMap<>();
expectedCaptures.put("id", Long.class);
expectedCaptures.put("name", String.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
index 854263c..215d137 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
@@ -37,6 +37,7 @@ import org.apache.ambari.server.agent.ExecutionCommand;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.orm.DBAccessor;
import org.apache.ambari.server.orm.dao.HostDAO;
+import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
import org.apache.ambari.server.security.SecurityHelper;
import org.apache.ambari.server.security.encryption.CredentialStoreService;
import org.apache.ambari.server.stack.StackManagerFactory;
@@ -118,6 +119,7 @@ public class StageUtilsTest extends EasyMockSupport {
bind(HostRoleCommandFactory.class).to(HostRoleCommandFactoryImpl.class);
bind(HostDAO.class).toInstance(createNiceMock(HostDAO.class));
bind(PersistedState.class).toInstance(createNiceMock(PersistedState.class));
+ bind(HostRoleCommandDAO.class).toInstance(createNiceMock(HostRoleCommandDAO.class));
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index 7c578f2..e15582e 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -1820,7 +1820,7 @@ class TestHDP206StackAdvisor(TestCase):
)
recommendedDefaults = {"property1": "file:///grid/0/var/dir"}
warn = self.stackAdvisor.validatorNotRootFs(properties, recommendedDefaults, 'property1', hostInfo)
- self.assertIsNotNone(warn)
+ self.assertTrue(warn != None)
self.assertEquals({'message': 'It is not recommended to use root partition for property1', 'level': 'WARN'}, warn)
# Set by user /var mountpoint, which is non-root , but not preferable - no warning
@@ -1831,7 +1831,7 @@ class TestHDP206StackAdvisor(TestCase):
"mountpoint" : "/var"
}
)
- self.assertIsNone(self.stackAdvisor.validatorNotRootFs(properties, recommendedDefaults, 'property1', hostInfo))
+ self.assertTrue(self.stackAdvisor.validatorNotRootFs(properties, recommendedDefaults, 'property1', hostInfo) == None)
def test_validatorEnoughDiskSpace(self):
reqiuredDiskSpace = 1048576
@@ -1847,7 +1847,7 @@ class TestHDP206StackAdvisor(TestCase):
}
]}
properties = {"property1": "file:///var/dir"}
- self.assertIsNone(self.stackAdvisor.validatorEnoughDiskSpace(properties, 'property1', hostInfo, reqiuredDiskSpace))
+ self.assertTrue(self.stackAdvisor.validatorEnoughDiskSpace(properties, 'property1', hostInfo, reqiuredDiskSpace) == None)
# local FS, no enough space
hostInfo = {"disk_info": [
@@ -1858,16 +1858,16 @@ class TestHDP206StackAdvisor(TestCase):
}
]}
warn = self.stackAdvisor.validatorEnoughDiskSpace(properties, 'property1', hostInfo, reqiuredDiskSpace)
- self.assertIsNotNone(warn)
+ self.assertTrue(warn != None)
self.assertEquals({'message': errorMsg, 'level': 'WARN'}, warn)
# non-local FS, HDFS
properties = {"property1": "hdfs://h1"}
- self.assertIsNone(self.stackAdvisor.validatorEnoughDiskSpace(properties, 'property1', hostInfo, reqiuredDiskSpace))
+ self.assertTrue(self.stackAdvisor.validatorEnoughDiskSpace(properties, 'property1', hostInfo, reqiuredDiskSpace) == None)
# non-local FS, WASB
properties = {"property1": "wasb://h1"}
- self.assertIsNone(self.stackAdvisor.validatorEnoughDiskSpace(properties, 'property1', hostInfo, reqiuredDiskSpace))
+ self.assertTrue(self.stackAdvisor.validatorEnoughDiskSpace(properties, 'property1', hostInfo, reqiuredDiskSpace) == None)
def test_round_to_n(self):
self.assertEquals(self.stack_advisor_impl.round_to_n(0), 0)
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/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 14a28d3..d230030 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
@@ -1028,7 +1028,7 @@ class TestHDP22StackAdvisor(TestCase):
'hive-site': {
'properties': {
'hive.server2.enable.doAs': 'true',
- 'hive.server2.tez.default.queues': "default",
+ 'hive.server2.tez.default.queues': "queue1,queue2",
'hive.server2.tez.initialize.default.sessions': 'false',
'hive.server2.tez.sessions.per.default.queue': '1',
'hive.auto.convert.join.noconditionaltask.size': '268435456',
@@ -1073,7 +1073,16 @@ class TestHDP22StackAdvisor(TestCase):
'hive.server2.authentication.kerberos.keytab': {'delete': 'true'},
'hive.server2.authentication.ldap.url': {'delete': 'true'},
'hive.server2.tez.default.queues': {
- 'entries': [{'value': 'default', 'label': 'default queue'}]
+ "entries": [
+ {
+ "value": "queue1",
+ "label": "queue1 queue"
+ },
+ {
+ "value": "queue2",
+ "label": "queue2 queue"
+ }
+ ]
}
}
},
@@ -2052,6 +2061,7 @@ class TestHDP22StackAdvisor(TestCase):
"timeline.metrics.cluster.aggregate.splitpoints": " ",
"timeline.metrics.host.aggregate.splitpoints": " ",
"timeline.metrics.host.aggregator.ttl": "1",
+ "timeline.metrics.service.handler.thread.count": "20",
'timeline.metrics.service.watcher.disabled': 'false'
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
index 545a2b5..03ae6cc 100644
--- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
@@ -1630,6 +1630,7 @@ class TestHDP23StackAdvisor(TestCase):
def test_validateHAWQConfigurations(self):
services = self.load_json("services-hawq-3-hosts.json")
# setup default configuration values
+ # Test hawq_rm_yarn_address and hawq_rm_scheduler_address are set correctly
configurations = services["configurations"]
configurations["hawq-site"] = {"properties": {"hawq_rm_yarn_address": "localhost:8032",
"hawq_rm_yarn_scheduler_address": "localhost:8030"}}
@@ -1664,3 +1665,48 @@ class TestHDP23StackAdvisor(TestCase):
self.assertEqual(len(problems), 2)
self.assertEqual(problems_dict, expected_warnings)
+ # Test hawq_global_rm_type validation
+ services = {
+ "services" : [
+ {
+ "StackServices" : {
+ "service_name" : "HAWQ"
+ },
+ "components": []
+ } ],
+ "configurations":
+ {
+ "hawq-site": {
+ "properties": {
+ "hawq_global_rm_type": "yarn"
+ }
+ }
+ }
+ }
+ properties = services["configurations"]["hawq-site"]["properties"]
+
+ # case 1: hawq_global_rm_type is set as yarn, but YARN service is not installed. Validation error expected.
+ """
+ Validation error expected is as below:
+ [ {
+ "config-type": "hawq-site",
+ "message": "hawq_global_rm_type must be set to none if YARN service is not installed",
+ "type": "configuration",
+ "config-name": "hawq_global_rm_type",
+ "level": "ERROR"
+ } ]
+ """
+ problems = self.stackAdvisor.validateHAWQConfigurations(properties, defaults, services["configurations"], services, hosts)
+ self.assertEqual(len(problems), 1)
+ self.assertEqual(problems[0]["config-type"], "hawq-site")
+ self.assertEqual(problems[0]["message"], "hawq_global_rm_type must be set to none if YARN service is not installed")
+ self.assertEqual(problems[0]["type"], "configuration")
+ self.assertEqual(problems[0]["config-name"], "hawq_global_rm_type")
+ self.assertEqual(problems[0]["level"], "ERROR")
+
+
+ # case 2: hawq_global_rm_type is set as yarn, and YARN service is installed. No validation errors expected.
+ services["services"].append({"StackServices" : {"service_name" : "YARN"}, "components":[]})
+
+ problems = self.stackAdvisor.validateHAWQConfigurations(properties, defaults, services["configurations"], services, hosts)
+ self.assertEqual(len(problems), 0)
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 06c4c31..4edcc5e 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -239,6 +239,7 @@ var files = [
'test/views/main/dashboard/widgets/uptime_text_widget_test',
'test/views/main/dashboard/widgets/node_managers_live_test',
'test/views/main/dashboard/widgets/datanode_live_test',
+ 'test/views/main/dashboard/widgets/hawqsegment_live_test',
'test/views/main/dashboard/widgets/hbase_average_load_test',
'test/views/main/dashboard/widgets/hbase_regions_in_transition_test',
'test/views/main/dashboard/widgets/namenode_rpc_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
index 513a519..fd28ad5 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
@@ -141,7 +141,7 @@ App.AddHawqStandbyWizardStep3Controller = Em.Controller.extend({
submit: function () {
if (!this.get('isSubmitDisabled')) {
dataDir = this.get('hawqProps').items[0].properties['hawq_master_directory'];
- hawqStandby = this.get('hawqProps').items[0].properties['hawq_standby_address_host']
+ hawqStandby = this.get('content.hawqHosts.newHawqStandby');
App.showConfirmationPopup(
function() {
App.get('router.mainAdminKerberosController').getKDCSessionState(function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-web/app/mappers/components_state_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/components_state_mapper.js b/ambari-web/app/mappers/components_state_mapper.js
index 0f2b627..ac3e1b5 100644
--- a/ambari-web/app/mappers/components_state_mapper.js
+++ b/ambari-web/app/mappers/components_state_mapper.js
@@ -59,6 +59,11 @@ App.componentsStateMapper = App.QuickDataMapper.create({
node_managers_installed: 'INSTALLED_PATH',
node_managers_total: 'TOTAL_PATH'
},
+ 'HAWQSEGMENT': {
+ hawq_segments_started: 'STARTED_PATH',
+ hawq_segments_installed: 'INSTALLED_PATH',
+ hawq_segments_total: 'TOTAL_PATH'
+ },
'HBASE_REGIONSERVER': {
region_servers_started: 'STARTED_PATH',
region_servers_installed: 'INSTALLED_PATH',
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 1246a5c..95f87f8 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2532,6 +2532,7 @@ Em.I18n.translations = {
'dashboard.widgets.YARNLinks': 'YARN Links',
'dashboard.widgets.error.invalid': 'Invalid! Enter a number between 0 - {0}',
'dashboard.widgets.error.smaller': 'Threshold 1 should be smaller than threshold 2!',
+ 'dashboard.widgets.HawqSegmentUp': 'HAWQ Segments Live',
'dashboard': {
'widgets': {
@@ -2636,6 +2637,10 @@ Em.I18n.translations = {
'dashboard.services.hbase.masterStarted':'Master Started',
'dashboard.services.hbase.masterActivated':'Master Activated',
+ 'dashboard.services.hawq.segments.started':'started',
+ 'dashboard.services.hawq.segments.stopped':'stopped',
+ 'dashboard.services.hawq.segments.total':'in total',
+
'dashboard.services.hive.clients':'Hive Clients',
'dashboard.services.hive.client':'Hive Client',
'dashboard.services.hive.metastore':'Hive Metastore',
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-web/app/models/alerts/alert_definition.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alerts/alert_definition.js b/ambari-web/app/models/alerts/alert_definition.js
index e91bd4f..6c25f7e 100644
--- a/ambari-web/app/models/alerts/alert_definition.js
+++ b/ambari-web/app/models/alerts/alert_definition.js
@@ -41,8 +41,8 @@ App.AlertDefinition = DS.Model.extend({
groups: DS.hasMany('App.AlertGroup'),
reporting: DS.hasMany('App.AlertReportDefinition'),
parameters: DS.hasMany('App.AlertDefinitionParameter'),
- lastTriggered: DS.attr('number'),
- lastTriggeredRaw: DS.attr('number'),
+ lastTriggered: 0,
+ lastTriggeredRaw: 0,
//relates only to SCRIPT-type alert definition
location: DS.attr('string'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index 4b6b857..18b43a8 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -220,6 +220,7 @@ require('views/main/dashboard/widgets/namenode_heap');
require('views/main/dashboard/widgets/namenode_cpu');
require('views/main/dashboard/widgets/hdfs_capacity');
require('views/main/dashboard/widgets/datanode_live');
+require('views/main/dashboard/widgets/hawqsegment_live');
require('views/main/dashboard/widgets/namenode_rpc');
require('views/main/dashboard/widgets/metrics_memory');
require('views/main/dashboard/widgets/metrics_network');
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
index fcf2aac..568c405 100644
--- a/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/list_config_widget_view.js
@@ -288,16 +288,15 @@ App.ListConfigWidgetView = App.ConfigWidgetView.extend({
},
isOptionExist: function(value) {
- var isExist = false;
- if (value !== null && value !== undefined) {
+ var isExist = true;
+ if (Em.isNone(value)) {
+ return !isExist;
+ } else {
value = Em.typeOf(value) == 'string' ? value.split(',') : value;
value.forEach(function(item) {
- isExist = this.get('options').mapProperty('value').contains(item);
+ isExist = isExist && this.get('options').mapProperty('value').contains(item);
}, this);
return isExist;
- } else {
- return false;
}
}
-
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-web/app/views/main/dashboard/widgets.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets.js b/ambari-web/app/views/main/dashboard/widgets.js
index a2fb281..8a86af6 100644
--- a/ambari-web/app/views/main/dashboard/widgets.js
+++ b/ambari-web/app/views/main/dashboard/widgets.js
@@ -128,7 +128,8 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
'13', '12', '14', '16', //hbase
'17', '18', '19', '20', '23', // all yarn
'21', // storm
- '22' // flume
+ '22', // flume
+ '24' // hawq
]; // all in order
var hiddenFull = [
['15', 'Region In Transition']
@@ -173,6 +174,12 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
visibleFull = visibleFull.without(item);
}, this);
}
+ if (this.get('hawq_model') == null) {
+ var hawq = ['24'];
+ hawq.forEach(function (item) {
+ visibleFull = visibleFull.without(item);
+ }, this);
+ }
var obj = this.get('initPrefObject');
obj.set('visible', visibleFull);
obj.set('hidden', hiddenFull);
@@ -192,6 +199,8 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
flume_model: null,
+ hawq_model: null,
+
/**
* List of visible widgets
* @type {Ember.Enumerable}
@@ -383,7 +392,8 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
hbase_model: ['12', '13', '14', '15', '16'],
yarn_model: ['17', '18', '19', '20', '23'],
storm_model: ['21'],
- flume_model: ['22']
+ flume_model: ['22'],
+ hawq_model: ['24']
};
// check each service, find out the newly added service and already deleted service
@@ -450,7 +460,8 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
'20': App.YARNMemoryPieChartView,
'21': App.SuperVisorUpView,
'22': App.FlumeAgentUpView,
- '23': App.YARNLinksView
+ '23': App.YARNLinksView,
+ '24': App.HawqSegmentUpView
}, id);
},
@@ -467,7 +478,7 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
visible: [],
hidden: [],
threshold: {1: [80, 90], 2: [85, 95], 3: [90, 95], 4: [80, 90], 5: [1000, 3000], 6: [], 7: [], 8: [], 9: [], 10: [], 11: [], 12: [], 13: [70, 90], 14: [150, 250], 15: [3, 10], 16: [],
- 17: [70, 90], 18: [], 19: [50, 75], 20: [50, 75], 21: [85, 95], 22: [85, 95], 23: []} // id:[thresh1, thresh2]
+ 17: [70, 90], 18: [], 19: [50, 75], 20: [50, 75], 21: [85, 95], 22: [85, 95], 23: [], 24: [80, 90]} // id:[thresh1, thresh2]
}),
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/dea22be1/ambari-web/app/views/main/dashboard/widgets/hawqsegment_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hawqsegment_live.js b/ambari-web/app/views/main/dashboard/widgets/hawqsegment_live.js
new file mode 100644
index 0000000..e8d0656
--- /dev/null
+++ b/ambari-web/app/views/main/dashboard/widgets/hawqsegment_live.js
@@ -0,0 +1,190 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.HawqSegmentUpView = App.TextDashboardWidgetView.extend({
+
+ title: Em.I18n.t('dashboard.widgets.HawqSegmentUp'),
+ id: '24',
+
+ isPieChart: false,
+ isText: true,
+ isProgressBar: false,
+ model_type: 'hawq',
+
+ hiddenInfo: function () {
+ var result = [];
+ result.pushObject(this.get('hawqSegmentsStarted') + ' ' + Em.I18n.t('dashboard.services.hawq.segments.started'));
+ result.pushObject(this.get('hawqSegmentsInstalled') + ' ' + Em.I18n.t('dashboard.services.hawq.segments.stopped'));
+ result.pushObject(this.get('hawqSegmentsTotal')+ ' ' + Em.I18n.t('dashboard.services.hawq.segments.total'));
+ return result;
+ }.property('hawqSegmentsStarted', 'hawqSegmentsInstalled', 'hawqSegmentsTotal'),
+ hiddenInfoClass: "hidden-info-three-line",
+
+ thresh1: 40,
+ thresh2: 70,
+ maxValue: 100,
+
+ hawqSegmentsStarted: function () {
+ if (Em.isNone(this.get('model.hawqSegmentsStarted'))) {
+ return Em.I18n.t('services.service.summary.notAvailable');
+ }
+ return this.get('model.hawqSegmentsStarted');
+ }.property('model.hawqSegmentsStarted'),
+
+ hawqSegmentsInstalled: function () {
+ if (Em.isNone(this.get('model.hawqSegmentsInstalled'))) {
+ return Em.I18n.t('services.service.summary.notAvailable');
+ }
+ return this.get('model.hawqSegmentsInstalled');
+ }.property('model.hawqSegmentsInstalled'),
+
+ hawqSegmentsTotal: function () {
+ if (Em.isNone(this.get('model.hawqSegmentsTotal'))) {
+ return Em.I18n.t('services.service.summary.notAvailable');
+ }
+ return this.get('model.hawqSegmentsTotal');
+ }.property('model.hawqSegmentsTotal'),
+
+ data: function () {
+ if (Em.isNone(this.get('model.hawqSegmentsStarted')) || Em.isNone(this.get('model.hawqSegmentsTotal'))) {
+ return null;
+ } else {
+ return ((this.get('hawqSegmentsStarted') / this.get('model.hawqSegmentsTotal')).toFixed(2)) * 100;
+ }
+ }.property('model.hawqSegmentsTotal', 'hawqSegmentsStarted'),
+
+ content: function () {
+ if (Em.isNone(this.get('model.hawqSegmentsStarted')) || Em.isNone(this.get('model.hawqSegmentsTotal'))) {
+ return Em.I18n.t('services.service.summary.notAvailable');
+ } else {
+ return this.get('hawqSegmentsStarted') + "/" + this.get('model.hawqSegmentsTotal');
+ }
+ }.property('model.hawqSegmentsTotal', 'hawqSegmentsStarted'),
+
+ editWidget: function (event) {
+ var parent = this;
+ var max_tmp = parseFloat(parent.get('maxValue'));
+ var configObj = Ember.Object.create({
+ thresh1: parent.get('thresh1') + '',
+ thresh2: parent.get('thresh2') + '',
+ hintInfo: Em.I18n.t('dashboard.widgets.hintInfo.hint1').format(max_tmp),
+ isThresh1Error: false,
+ isThresh2Error: false,
+ errorMessage1: "",
+ errorMessage2: "",
+ maxValue: max_tmp,
+ observeNewThresholdValue: function () {
+ var thresh1 = this.get('thresh1');
+ var thresh2 = this.get('thresh2');
+ if (thresh1.trim() != "") {
+ if (isNaN(thresh1) || thresh1 > max_tmp || thresh1 < 0){
+ this.set('isThresh1Error', true);
+ this.set('errorMessage1', 'Invalid! Enter a number between 0 - ' + max_tmp);
+ } else if ( this.get('isThresh2Error') === false && parseFloat(thresh2)<= parseFloat(thresh1)) {
+ this.set('isThresh1Error', true);
+ this.set('errorMessage1', 'Threshold 1 should be smaller than threshold 2 !');
+ } else {
+ this.set('isThresh1Error', false);
+ this.set('errorMessage1', '');
+ }
+ } else {
+ this.set('isThresh1Error', true);
+ this.set('errorMessage1', 'This is required');
+ }
+
+ if (thresh2.trim() != "") {
+ if (isNaN(thresh2) || thresh2 > max_tmp || thresh2 < 0) {
+ this.set('isThresh2Error', true);
+ this.set('errorMessage2', 'Invalid! Enter a number between 0 - ' + max_tmp);
+ } else {
+ this.set('isThresh2Error', false);
+ this.set('errorMessage2', '');
+ }
+ } else {
+ this.set('isThresh2Error', true);
+ this.set('errorMessage2', 'This is required');
+ }
+
+ // update the slider handles and color
+ if (this.get('isThresh1Error') === false && this.get('isThresh2Error') === false) {
+ $("#slider-range").slider('values', 0 , parseFloat(thresh1));
+ $("#slider-range").slider('values', 1 , parseFloat(thresh2));
+ }
+ }.observes('thresh1', 'thresh2')
+
+ });
+
+ var browserVerion = this.getInternetExplorerVersion();
+ App.ModalPopup.show({
+ header: Em.I18n.t('dashboard.widgets.popupHeader'),
+ classNames: [ 'sixty-percent-width-modal-edit-widget'],
+ bodyClass: Ember.View.extend({
+ templateName: require('templates/main/dashboard/edit_widget_popup'),
+ configPropertyObj: configObj
+ }),
+ primary: Em.I18n.t('common.apply'),
+ onPrimary: function () {
+ configObj.observeNewThresholdValue();
+ if (!configObj.isThresh1Error && !configObj.isThresh2Error) {
+ parent.set('thresh1', parseFloat(configObj.get('thresh1')) );
+ parent.set('thresh2', parseFloat(configObj.get('thresh2')) );
+ if (!App.get('testMode')) {
+ var big_parent = parent.get('parentView');
+ big_parent.getUserPref(big_parent.get('persistKey'));
+ var oldValue = big_parent.get('currentPrefObject');
+ oldValue.threshold[parseInt(parent.id)] = [configObj.get('thresh1'), configObj.get('thresh2')];
+ big_parent.postUserPref(big_parent.get('persistKey'),oldValue);
+ }
+ this.hide();
+ }
+ },
+
+ didInsertElement: function () {
+ var handlers = [configObj.get('thresh1'), configObj.get('thresh2')];
+ var colors = [App.healthStatusRed, App.healthStatusOrange, App.healthStatusGreen]; //color red, orange, green
+
+ if (browserVerion == -1 || browserVerion > 9) {
+ configObj.set('isIE9', false);
+ configObj.set('isGreenOrangeRed', false);
+ $("#slider-range").slider({
+ range: true,
+ min: 0,
+ max: max_tmp,
+ values: handlers,
+ create: function (event, ui) {
+ parent.updateColors(handlers, colors);
+ },
+ slide: function (event, ui) {
+ parent.updateColors(ui.values, colors);
+ configObj.set('thresh1', ui.values[0] + '');
+ configObj.set('thresh2', ui.values[1] + '');
+ },
+ change: function (event, ui) {
+ parent.updateColors(ui.values, colors);
+ }
+ });
+ } else {
+ configObj.set('isIE9', true);
+ configObj.set('isGreenOrangeRed', false);
+ }
+ }
+ });
+ }
+});