You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2017/08/21 13:37:51 UTC

[1/7] ambari git commit: AMBARI-21750. HDFS restart fails after migration if WebHDFS is disabled. (swagle)

Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-21450 1edd300af -> 445c7b011


AMBARI-21750. HDFS restart fails after migration if WebHDFS is disabled. (swagle)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7ad96170
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7ad96170
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7ad96170

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: 7ad96170e3cfa74d35da734012c965fabcd44239
Parents: 5d0914c
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Fri Aug 18 14:28:37 2017 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Fri Aug 18 14:28:47 2017 -0700

----------------------------------------------------------------------
 ambari-server/src/main/assemblies/server.xml | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7ad96170/ambari-server/src/main/assemblies/server.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/assemblies/server.xml b/ambari-server/src/main/assemblies/server.xml
index 395f322..403e21c 100644
--- a/ambari-server/src/main/assemblies/server.xml
+++ b/ambari-server/src/main/assemblies/server.xml
@@ -195,7 +195,6 @@
       <outputDirectory>/var/lib/ambari-server/resources/stacks/${supplemental.distribution}</outputDirectory>
       <excludes>
         <exclude>/4.2/hooks/before-START/files/fast-hdfs-resource.jar</exclude>
-        <exclude>/4.2.5/hooks/before-START/files/fast-hdfs-resource.jar</exclude>
       </excludes>
     </fileSet>
     <fileSet>


[7/7] ambari git commit: Merge branch 'branch-2.6' into branch-feature-AMBARI-21450

Posted by jo...@apache.org.
Merge branch 'branch-2.6' into branch-feature-AMBARI-21450


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/445c7b01
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/445c7b01
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/445c7b01

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: 445c7b0119078793649452389b78d60dd98804cb
Parents: 1edd300 596b145
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Aug 21 09:37:39 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Mon Aug 21 09:37:39 2017 -0400

----------------------------------------------------------------------
 .../core/providers/package/yumrpm.py            |  32 +--
 ambari-server/src/main/assemblies/server.xml    |   1 -
 .../DRUID/0.9.2/package/scripts/druid.py        |  26 ++-
 .../HIVE/0.12.0.2.0/configuration/hive-site.xml | 218 +++++++++++++++++++
 .../HIVE/0.12.0.2.0/metainfo.xml                |   1 +
 .../0.12.0.2.0/package/scripts/params_linux.py  |  11 +
 .../stacks/HDP/2.6/services/stack_advisor.py    |  49 ++++-
 .../stacks/HDP/2.6/upgrades/config-upgrade.xml  |  14 ++
 .../src/main/resources/version_definition.xsd   |   2 +
 .../stacks/2.5/common/test_stack_advisor.py     | 107 ++++++++-
 .../test/python/stacks/2.6/DRUID/test_druid.py  |   8 +-
 .../stacks/2.6/common/test_stack_advisor.py     |  60 ++++-
 ambari-web/app/views/common/sort_view.js        |  26 ++-
 .../app/views/main/alert_definitions_view.js    |   9 +-
 ambari-web/test/views/common/sort_view_test.js  |  49 ++++-
 15 files changed, 559 insertions(+), 54 deletions(-)
----------------------------------------------------------------------



[3/7] ambari git commit: AMBARI-21759 yumrpm provider doesn't parses installed packages in a same way on different CentOS versions (dgrinenko)

Posted by jo...@apache.org.
AMBARI-21759 yumrpm provider doesn't parses installed packages in a same way on different CentOS versions (dgrinenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/833fe163
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/833fe163
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/833fe163

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: 833fe163bc514ae7f1626899e8c8dc57b2922e36
Parents: 2c36880
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Sat Aug 19 05:46:06 2017 +0300
Committer: Dmytro Grinenko <ha...@apache.org>
Committed: Sat Aug 19 05:46:06 2017 +0300

----------------------------------------------------------------------
 .../core/providers/package/yumrpm.py            | 32 ++------------------
 1 file changed, 3 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/833fe163/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
index 2e8422b..d5349d6 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
@@ -119,36 +119,10 @@ class YumProvider(RPMBasedPackageProvider):
     :type repo_filter str|None
     :rtype list[list,]
     """
-    packages = []
-    cmd_filter = "| grep \"{0}\"".format(repo_filter) if repo_filter else ""
-
-    # tr '\n' '#' %s | sed -e 's/# / /g' | tr '#' '\n' - fix yum formatted output for default console width
-    cmd = AMBARI_SUDO_BINARY + " yum list installed {filter}|tr '\\n' '#' | sed -e 's/# / /g' | tr '#' '\\n'|awk '{printf \"%s;%s;%s\\n\", $1,$2,$3}'".replace("{filter}", cmd_filter)
-    result = self._call_with_timeout(cmd)
-    col_sep = ";"
-
-    """
-    command would return everything in following format:
-    
-    Loaded;plugins:;fastestmirror
-    Installed;Packages;
-    package_name;version;@Repo
-    ....
-    """
-
-    if result and 0 == result['retCode']:
-      raw_pkgs = result['out'].split("\n")
-
-      for line in raw_pkgs:
-        package_item = line.split(col_sep)
-
-        if len(package_item) < 3:
-          continue
-        elif not package_item[2].startswith("@"):
-          continue
 
-        package_item[2] = package_item[2][1:]
-        packages.append(package_item)
+    packages = self._lookup_packages([AMBARI_SUDO_BINARY, "yum", "list", "installed"], "Installed Packages")
+    if repo_filter:
+      packages = [item for item in packages if item[2].lower() == repo_filter.lower()]
 
     return packages
 


[2/7] ambari git commit: AMBARI-21620. Set the needed druid/hive properties via ambari (Slim Bouguerra via Swapan Shridhar).

Posted by jo...@apache.org.
AMBARI-21620. Set the needed druid/hive properties via ambari (Slim Bouguerra via Swapan Shridhar).


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2c368802
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2c368802
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2c368802

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: 2c3688024a0b431d11bdce2835606a3a999f5f4e
Parents: 7ad9617
Author: Swapan Shridhar <ss...@hortonworks.com>
Authored: Fri Aug 18 15:06:29 2017 -0700
Committer: Swapan Shridhar <ss...@hortonworks.com>
Committed: Fri Aug 18 15:07:47 2017 -0700

----------------------------------------------------------------------
 .../DRUID/0.9.2/package/scripts/druid.py        |  26 ++-
 .../HIVE/0.12.0.2.0/configuration/hive-site.xml | 218 +++++++++++++++++++
 .../HIVE/0.12.0.2.0/metainfo.xml                |   1 +
 .../0.12.0.2.0/package/scripts/params_linux.py  |  11 +
 .../stacks/HDP/2.6/services/stack_advisor.py    |  49 ++++-
 .../stacks/HDP/2.6/upgrades/config-upgrade.xml  |  14 ++
 .../test/python/stacks/2.6/DRUID/test_druid.py  |   8 +-
 .../stacks/2.6/common/test_stack_advisor.py     |  60 ++++-
 8 files changed, 371 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2c368802/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
index cc02519..42e6208 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
@@ -149,24 +149,25 @@ def ensure_hadoop_directories():
                         type="directory",
                         action="create_on_execute",
                         owner=params.druid_user,
+                        group='hadoop',
                         recursive_chown=True,
                         recursive_chmod=True
                         )
 
-    # create the segment storage dir
-    create_hadoop_directory(storage_dir)
+    # create the segment storage dir, users like hive from group hadoop need to write to this directory
+    create_hadoop_directory(storage_dir, mode=0775)
 
   # Create HadoopIndexTask hadoopWorkingPath
   hadoop_working_path = druid_middlemanager_config['druid.indexer.task.hadoopWorkingPath']
   if hadoop_working_path is not None:
     if hadoop_working_path.startswith(params.hdfs_tmp_dir):
-      params.HdfsResource(params.hdfs_tmp_dir,
-                           type="directory",
-                           action="create_on_execute",
-                           owner=params.hdfs_user,
-                           mode=0777,
-      )
-    create_hadoop_directory(hadoop_working_path)
+        params.HdfsResource(params.hdfs_tmp_dir,
+                            type="directory",
+                            action="create_on_execute",
+                            owner=params.hdfs_user,
+                            mode=0777,
+                            )
+    create_hadoop_directory(hadoop_working_path, mode=0775)
 
   # If HDFS is used for storing logs, create Index Task log directory
   indexer_logs_type = druid_common_config['druid.indexer.logs.type']
@@ -175,15 +176,16 @@ def ensure_hadoop_directories():
     create_hadoop_directory(indexer_logs_directory)
 
 
-def create_hadoop_directory(hadoop_dir):
+def create_hadoop_directory(hadoop_dir, mode=0755):
   import params
   params.HdfsResource(hadoop_dir,
                       type="directory",
                       action="create_on_execute",
                       owner=params.druid_user,
-                      mode=0755
+                      group='hadoop',
+                      mode=mode
                       )
-  Logger.info(format("Created Hadoop Directory [{hadoop_dir}]"))
+  Logger.info(format("Created Hadoop Directory [{hadoop_dir}], with mode [{mode}]"))
 
 
 def ensure_base_directories():

http://git-wip-us.apache.org/repos/asf/ambari/blob/2c368802/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
index e3fa6fd..cec74e4 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
@@ -446,6 +446,224 @@ limitations under the License.
     </depends-on>
     <on-ambari-upgrade add="false"/>
   </property>
+
+  <!-- Druid related properties -->
+  <property>
+    <name>hive.druid.broker.address.default</name>
+    <value>localhost:8082</value>
+    <description>Host name of druid router if any or broker</description>
+    <on-ambari-upgrade add="false"/>
+    <depends-on>
+      <property>
+        <type>druid-router</type>
+        <name>druid.port</name>
+      </property>
+    </depends-on>
+  </property>
+
+  <property>
+    <name>hive.druid.metadata.uri</name>
+    <value>jdbc:mysql://localhost:3355/druid</value>
+    <description>URI to connect to the database (for example jdbc:mysql://hostname:port/DBName)</description>
+    <on-ambari-upgrade add="false"/>
+    <depends-on>
+      <property>
+        <type>druid-common</type>
+        <name>druid.metadata.storage.connector.connectURI</name>
+      </property>
+    </depends-on>
+  </property>
+
+  <property>
+    <name>hive.druid.coordinator.address.default</name>
+    <value>localhost:8082</value>
+    <description>Host name of druid router if any or broker</description>
+    <on-ambari-upgrade add="false"/>
+    <depends-on>
+      <property>
+        <type>druid-coordinator</type>
+        <name>druid.port</name>
+      </property>
+    </depends-on>
+  </property>
+
+  <property>
+    <name>hive.druid.metadata.password</name>
+    <value>{{druid_metadata_password}}</value>
+    <property-type>PASSWORD</property-type>
+    <display-name>Druid Metadata Password</display-name>
+    <description>Druid meta data storage password</description>
+    <value-attributes>
+      <type>password</type>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+   <property>
+    <name>hive.druid.metadata.username</name>
+    <value>druid</value>
+    <description>Username used to connect to druid metadata storage</description>
+    <on-ambari-upgrade add="false"/>
+     <depends-on>
+      <property>
+        <type>druid-common</type>
+        <name>druid.metadata.storage.connector.user</name>
+      </property>
+    </depends-on>
+  </property>
+
+  <property>
+    <name>hive.druid.indexer.segments.granularity</name>
+    <display-name>Default Granularity for the Druid segments</display-name>
+    <value-attributes>
+      <type>value-list</type>
+      <entries>
+        <entry>
+          <value>YEAR</value>
+        </entry>
+        <entry>
+          <value>MONTH</value>
+        </entry>
+        <entry>
+          <value>WEEK</value>
+        </entry>
+        <entry>
+          <value>DAY</value>
+        </entry>
+        <entry>
+          <value>HOUR</value>
+        </entry>
+        <entry>
+          <value>MINUTE</value>
+        </entry>
+        <entry>
+          <value>SECOND</value>
+        </entry>
+      </entries>
+    </value-attributes>
+    <value>MINUTE</value>
+    <description>Default Granularity for the segments created by the Druid storage handler, this can be overridden per table using table property druid.segment.granularity </description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+   <property>
+    <name>hive.druid.indexer.partition.size.max</name>
+    <value>5000000</value>
+    <description>Maximum number of records per segment partition</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+   <property>
+    <name>hive.druid.indexer.memory.rownum.max</name>
+    <value>75000</value>
+    <description>Maximum number of records in memory while storing data in Druid</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>hive.druid.select.distribute</name>
+    <value>true</value>
+    <description>If it is set to true, we distribute the execution of Druid Select queries</description>
+    <on-ambari-upgrade add="false"/>
+    <value-attributes>
+      <type>boolean</type>
+    </value-attributes>
+  </property>
+
+  <property>
+    <name>hive.druid.basePersistDirectory</name>
+    <value></value>
+    <description>
+      Local temporary directory used to persist intermediate indexing state,
+      if empty (recommended) will default to JVM system property java.io.tmpdir.
+    </description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>hive.druid.storage.storageDirectory</name>
+    <value>{{druid_storage_dir}}</value>
+    <description>
+      Druid deep storage location for segments.
+    </description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hive.druid.metadata.db.type</name>
+    <display-name>Druid metadata storage type </display-name>
+    <value-attributes>
+      <overridable>false</overridable>
+      <type>value-list</type>
+      <entries>
+        <entry>
+          <value>mysql</value>
+          <label>MYSQL</label>
+        </entry>
+        <entry>
+          <value>postgresql</value>
+          <label>POSTGRESQL</label>
+        </entry>
+      </entries>
+    </value-attributes>
+    <value>mysql</value>
+    <depends-on>
+      <property>
+        <type>druid-common</type>
+        <name>druid.metadata.storage.type</name>
+      </property>
+    </depends-on>
+    <description>Druid metadata storage type</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>hive.druid.passiveWaitTimeMs</name>
+    <value>30000</value>
+    <description>
+      Wait time in ms default to 30 seconds.
+    </description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>hive.druid.working.directory</name>
+    <value>/tmp/druid-indexing</value>
+    <description>
+      Default hdfs working directory used to store some intermediate metadata.
+    </description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>hive.druid.maxTries</name>
+    <value>5</value>
+    <description>
+      Maximum number of http call retries before giving up.
+    </description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>hive.druid.bitmap.type</name>
+    <display-name>Druid metadata storage type </display-name>
+    <value-attributes>
+      <type>value-list</type>
+      <entries>
+        <entry>
+          <value>roaring</value>
+        </entry>
+        <entry>
+          <value>concise</value>
+        </entry>
+      </entries>
+    </value-attributes>
+    <value>roaring</value>
+    <description>Druid Coding algorithm use to encode the bitmaps</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
   <!-- This property is removed in HDP 2.5 and higher. -->
   <property>
     <name>atlas.rest.address</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/2c368802/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
index 1fd6ee9..34a0a0d 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
@@ -354,6 +354,7 @@
         <config-type>ranger-hive-security</config-type>
         <config-type>mapred-site</config-type>
         <config-type>application.properties</config-type>
+        <config-type>druid-common</config-type>
       </configuration-dependencies>
     </service>
   </services>

http://git-wip-us.apache.org/repos/asf/ambari/blob/2c368802/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
index 647beac..cc978c5 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
@@ -851,3 +851,14 @@ if security_enabled:
 # For ldap - hive_check
 hive_ldap_user= config['configurations']['hive-env'].get('alert_ldap_username','')
 hive_ldap_passwd=config['configurations']['hive-env'].get('alert_ldap_password','')
+# For druid metadata password
+druid_metadata_password = ""
+if 'druid-common' in config['configurations'] \
+        and 'druid.metadata.storage.connector.password' in config['configurations']['druid-common']:
+  druid_metadata_password = config['configurations']['druid-common']['druid.metadata.storage.connector.password']
+
+# For druid storage directory, hive will write segments here
+druid_storage_dir = ""
+if 'druid-common' in config['configurations'] \
+        and 'druid.storage.storageDirectory' in config['configurations']['druid-common']:
+  druid_storage_dir = config['configurations']['druid-common']['druid.storage.storageDirectory']

http://git-wip-us.apache.org/repos/asf/ambari/blob/2c368802/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
index 577e4f5..f39e3c9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
@@ -156,7 +156,7 @@ class HDP26StackAdvisor(HDP25StackAdvisor):
           # recommend HDFS as default deep storage
           extensions_load_list = self.addToList(extensions_load_list, "druid-hdfs-storage")
           putCommonProperty("druid.storage.type", "hdfs")
-          putCommonProperty("druid.storage.storageDirectory", "/user/druid/data")
+          putCommonProperty("druid.storage.storageDirectory", "/apps/druid/warehouse")
           # configure indexer logs configs
           putCommonProperty("druid.indexer.logs.type", "hdfs")
           putCommonProperty("druid.indexer.logs.directory", "/user/druid/logs")
@@ -607,6 +607,53 @@ class HDP26StackAdvisor(HDP25StackAdvisor):
         putHiveAtlasHookPropertyAttribute('atlas.jaas.ticketBased-KafkaClient.loginModuleName', 'delete', 'true')
         putHiveAtlasHookPropertyAttribute('atlas.jaas.ticketBased-KafkaClient.option.useTicketCache', 'delete', 'true')
 
+    # druid is not in list of services to be installed
+    servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
+    if 'DRUID' in servicesList:
+        putHiveSiteProperty = self.putProperty(configurations, "hive-site", services)
+        if 'druid-coordinator' in services['configurations']:
+            component_hosts = self.getHostsWithComponent("DRUID", 'DRUID_COORDINATOR', services, hosts)
+            if component_hosts is not None and len(component_hosts) > 0:
+                # pick the first
+                host = component_hosts[0]
+            druid_coordinator_host_port = str(host['Hosts']['host_name']) + ":" + str(
+                services['configurations']['druid-coordinator']['properties']['druid.port'])
+        else:
+            druid_coordinator_host_port = "localhost:8081"
+
+        if 'druid-router' in services['configurations']:
+            component_hosts = self.getHostsWithComponent("DRUID", 'DRUID_ROUTER', services, hosts)
+            if component_hosts is not None and len(component_hosts) > 0:
+                # pick the first
+                host = component_hosts[0]
+            print host
+            druid_broker_host_port = str(host['Hosts']['host_name']) + ":" + str(
+                services['configurations']['druid-router']['properties']['druid.port'])
+        elif 'druid-broker' in services['configurations']:
+            component_hosts = self.getHostsWithComponent("DRUID", 'DRUID_BROKER', services, hosts)
+            if component_hosts is not None and len(component_hosts) > 0:
+                # pick the first
+                host = component_hosts[0]
+            druid_broker_host_port = str(host['Hosts']['host_name']) + ":" + str(
+                services['configurations']['druid-broker']['properties']['druid.port'])
+        else:
+            druid_broker_host_port = "localhost:8083"
+
+        if 'druid-common' in services['configurations']:
+            druid_metadata_uri = services['configurations']['druid-common']['properties']['druid.metadata.storage.connector.connectURI']
+            druid_metadata_type = services['configurations']['druid-common']['properties']['druid.metadata.storage.type']
+            if 'druid.metadata.storage.connector.user' in services['configurations']['druid-common']['properties']:
+                druid_metadata_user = services['configurations']['druid-common']['properties']['druid.metadata.storage.connector.user']
+            else:
+                druid_metadata_user = ""
+
+        putHiveSiteProperty('hive.druid.broker.address.default', druid_broker_host_port)
+        putHiveSiteProperty('hive.druid.coordinator.address.default', druid_coordinator_host_port)
+        putHiveSiteProperty('hive.druid.metadata.uri', druid_metadata_uri)
+        putHiveSiteProperty('hive.druid.metadata.username', druid_metadata_user)
+        putHiveSiteProperty('hive.druid.metadata.db.type', druid_metadata_type)
+
+
   def recommendHBASEConfigurations(self, configurations, clusterData, services, hosts):
     super(HDP26StackAdvisor, self).recommendHBASEConfigurations(configurations, clusterData, services, hosts)
     if 'hbase-env' in services['configurations'] and 'hbase_user' in services['configurations']['hbase-env']['properties']:

http://git-wip-us.apache.org/repos/asf/ambari/blob/2c368802/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
index 9cb625c..c67e4cf 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
@@ -75,6 +75,20 @@
             <set key ="atlas.jaas.ticketBased-KafkaClient.option.useTicketCache" value="true"
               if-type="cluster-env" if-key="security_enabled" if-value="true"/>
           </definition>
+          <definition xsi:type="configure" id="hdp_2_6_maint_druid_config_for_hive_hook" summary="Updating druid hive related properties">
+            <type>hive-site</type>
+            <set key="hive.druid.metadata.password" value="{{druid_metadata_password}}" if-type="druid-common"/>
+            <set key="hive.druid.indexer.segments.granularity" value="MINUTE" if-type="druid-common"/>
+            <set key="hive.druid.indexer.partition.size.max" value="5000000" if-type="druid-common"/>
+            <set key="hive.druid.indexer.memory.rownum.max" value="75000" if-type="druid-common"/>
+            <set key="hive.druid.select.distribute" value="true" if-type="druid-common"/>
+            <set key="hive.druid.basePersistDirectory" value="" if-type="druid-common"/>
+            <set key="hive.druid.storage.storageDirectory" value="{{druid_storage_dir}}" if-type="druid-common"/>
+            <set key="hive.druid.passiveWaitTimeMs" value="30000" if-type="druid-common"/>
+            <set key="hive.druid.working.directory" value="/tmp/druid-indexing" if-type="druid-common"/>
+            <set key="hive.druid.bitmap.type" value="roaring" if-type="druid-common"/>
+
+          </definition>
         </changes>
       </component>
     </service>

http://git-wip-us.apache.org/repos/asf/ambari/blob/2c368802/ambari-server/src/test/python/stacks/2.6/DRUID/test_druid.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/DRUID/test_druid.py b/ambari-server/src/test/python/stacks/2.6/DRUID/test_druid.py
index 41b0bf5..28e67e9 100644
--- a/ambari-server/src/test/python/stacks/2.6/DRUID/test_druid.py
+++ b/ambari-server/src/test/python/stacks/2.6/DRUID/test_druid.py
@@ -597,6 +597,7 @@ class TestDruid(RMFTestCase):
                               principal_name = 'missing_principal',
                               user = 'hdfs',
                               owner = 'druid',
+                              group='hadoop',
                               hadoop_conf_dir = '/usr/hdp/current/hadoop-client/conf',
                               type = 'directory',
                               action = ['create_on_execute'], hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore',
@@ -620,7 +621,8 @@ class TestDruid(RMFTestCase):
                               type = 'directory',
                               action = ['create_on_execute'], hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore',
                               dfs_type = '',
-                              mode=0755
+                              group='hadoop',
+                              mode=0775
                               )
     self.assertResourceCalled('HdfsResource', '/tmp',
         security_enabled = False,
@@ -655,11 +657,12 @@ class TestDruid(RMFTestCase):
                               principal_name = 'missing_principal',
                               user = 'hdfs',
                               owner = 'druid',
+                              group='hadoop',
                               hadoop_conf_dir = '/usr/hdp/current/hadoop-client/conf',
                               type = 'directory',
                               action = ['create_on_execute'], hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore',
                               dfs_type = '',
-                              mode=0755
+                              mode=0775
                               )
 
     self.assertResourceCalled('HdfsResource', '/user/druid/logs',
@@ -673,6 +676,7 @@ class TestDruid(RMFTestCase):
                               principal_name = 'missing_principal',
                               user = 'hdfs',
                               owner = 'druid',
+                              group='hadoop',
                               hadoop_conf_dir = '/usr/hdp/current/hadoop-client/conf',
                               type = 'directory',
                               action = ['create_on_execute'], hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore',

http://git-wip-us.apache.org/repos/asf/ambari/blob/2c368802/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
index 3ba18d8..63e2229 100644
--- a/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
@@ -990,6 +990,22 @@ class TestHDP26StackAdvisor(TestCase):
       },
       "hive-atlas-application.properties" : {
         "properties": {}
+      },
+      "druid-coordinator": {
+        "properties": {'druid.port': 8081}
+      },
+      "druid-broker": {
+        "properties": {'druid.port': 8082}
+      },
+      "druid-common": {
+        "properties": {
+          "database_name": "druid",
+          "metastore_hostname": "c6401.ambari.apache.org",
+          "druid.metadata.storage.type": "mysql",
+          'druid.metadata.storage.connector.port': '3306',
+          'druid.metadata.storage.connector.user': 'druid',
+          'druid.metadata.storage.connector.connectURI': 'jdbc:mysql://c6401.ambari.apache.org:3306/druid?createDatabaseIfNotExist=true'
+        }
       }
     }
 
@@ -1053,6 +1069,37 @@ class TestHDP26StackAdvisor(TestCase):
               "service_version": "0.7.0"
             },
             "components": []
+          },
+          {
+            "StackServices": {
+              "service_name": "DRUID",
+            },
+            "components": [
+              {
+                "StackServiceComponents": {
+                  "component_name": "DRUID_COORDINATOR",
+                  "hostnames": ["c6401.ambari.apache.org"]
+                },
+              },
+              {
+                "StackServiceComponents": {
+                  "component_name": "DRUID_OVERLORD",
+                  "hostnames": ["c6401.ambari.apache.org"]
+                },
+              },
+              {
+                "StackServiceComponents": {
+                  "component_name": "DRUID_BROKER",
+                  "hostnames": ["c6401.ambari.apache.org"]
+                },
+              },
+              {
+                "StackServiceComponents": {
+                  "component_name": "DRUID_ROUTER",
+                  "hostnames": ["c6401.ambari.apache.org"]
+                },
+              }
+            ]
           }
         ],
       "Versions": {
@@ -1143,7 +1190,12 @@ class TestHDP26StackAdvisor(TestCase):
           'hive.security.metastore.authorization.manager': 'org.apache.hadoop.hive.ql.security.authorization.StorageBasedAuthorizationProvider',
           'hive.exec.dynamic.partition.mode': 'strict',
           'hive.optimize.sort.dynamic.partition': 'false',
-          'hive.server2.enable.doAs': 'false'
+          'hive.server2.enable.doAs': 'false',
+          'hive.druid.broker.address.default': 'c6401.ambari.apache.org:8082',
+          'hive.druid.coordinator.address.default': 'c6401.ambari.apache.org:8081',
+          'hive.druid.metadata.db.type': 'mysql',
+          'hive.druid.metadata.uri': 'jdbc:mysql://c6401.ambari.apache.org:3306/druid?createDatabaseIfNotExist=true',
+          'hive.druid.metadata.username': 'druid',
         },
         'property_attributes': {
           'hive.tez.container.size': {
@@ -1240,6 +1292,12 @@ class TestHDP26StackAdvisor(TestCase):
       'properties': {}
     }
 
+    # case there is router in the stack
+    services['configurations']['druid-router'] = {}
+    services['configurations']['druid-router']['properties'] = {}
+    services['configurations']['druid-router']['properties']['druid.port'] = 8083
+    expected['hive-site']['properties']['hive.druid.broker.address.default'] = 'c6401.ambari.apache.org:8083'
+
     recommendedConfigurations = {}
     self.stackAdvisor.recommendHIVEConfigurations(recommendedConfigurations, clusterData, services, hosts)
     self.assertEquals(recommendedConfigurations, expected)


[4/7] ambari git commit: AMBARI-21761. VDF should support redhat-ppc6 and redhat-ppc7 OS types (ncole)

Posted by jo...@apache.org.
AMBARI-21761. VDF should support redhat-ppc6 and redhat-ppc7 OS types (ncole)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/496cfe04
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/496cfe04
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/496cfe04

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: 496cfe04e3a7f2ad3884d9ba9801e08e0168b89c
Parents: 833fe16
Author: Nate Cole <nc...@hortonworks.com>
Authored: Sat Aug 19 08:03:02 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Sat Aug 19 08:03:02 2017 -0400

----------------------------------------------------------------------
 ambari-server/src/main/resources/version_definition.xsd | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/496cfe04/ambari-server/src/main/resources/version_definition.xsd
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/version_definition.xsd b/ambari-server/src/main/resources/version_definition.xsd
index 9710c90..851e0d5 100644
--- a/ambari-server/src/main/resources/version_definition.xsd
+++ b/ambari-server/src/main/resources/version_definition.xsd
@@ -52,6 +52,8 @@
     <xs:restriction base="xs:string">
       <xs:enumeration value="redhat6" />
       <xs:enumeration value="redhat7" />
+      <xs:enumeration value="redhat-ppc6" />
+      <xs:enumeration value="redhat-ppc7" />
       <xs:enumeration value="debian6" />
       <xs:enumeration value="debian7" />
       <xs:enumeration value="ubuntu12" />


[5/7] ambari git commit: AMBARI-21525. Test Fix. EU failure: Oozie service check fails if Falcon is not installed.(vbrodetskyi)

Posted by jo...@apache.org.
AMBARI-21525. Test Fix. EU failure: Oozie service check fails if Falcon is not installed.(vbrodetskyi)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1db9c4e9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1db9c4e9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1db9c4e9

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: 1db9c4e99c68860fa85ef48c743e383c66b62ef7
Parents: 496cfe0
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Mon Aug 21 14:34:28 2017 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Mon Aug 21 14:34:28 2017 +0300

----------------------------------------------------------------------
 .../stacks/2.5/common/test_stack_advisor.py     | 107 ++++++++++++++++++-
 1 file changed, 105 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1db9c4e9/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
index 9f75f9d..fd96a13 100644
--- a/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
@@ -5892,12 +5892,32 @@ class TestHDP25StackAdvisor(TestCase):
     clusterData = {
       "components" : []
     }
+    services = {
+      "services": [
+        {
+          "StackServices": {
+            "service_name": "OOZIE"
+          }, "components": []
+        },
+        ],
+      "configurations": configurations,
+      "forced-configurations": []
+    }
     expected = {
-      "oozie-site": {"properties":{}},
+      "oozie-site": {"properties":{}, 'property_attributes':
+        {'oozie.service.ELService.ext.functions.workflow': {'delete': 'true'},
+         'oozie.service.ELService.ext.functions.coord-job-submit-instances': {'delete': 'true'},
+         'oozie.service.ELService.ext.functions.coord-action-start': {'delete': 'true'},
+         'oozie.service.ELService.ext.functions.coord-job-submit-data': {'delete': 'true'},
+         'oozie.service.ELService.ext.functions.coord-sla-submit': {'delete': 'true'},
+         'oozie.service.ELService.ext.functions.coord-action-create': {'delete': 'true'},
+         'oozie.service.ELService.ext.functions.coord-action-create-inst': {'delete': 'true'},
+         'oozie.service.ELService.ext.functions.coord-sla-create': {'delete': 'true'},
+         'oozie.service.HadoopAccessorService.supported.filesystems': {'delete': 'true'}}},
       "oozie-env": {"properties":{}}
     }
 
-    self.stackAdvisor.recommendOozieConfigurations(configurations, clusterData, {"configurations":{}}, None)
+    self.stackAdvisor.recommendOozieConfigurations(configurations, clusterData, services, None)
     self.assertEquals(configurations, expected)
 
 
@@ -5928,6 +5948,89 @@ class TestHDP25StackAdvisor(TestCase):
     expected = {
       "oozie-site": {
         "properties": {
+          "oozie.service.ELService.ext.functions.coord-action-create" : 'now=org.apache.oozie.extensions.OozieELExtensions#ph2_now, \
+                            today=org.apache.oozie.extensions.OozieELExtensions#ph2_today, \
+                            yesterday=org.apache.oozie.extensions.OozieELExtensions#ph2_yesterday, \
+                            currentWeek=org.apache.oozie.extensions.OozieELExtensions#ph2_currentWeek, \
+                            lastWeek=org.apache.oozie.extensions.OozieELExtensions#ph2_lastWeek, \
+                            currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_currentMonth, \
+                            lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_lastMonth, \
+                            currentYear=org.apache.oozie.extensions.OozieELExtensions#ph2_currentYear, \
+                            lastYear=org.apache.oozie.extensions.OozieELExtensions#ph2_lastYear, \
+                            latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo, \
+                            future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo, \
+                            formatTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_formatTime, \
+                            user=org.apache.oozie.coord.CoordELFunctions#coord_user',
+          "oozie.service.ELService.ext.functions.coord-action-create-inst" : 'now=org.apache.oozie.extensions.OozieELExtensions#ph2_now_inst, \
+                            today=org.apache.oozie.extensions.OozieELExtensions#ph2_today_inst, \
+                            yesterday=org.apache.oozie.extensions.OozieELExtensions#ph2_yesterday_inst, \
+                            currentWeek=org.apache.oozie.extensions.OozieELExtensions#ph2_currentWeek_inst, \
+                            lastWeek=org.apache.oozie.extensions.OozieELExtensions#ph2_lastWeek_inst, \
+                            currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_currentMonth_inst, \
+                            lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_lastMonth_inst, \
+                            currentYear=org.apache.oozie.extensions.OozieELExtensions#ph2_currentYear_inst, \
+                            lastYear=org.apache.oozie.extensions.OozieELExtensions#ph2_lastYear_inst, \
+                            latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo, \
+                            future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo, \
+                            formatTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_formatTime, \
+                            user=org.apache.oozie.coord.CoordELFunctions#coord_user',
+          "oozie.service.ELService.ext.functions.coord-action-start" : 'now=org.apache.oozie.extensions.OozieELExtensions#ph2_now, \
+                            today=org.apache.oozie.extensions.OozieELExtensions#ph2_today, \
+                            yesterday=org.apache.oozie.extensions.OozieELExtensions#ph2_yesterday, \
+                            currentWeek=org.apache.oozie.extensions.OozieELExtensions#ph2_currentWeek, \
+                            lastWeek=org.apache.oozie.extensions.OozieELExtensions#ph2_lastWeek, \
+                            currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_currentMonth, \
+                            lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_lastMonth, \
+                            currentYear=org.apache.oozie.extensions.OozieELExtensions#ph2_currentYear, \
+                            lastYear=org.apache.oozie.extensions.OozieELExtensions#ph2_lastYear, \
+                            latest=org.apache.oozie.coord.CoordELFunctions#ph3_coord_latest, \
+                            future=org.apache.oozie.coord.CoordELFunctions#ph3_coord_future, \
+                            dataIn=org.apache.oozie.extensions.OozieELExtensions#ph3_dataIn, \
+                            instanceTime=org.apache.oozie.coord.CoordELFunctions#ph3_coord_nominalTime, \
+                            dateOffset=org.apache.oozie.coord.CoordELFunctions#ph3_coord_dateOffset, \
+                            formatTime=org.apache.oozie.coord.CoordELFunctions#ph3_coord_formatTime, \
+                            user=org.apache.oozie.coord.CoordELFunctions#coord_user',
+          "oozie.service.ELService.ext.functions.coord-job-submit-data" : 'now=org.apache.oozie.extensions.OozieELExtensions#ph1_now_echo, \
+                            today=org.apache.oozie.extensions.OozieELExtensions#ph1_today_echo, \
+                            yesterday=org.apache.oozie.extensions.OozieELExtensions#ph1_yesterday_echo, \
+                            currentWeek=org.apache.oozie.extensions.OozieELExtensions#ph1_currentWeek_echo, \
+                            lastWeek=org.apache.oozie.extensions.OozieELExtensions#ph1_lastWeek_echo, \
+                            currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_currentMonth_echo, \
+                            lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_lastMonth_echo, \
+                            currentYear=org.apache.oozie.extensions.OozieELExtensions#ph1_currentYear_echo, \
+                            lastYear=org.apache.oozie.extensions.OozieELExtensions#ph1_lastYear_echo, \
+                            dataIn=org.apache.oozie.extensions.OozieELExtensions#ph1_dataIn_echo, \
+                            instanceTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_nominalTime_echo_wrap, \
+                            formatTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_formatTime_echo, \
+                            dateOffset=org.apache.oozie.coord.CoordELFunctions#ph1_coord_dateOffset_echo, \
+                            user=org.apache.oozie.coord.CoordELFunctions#coord_user',
+          "oozie.service.ELService.ext.functions.coord-job-submit-instances" : 'now=org.apache.oozie.extensions.OozieELExtensions#ph1_now_echo, \
+                            today=org.apache.oozie.extensions.OozieELExtensions#ph1_today_echo, \
+                            yesterday=org.apache.oozie.extensions.OozieELExtensions#ph1_yesterday_echo,\
+                            currentWeek=org.apache.oozie.extensions.OozieELExtensions#ph1_currentWeek_echo, \
+                            lastWeek=org.apache.oozie.extensions.OozieELExtensions#ph1_lastWeek_echo, \
+                            currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_currentMonth_echo, \
+                            lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_lastMonth_echo, \
+                            currentYear=org.apache.oozie.extensions.OozieELExtensions#ph1_currentYear_echo, \
+                            lastYear=org.apache.oozie.extensions.OozieELExtensions#ph1_lastYear_echo, \
+                            formatTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_formatTime_echo, \
+                            latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo, \
+                            future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo',
+          "oozie.service.ELService.ext.functions.coord-sla-create" : 'instanceTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_nominalTime, \
+                            user=org.apache.oozie.coord.CoordELFunctions#coord_user',
+          "oozie.service.ELService.ext.functions.coord-sla-submit" : 'instanceTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_nominalTime_echo_fixed, \
+                            user=org.apache.oozie.coord.CoordELFunctions#coord_user',
+          'oozie.service.ELService.ext.functions.workflow' : 'now=org.apache.oozie.extensions.OozieELExtensions#ph1_now_echo, \
+                            today=org.apache.oozie.extensions.OozieELExtensions#ph1_today_echo, \
+                            yesterday=org.apache.oozie.extensions.OozieELExtensions#ph1_yesterday_echo, \
+                            currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_currentMonth_echo, \
+                            lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_lastMonth_echo, \
+                            currentYear=org.apache.oozie.extensions.OozieELExtensions#ph1_currentYear_echo, \
+                            lastYear=org.apache.oozie.extensions.OozieELExtensions#ph1_lastYear_echo, \
+                            formatTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_formatTime_echo, \
+                            latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo, \
+                            future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo',
+          "oozie.service.HadoopAccessorService.supported.filesystems" : "*",
           "oozie.services.ext": "org.apache.oozie.service.JMSAccessorService," +
                                 "org.apache.oozie.service.PartitionDependencyManagerService," +
                                 "org.apache.oozie.service.HCatAccessorService",


[6/7] ambari git commit: AMBARI-21762 Sometimes alerts order is not correctly arranged if ordering by Status. (atkach)

Posted by jo...@apache.org.
AMBARI-21762 Sometimes alerts order is not correctly arranged if ordering by Status. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/596b145d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/596b145d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/596b145d

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: 596b145db79735263fbd88e56f521edfb90fc77b
Parents: 1db9c4e
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Aug 21 16:11:44 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Mon Aug 21 16:13:07 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/views/common/sort_view.js        | 26 ++++++++++-
 .../app/views/main/alert_definitions_view.js    |  9 ++--
 ambari-web/test/views/common/sort_view_test.js  | 49 +++++++++++++++++++-
 3 files changed, 78 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/596b145d/ambari-web/app/views/common/sort_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/sort_view.js b/ambari-web/app/views/common/sort_view.js
index 0fc1db7..290a12f 100644
--- a/ambari-web/app/views/common/sort_view.js
+++ b/ambari-web/app/views/common/sort_view.js
@@ -30,6 +30,8 @@ var App = require('app');
 var wrapperView = Em.View.extend({
   tagName: 'tr',
 
+  name: 'SortWrapperView',
+
   classNames: ['sort-wrapper'],
 
   willInsertElement: function () {
@@ -87,9 +89,10 @@ var wrapperView = Em.View.extend({
    * @param property {object}
    * @param order {Boolean} true - DESC, false - ASC
    * @param returnSorted {Boolean}
+   * @param content {Array}
    */
-  sort: function (property, order, returnSorted) {
-    var content = this.get('content').toArray();
+  sort: function (property, order, returnSorted, content) {
+    content = content || this.get('content').toArray();
     var sortFunc = this.getSortFunc(property, order);
     var status = order ? 'sorting_desc' : 'sorting_asc';
 
@@ -122,6 +125,25 @@ var wrapperView = Em.View.extend({
   }.observes('controller.contentUpdater'),
 
   /**
+   *
+   * @param {Em.Object[]} content
+   * @returns {Em.Object[]}
+   */
+  getSortedContent: function(content) {
+    if (!this.get('isSorting') && content.get('length')) {
+      var activeSortViews = this.get('childViews').rejectProperty('status', 'sorting');
+      if (activeSortViews[0]) {
+        var status = activeSortViews[0].get('status');
+        this.set('isSorting', true);
+        content = this.sort(activeSortViews[0], status === 'sorting_desc', true, content);
+        this.set('isSorting', false);
+        activeSortViews[0].set('status', status);
+      }
+    }
+    return content;
+  },
+
+  /**
    * reset all sorts fields
    */
   resetSort: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/596b145d/ambari-web/app/views/main/alert_definitions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alert_definitions_view.js b/ambari-web/app/views/main/alert_definitions_view.js
index 9fb517f..ec52075 100644
--- a/ambari-web/app/views/main/alert_definitions_view.js
+++ b/ambari-web/app/views/main/alert_definitions_view.js
@@ -28,11 +28,14 @@ App.MainAlertDefinitionsView = App.TableView.extend({
 
   contentObs: function () {
     Em.run.once(this, this.contentObsOnce);
-  }.observes('controller.content.[]', 'App.router.clusterController.isAlertsLoaded'),
+  }.observes('controller.content.@each.summary', 'App.router.clusterController.isAlertsLoaded'),
 
   contentObsOnce: function() {
     var content = this.get('controller.content') && App.get('router.clusterController.isAlertsLoaded') ?
-      this.get('controller.content').toArray().sort(App.AlertDefinition.getSortDefinitionsByStatus(true)) : [];
+      this.get('controller.content').toArray() : [];
+    if (this.get('childViews').someProperty('name', 'SortWrapperView')) {
+      content = this.get('childViews').findProperty('name', 'SortWrapperView').getSortedContent(content);
+    }
     this.set('content', content);
   },
 
@@ -46,7 +49,7 @@ App.MainAlertDefinitionsView = App.TableView.extend({
     if (savedSortConditions.everyProperty('status', 'sorting')) {
       savedSortConditions.push({
         name: "summary",
-        status: "sorting_asc"
+        status: "sorting_desc"
       });
       App.db.setSortingStatuses(controllerName, savedSortConditions);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/596b145d/ambari-web/test/views/common/sort_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/sort_view_test.js b/ambari-web/test/views/common/sort_view_test.js
index a21a352..9d095ec 100644
--- a/ambari-web/test/views/common/sort_view_test.js
+++ b/ambari-web/test/views/common/sort_view_test.js
@@ -182,6 +182,53 @@ describe('#wrapperView', function () {
       });
 
     })
-  })
+  });
+
+  describe('#getSortedContent', function() {
+    var wrapperView;
+    var content = [
+      Em.Object.create({
+        id: 1
+      }),
+      Em.Object.create({
+        id: 2
+      })
+    ];
+
+    beforeEach(function() {
+      wrapperView = sort.wrapperView.create({
+        childViews: [],
+        isSorting: false
+      });
+      sinon.stub(wrapperView, 'sort', function(arg1, arg2, arg3, arg4) {
+        return arg4.reverse();
+      });
+    });
+    afterEach(function() {
+      wrapperView.sort.restore();
+    });
+
+    it('should return content without sorting', function() {
+      expect(wrapperView.getSortedContent(content)).to.be.eql(content);
+      expect(wrapperView.sort.called).to.be.false;
+    });
+
+    it('should return content with sorting', function() {
+      wrapperView.set('childViews', [
+        Em.Object.create({
+          status: 'sorting_desc'
+        })
+      ]);
+      expect(wrapperView.getSortedContent(content)).to.be.eql(content.reverse());
+      expect(wrapperView.sort.calledWith(
+        Em.Object.create({
+          status: 'sorting_desc'
+        }),
+        true,
+        true,
+        content
+      )).to.be.true;
+    });
+  });
 
 });
\ No newline at end of file