Browse Source

AMBARI-14760. Change the UI so that we do not have to parse the JDBC URL to extract the host name (alexantonenko)

Alex Antonenko 9 years ago
parent
commit
1d2b8ef152
28 changed files with 413 additions and 270 deletions
  1. 7 1
      ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
  2. 16 0
      ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
  3. 0 5
      ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
  4. 16 0
      ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-site.xml
  5. 16 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
  6. 58 1
      ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py
  7. 23 7
      ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
  8. 6 0
      ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/configuration/hive-env.xml
  9. 0 11
      ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/OOZIE/configuration/oozie-env.xml
  10. 14 0
      ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/stack_advisor.py
  11. 24 7
      ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/HIVE/configuration/hive-site.xml
  12. 41 7
      ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/stack_advisor.py
  13. 0 11
      ambari-server/src/main/resources/stacks/HDPWIN/2.3/services/OOZIE/configuration/oozie-env.xml
  14. 31 2
      ambari-server/src/main/resources/stacks/HDPWIN/2.3/services/OOZIE/configuration/oozie-site.xml
  15. 18 1
      ambari-server/src/main/resources/stacks/HDPWIN/2.3/services/stack_advisor.py
  16. 98 4
      ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
  17. 5 5
      ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
  18. 0 17
      ambari-web/app/controllers/main/service/info/configs.js
  19. 7 7
      ambari-web/app/controllers/wizard/step7_controller.js
  20. 1 21
      ambari-web/app/data/HDP2/ui_properties.js
  21. 1 5
      ambari-web/app/data/db_properties_info.js
  22. 3 11
      ambari-web/app/models/configs/objects/service_config_property.js
  23. 0 2
      ambari-web/app/utils/configs/config_initializer.js
  24. 2 4
      ambari-web/app/utils/configs/database.js
  25. 2 50
      ambari-web/app/views/common/controls_view.js
  26. 23 4
      ambari-web/test/controllers/wizard/step7_test.js
  27. 1 29
      ambari-web/test/utils/configs/config_initializer_test.js
  28. 0 56
      ambari-web/test/views/common/controls_view_test.js

+ 7 - 1
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml

@@ -58,6 +58,12 @@
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <type>hive-env</type>
+        <name>hive_database</name>
+      </property>
+    </depends-on>
   </property>
   <property>
     <name>hive_database</name>
@@ -225,5 +231,5 @@ export METASTORE_PORT={{hive_metastore_port}}
       <type>content</type>
     </value-attributes>
   </property>
-  
+
 </configuration>

+ 16 - 0
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml

@@ -51,6 +51,16 @@ limitations under the License.
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <name>hive_database</name>
+        <type>hive-env</type>
+      </property>
+      <property>
+        <name>ambari.hive.db.schema.name</name>
+        <type>hive-site</type>
+      </property>
+    </depends-on>
   </property>
 
   <property>
@@ -61,6 +71,12 @@ limitations under the License.
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <name>hive_database</name>
+        <type>hive-env</type>
+      </property>
+    </depends-on>
   </property>
 
   <property>

+ 0 - 5
ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml

@@ -45,11 +45,6 @@
       <overridable>false</overridable>
     </value-attributes>
   </property>
-  <property>
-    <name>oozie_derby_database</name>
-    <value>Derby</value>
-    <description>Oozie Derby Database</description>
-  </property>
   <property>
     <name>oozie_data_dir</name>
     <value>/hadoop/oozie/data</value>

+ 16 - 0
ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-site.xml

@@ -140,6 +140,12 @@
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <type>oozie-env</type>
+        <name>oozie_database</name>
+      </property>
+    </depends-on>
   </property>
 
   <property>
@@ -152,6 +158,16 @@
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <type>oozie-env</type>
+        <name>oozie_database</name>
+      </property>
+      <property>
+        <type>oozie-site</type>
+        <name>oozie.db.schema.name</name>
+      </property>
+    </depends-on>
   </property>
 
   <property>

+ 16 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py

@@ -257,9 +257,9 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
         if mp == mountPoints[i]:
           if mountPointDiskAvailableSpace[i] > maxFreeVolumeSize:
             maxFreeVolumeSize = mountPointDiskAvailableSpace[i]
-      
+
     putHDFSSiteProperty('dfs.datanode.du.reserved', maxFreeVolumeSize * 1024 / 8) #Bytes
-    
+
     # recommendations for "hadoop.proxyuser.*.hosts", "hadoop.proxyuser.*.groups" properties in core-site
     self.recommendHadoopProxyUsers(configurations, services, hosts)
 
@@ -1421,6 +1421,20 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
         parentValidators[service] = {}
       parentValidators[service].update(configsDict)
 
+  def checkSiteProperties(self, siteProperties, *propertyNames):
+    """
+    Check if properties defined in site properties.
+    :param siteProperties: config properties dict
+    :param *propertyNames: property names to validate
+    :returns: True if all properties defined, in other cases returns False
+    """
+    if siteProperties is None:
+      return False
+    for name in propertyNames:
+      if not (name in siteProperties):
+        return False
+    return True
+
 def getOldValue(self, services, configType, propertyName):
   if services:
     if 'changed-configurations' in services.keys():

+ 58 - 1
ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py

@@ -30,6 +30,11 @@ class HDP21StackAdvisor(HDP206StackAdvisor):
     return parentRecommendConfDict
 
   def recommendOozieConfigurations(self, configurations, clusterData, services, hosts):
+    oozieSiteProperties = getSiteProperties(services['configurations'], 'oozie-site')
+    oozieEnvProperties = getSiteProperties(services['configurations'], 'oozie-env')
+    putOozieProperty = self.putProperty(configurations, "oozie-site", services)
+    putOozieEnvProperty = self.putProperty(configurations, "oozie-env", services)
+
     if "FALCON_SERVER" in clusterData["components"]:
       putOozieSiteProperty = self.putProperty(configurations, "oozie-site", services)
       falconUser = None
@@ -56,17 +61,38 @@ class HDP21StackAdvisor(HDP206StackAdvisor):
                         "org.apache.oozie.service.JMSAccessorService," +
                         "org.apache.oozie.service.PartitionDependencyManagerService," +
                         "org.apache.oozie.service.HCatAccessorService")
+    if oozieEnvProperties and oozieSiteProperties and self.checkSiteProperties(oozieSiteProperties, 'oozie.service.JPAService.jdbc.driver') and self.checkSiteProperties(oozieEnvProperties, 'oozie_database'):
+      putOozieProperty('oozie.service.JPAService.jdbc.driver', self.getDBDriver(oozieEnvProperties['oozie_database']))
+    if oozieSiteProperties and oozieEnvProperties and self.checkSiteProperties(oozieSiteProperties, 'oozie.db.schema.name', 'oozie.service.JPAService.jdbc.url') and self.checkSiteProperties(oozieEnvProperties, 'oozie_database'):
+      oozieServerHost = self.getHostWithComponent('OOZIE', 'OOZIE_SERVER', services, hosts)
+      if oozieServerHost is not None:
+        dbConnection = self.getDBConnectionString(oozieEnvProperties['oozie_database']).format(oozieServerHost['Hosts']['host_name'], oozieSiteProperties['oozie.db.schema.name'])
+        putOozieProperty('oozie.service.JPAService.jdbc.url', dbConnection)
 
   def recommendHiveConfigurations(self, configurations, clusterData, services, hosts):
+    hiveSiteProperties = getSiteProperties(services['configurations'], 'hive-site')
+    hiveEnvProperties = getSiteProperties(services['configurations'], 'hive-env')
     containerSize = clusterData['mapMemory'] if clusterData['mapMemory'] > 2048 else int(clusterData['reduceMemory'])
     containerSize = min(clusterData['containers'] * clusterData['ramPerContainer'], containerSize)
     container_size_bytes = int(containerSize)*1024*1024
+    putHiveEnvProperty = self.putProperty(configurations, "hive-env", services)
     putHiveProperty = self.putProperty(configurations, "hive-site", services)
     putHiveProperty('hive.auto.convert.join.noconditionaltask.size', int(round(container_size_bytes / 3)))
     putHiveProperty('hive.tez.java.opts', "-server -Xmx" + str(int(round((0.8 * containerSize) + 0.5)))
                     + "m -Djava.net.preferIPv4Stack=true -XX:NewRatio=8 -XX:+UseNUMA -XX:+UseParallelGC -XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps")
     putHiveProperty('hive.tez.container.size', containerSize)
 
+    # javax.jdo.option.ConnectionURL recommendations
+    if hiveEnvProperties and self.checkSiteProperties(hiveEnvProperties, 'hive_database', 'hive_database_type'):
+      putHiveEnvProperty('hive_database_type', self.getDBTypeAlias(hiveEnvProperties['hive_database']))
+    if hiveEnvProperties and hiveSiteProperties and self.checkSiteProperties(hiveSiteProperties, 'javax.jdo.option.ConnectionDriverName') and self.checkSiteProperties(hiveEnvProperties, 'hive_database'):
+      putHiveProperty('javax.jdo.option.ConnectionDriverName', self.getDBDriver(hiveEnvProperties['hive_database']))
+    if hiveSiteProperties and hiveEnvProperties and self.checkSiteProperties(hiveSiteProperties, 'ambari.hive.db.schema.name', 'javax.jdo.option.ConnectionURL') and self.checkSiteProperties(hiveEnvProperties, 'hive_database'):
+      hiveMSHost = self.getHostWithComponent('HIVE', 'HIVE_METASTORE', services, hosts)
+      if hiveMSHost is not None:
+        dbConnection = self.getDBConnectionString(hiveEnvProperties['hive_database']).format(hiveMSHost['Hosts']['host_name'], hiveSiteProperties['ambari.hive.db.schema.name'])
+        putHiveProperty('javax.jdo.option.ConnectionURL', dbConnection)
+
   def recommendTezConfigurations(self, configurations, clusterData, services, hosts):
     putTezProperty = self.putProperty(configurations, "tez-site")
     putTezProperty("tez.am.resource.memory.mb", int(clusterData['amMemory']))
@@ -116,4 +142,35 @@ class HDP21StackAdvisor(HDP206StackAdvisor):
                         {"config-name": 'tez.am.java.opts', "item": self.validateXmxValue(properties, recommendedDefaults, 'tez.am.java.opts')} ]
     return self.toConfigurationValidationProblems(validationItems, "tez-site")
 
-
+  def getDBDriver(self, databaseType):
+    driverDict = {
+      'NEW MYSQL DATABASE': 'com.mysql.jdbc.Driver',
+      'NEW DERBY DATABASE': 'org.apache.derby.jdbc.EmbeddedDriver',
+      'EXISTING MYSQL DATABASE': 'com.mysql.jdbc.Driver',
+      'EXISTING POSTGRESQL DATABASE': 'org.postgresql.Driver',
+      'EXISTING ORACLE DATABASE': 'oracle.jdbc.driver.OracleDriver',
+      'EXISTING SQL ANYWHERE DATABASE': 'sap.jdbc4.sqlanywhere.IDriver'
+    }
+    return driverDict.get(databaseType.upper())
+
+  def getDBConnectionString(self, databaseType):
+    driverDict = {
+      'NEW MYSQL DATABASE': 'jdbc:mysql://{0}/{1}?createDatabaseIfNotExist=true',
+      'NEW DERBY DATABASE': 'jdbc:derby:${{oozie.data.dir}}/${{oozie.db.schema.name}}-db;create=true',
+      'EXISTING MYSQL DATABASE': 'jdbc:mysql://{0}/{1}',
+      'EXISTING POSTGRESQL DATABASE': 'jdbc:postgresql://{0}:5432/{1}',
+      'EXISTING ORACLE DATABASE': 'jdbc:oracle:thin:@//{0}:1521/{1}',
+      'EXISTING SQL ANYWHERE DATABASE': 'jdbc:sqlanywhere:host={0};database={1}'
+    }
+    return driverDict.get(databaseType.upper())
+
+  def getDBTypeAlias(self, databaseType):
+    driverDict = {
+      'NEW MYSQL DATABASE': 'mysql',
+      'NEW DERBY DATABASE': 'derby',
+      'EXISTING MYSQL DATABASE': 'mysql',
+      'EXISTING POSTGRESQL DATABASE': 'postgres',
+      'EXISTING ORACLE DATABASE': 'oracle',
+      'EXISTING SQL ANYWHERE DATABASE': 'sqla'
+    }
+    return driverDict.get(databaseType.upper())

+ 23 - 7
ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml

@@ -110,7 +110,7 @@ limitations under the License.
     <description>The delegation token store implementation.
       Set to org.apache.hadoop.hive.thrift.ZooKeeperTokenStore for load-balanced cluster.</description>
   </property>
-  
+
   <property>
     <name>hive.cluster.delegation.token.store.zookeeper.connectString</name>
     <value>localhost:2181</value>
@@ -129,7 +129,7 @@ limitations under the License.
       <type>boolean</type>
     </value-attributes>
   </property>
-  
+
   <property>
     <name>fs.hdfs.impl.disable.cache</name>
     <value>false</value>
@@ -368,6 +368,16 @@ limitations under the License.
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <name>hive_database</name>
+        <type>hive-env</type>
+      </property>
+      <property>
+        <name>ambari.hive.db.schema.name</name>
+        <type>hive-site</type>
+      </property>
+    </depends-on>
   </property>
 
   <property>
@@ -428,6 +438,12 @@ limitations under the License.
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <name>hive_database</name>
+        <type>hive-env</type>
+      </property>
+    </depends-on>
   </property>
 
   <property>
@@ -1652,9 +1668,9 @@ limitations under the License.
     <name>hive.exec.orc.encoding.strategy</name>
     <value>SPEED</value>
     <description>
-      Define the encoding strategy to use while writing data. Changing this 
-      will only affect the light weight encoding for integers. This flag will not change 
-      the compression level of higher level compression codec (like ZLIB). Possible 
+      Define the encoding strategy to use while writing data. Changing this
+      will only affect the light weight encoding for integers. This flag will not change
+      the compression level of higher level compression codec (like ZLIB). Possible
       options are SPEED and COMPRESSION.
     </description>
     <display-name>ORC Encoding Strategy</display-name>
@@ -1684,7 +1700,7 @@ limitations under the License.
     <name>hive.exec.orc.compression.strategy</name>
     <value>SPEED</value>
     <description>
-      Define the compression strategy to use while writing data. This changes the 
+      Define the compression strategy to use while writing data. This changes the
       compression level of higher level compression codec (like ZLIB).
     </description>
     <display-name>ORC Compression Strategy</display-name>
@@ -1714,7 +1730,7 @@ limitations under the License.
     <name>hive.vectorized.execution.reduce.enabled</name>
     <value>false</value>
     <description>
-      This flag should be set to true to enable vectorized mode of the reduce-side of 
+      This flag should be set to true to enable vectorized mode of the reduce-side of
       query execution.
     </description>
     <display-name>Enable Reduce Vectorization</display-name>

+ 6 - 0
ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/configuration/hive-env.xml

@@ -29,6 +29,12 @@
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <type>hive-env</type>
+        <name>hive_database</name>
+      </property>
+    </depends-on>
   </property>
   <property>
     <name>hive_database</name>

+ 0 - 11
ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/OOZIE/configuration/oozie-env.xml

@@ -25,17 +25,6 @@
     <name>oozie_user</name>
     <deleted>true</deleted>
   </property>
-  <property>
-    <name>oozie_hostname</name>
-    <value></value>
-    <display-name>Database Host</display-name>
-    <description>
-      Specify the host on which the OOZIE database is hosted.
-    </description>
-    <value-attributes>
-      <overridable>false</overridable>
-    </value-attributes>
-  </property>
   <property>
     <name>oozie_database</name>
     <value>Existing MSSQL Server database with SQL authentication</value>

+ 14 - 0
ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/stack_advisor.py

@@ -702,6 +702,20 @@ class HDPWIN21StackAdvisor(DefaultStackAdvisor):
 
     return None
 
+  def checkSiteProperties(self, siteProperties, *propertyNames):
+    """
+    Check if properties defined in site properties.
+    :param siteProperties: config properties dict
+    :param *propertyNames: property names to validate
+    :returns: True if all properties defined, in other cases returns False
+    """
+    if siteProperties is None:
+      return False
+    for name in propertyNames:
+      if not (name in siteProperties):
+        return False
+    return True
+
 # Validation helper methods
 def getSiteProperties(configurations, siteName):
   siteConfig = configurations.get(siteName)

+ 24 - 7
ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/HIVE/configuration/hive-site.xml

@@ -109,7 +109,7 @@ limitations under the License.
     <description>The delegation token store implementation.
       Set to org.apache.hadoop.hive.thrift.ZooKeeperTokenStore for load-balanced cluster.</description>
   </property>
-  
+
   <property>
     <name>hive.cluster.delegation.token.store.zookeeper.connectString</name>
     <value>localhost:2181</value>
@@ -125,7 +125,7 @@ limitations under the License.
       in their connection string.
     </description>
   </property>
-  
+
   <property>
     <name>fs.hdfs.impl.disable.cache</name>
     <value>false</value>
@@ -322,6 +322,7 @@ limitations under the License.
     <name>javax.jdo.option.ConnectionPassword</name>
     <value></value>
     <display-name>Database Password</display-name>
+    <property-type>PASSWORD</property-type>
     <description>password to use against metastore database</description>
     <value-attributes>
       <overridable>false</overridable>
@@ -336,6 +337,16 @@ limitations under the License.
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <name>hive_database</name>
+        <type>hive-env</type>
+      </property>
+      <property>
+        <name>ambari.hive.db.schema.name</name>
+        <type>hive-site</type>
+      </property>
+    </depends-on>
   </property>
 
   <property>
@@ -396,6 +407,12 @@ limitations under the License.
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <name>hive_database</name>
+        <type>hive-env</type>
+      </property>
+    </depends-on>
   </property>
 
   <property>
@@ -1623,9 +1640,9 @@ limitations under the License.
     <name>hive.exec.orc.encoding.strategy</name>
     <value>SPEED</value>
     <description>
-      Define the encoding strategy to use while writing data. Changing this 
-      will only affect the light weight encoding for integers. This flag will not change 
-      the compression level of higher level compression codec (like ZLIB). Possible 
+      Define the encoding strategy to use while writing data. Changing this
+      will only affect the light weight encoding for integers. This flag will not change
+      the compression level of higher level compression codec (like ZLIB). Possible
       options are SPEED and COMPRESSION.
     </description>
     <display-name>ORC Encoding Strategy</display-name>
@@ -1654,7 +1671,7 @@ limitations under the License.
     <name>hive.exec.orc.compression.strategy</name>
     <value>SPEED</value>
     <description>
-      Define the compression strategy to use while writing data. This changes the 
+      Define the compression strategy to use while writing data. This changes the
       compression level of higher level compression codec (like ZLIB).
     </description>
     <display-name>ORC Compression Strategy</display-name>
@@ -1683,7 +1700,7 @@ limitations under the License.
     <name>hive.vectorized.execution.reduce.enabled</name>
     <value>false</value>
     <description>
-      This flag should be set to true to enable vectorized mode of the reduce-side of 
+      This flag should be set to true to enable vectorized mode of the reduce-side of
       query execution.
     </description>
     <display-name>Enable Reduce Vectorization</display-name>

+ 41 - 7
ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/stack_advisor.py

@@ -260,6 +260,8 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor):
   def recommendHIVEConfigurations(self, configurations, clusterData, services, hosts):
     super(HDPWIN22StackAdvisor, self).recommendHiveConfigurations(configurations, clusterData, services, hosts)
 
+    hiveSiteProperties = getSiteProperties(services['configurations'], 'hive-site')
+    hiveEnvProperties = getSiteProperties(services['configurations'], 'hive-env')
     putHiveServerProperty = self.putProperty(configurations, "hiveserver2-site", services)
     putHiveEnvProperty = self.putProperty(configurations, "hive-env", services)
     putHiveSiteProperty = self.putProperty(configurations, "hive-site", services)
@@ -469,6 +471,17 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor):
     python_binary = os.environ['PYTHON_EXE'] if 'PYTHON_EXE' in os.environ else sys.executable
     putWebhcatSiteProperty("templeton.python", python_binary)
 
+    # javax.jdo.option.ConnectionURL recommendations
+    if hiveEnvProperties and self.checkSiteProperties(hiveEnvProperties, 'hive_database', 'hive_database_type'):
+      putHiveEnvProperty('hive_database_type', self.getDBTypeAlias(hiveEnvProperties['hive_database']))
+    if hiveEnvProperties and hiveSiteProperties and self.checkSiteProperties(hiveSiteProperties, 'javax.jdo.option.ConnectionDriverName') and self.checkSiteProperties(hiveEnvProperties, 'hive_database'):
+      putHiveSiteProperty('javax.jdo.option.ConnectionDriverName', self.getDBDriver(hiveEnvProperties['hive_database']))
+    if hiveSiteProperties and hiveEnvProperties and self.checkSiteProperties(hiveSiteProperties, 'ambari.hive.db.schema.name', 'javax.jdo.option.ConnectionURL') and self.checkSiteProperties(hiveEnvProperties, 'hive_database'):
+      hiveMSHost = self.getHostWithComponent('HIVE', 'HIVE_METASTORE', services, hosts)
+      if hiveMSHost is not None:
+        dbConnection = self.getDBConnectionString(hiveEnvProperties['hive_database']).format(hiveMSHost['Hosts']['host_name'], hiveSiteProperties['ambari.hive.db.schema.name'])
+        putHiveSiteProperty('javax.jdo.option.ConnectionURL', dbConnection)
+
 
   def recommendHBASEConfigurations(self, configurations, clusterData, services, hosts):
     super(HDPWIN22StackAdvisor, self).recommendHbaseEnvConfigurations(configurations, clusterData, services, hosts)
@@ -677,7 +690,7 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor):
                         {"config-name": 'namenode_opt_newsize', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'namenode_opt_newsize')},
                         {"config-name": 'namenode_opt_maxnewsize', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'namenode_opt_maxnewsize')}]
     return self.toConfigurationValidationProblems(validationItems, "hadoop-env")
-  
+
   def validateHDFSConfigurations(self, properties, recommendedDefaults, configurations, services, hosts):
     # We can not access property hadoop.security.authentication from the
     # other config (core-site). That's why we are using another heuristics here
@@ -719,7 +732,7 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor):
           validationItems.append({"config-name" : address_property, "item" :
             self.getErrorItem(address_property + " does not contain a valid host:port authority: " + value)})
 
-    #Adding Ranger Plugin logic here 
+    #Adding Ranger Plugin logic here
     ranger_plugin_properties = getSiteProperties(configurations, "ranger-hdfs-plugin-properties")
     ranger_plugin_enabled = ranger_plugin_properties['ranger-hdfs-plugin-enabled'] if ranger_plugin_properties else 'no'
     servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
@@ -818,8 +831,8 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor):
   def validateHiveServer2Configurations(self, properties, recommendedDefaults, configurations, services, hosts):
     super(HDPWIN22StackAdvisor, self).validateHiveConfigurations(properties, recommendedDefaults, configurations, services, hosts)
     hive_server2 = properties
-    validationItems = [] 
-    #Adding Ranger Plugin logic here 
+    validationItems = []
+    #Adding Ranger Plugin logic here
     ranger_plugin_properties = getSiteProperties(configurations, "ranger-hive-plugin-properties")
     ranger_plugin_enabled = ranger_plugin_properties['ranger-hdfs-plugin-enabled'] if ranger_plugin_properties else 'no'
     servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
@@ -933,7 +946,7 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor):
                               "item": self.getWarnItem(
                               "{0} and {1} sum should not exceed {2}".format(prop_name1, prop_name2, props_max_sum))})
 
-    #Adding Ranger Plugin logic here 
+    #Adding Ranger Plugin logic here
     ranger_plugin_properties = getSiteProperties(configurations, "ranger-hbase-plugin-properties")
     ranger_plugin_enabled = ranger_plugin_properties['ranger-hdfs-plugin-enabled'] if ranger_plugin_properties else 'no'
     prop_name = 'hbase.security.authorization'
@@ -987,7 +1000,7 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor):
                               "item": self.getWarnItem(
                                 "If bucketcache ioengine is enabled, {0} should be set".format(prop_name3))})
 
-    # Validate hbase.security.authentication. 
+    # Validate hbase.security.authentication.
     # Kerberos works only when security enabled.
     if "hbase.security.authentication" in properties:
       hbase_security_kerberos = properties["hbase.security.authentication"].lower() == "kerberos"
@@ -1029,6 +1042,27 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor):
                               "item": self.getWarnItem("CPU Isolation should only be enabled if security is enabled")})
     return self.toConfigurationValidationProblems(validationItems, "yarn-env")
 
+  def getDBDriver(self, databaseType):
+    driverDict = {
+      'EXISTING MSSQL SERVER DATABASE WITH SQL AUTHENTICATION': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
+      'EXISTING MSSQL SERVER DATABASE WITH INTEGRATED AUTHENTICATION': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
+    }
+    return driverDict.get(databaseType.upper())
+
+  def getDBConnectionString(self, databaseType):
+    driverDict = {
+      'EXISTING MSSQL SERVER DATABASE WITH SQL AUTHENTICATION': 'jdbc:sqlserver://{0};databaseName={1}',
+      'EXISTING MSSQL SERVER DATABASE WITH INTEGRATED AUTHENTICATION': 'jdbc:sqlserver://{0};databaseName={1};integratedSecurity=true',
+    }
+    return driverDict.get(databaseType.upper())
+
+  def getDBTypeAlias(self, databaseType):
+    driverDict = {
+      'EXISTING MSSQL SERVER DATABASE WITH SQL AUTHENTICATION': 'mssql',
+      'EXISTING MSSQL SERVER DATABASE WITH INTEGRATED AUTHENTICATION': 'mssql2',
+    }
+    return driverDict.get(databaseType.upper())
+
   def getMastersWithMultipleInstances(self):
     result = super(HDPWIN22StackAdvisor, self).getMastersWithMultipleInstances()
     result.extend(['METRICS_COLLECTOR'])
@@ -1052,7 +1086,7 @@ class HDPWIN22StackAdvisor(HDPWIN21StackAdvisor):
   def getAffectedConfigs(self, services):
     affectedConfigs = super(HDPWIN22StackAdvisor, self).getAffectedConfigs(services)
 
-    # There are configs that are not defined in the stack but added/removed by 
+    # There are configs that are not defined in the stack but added/removed by
     # stack-advisor. Here we add such configs in order to clear the config
     # filtering down in base class
     configsList = [affectedConfig["type"] + "/" + affectedConfig["name"] for affectedConfig in affectedConfigs]

+ 0 - 11
ambari-server/src/main/resources/stacks/HDPWIN/2.3/services/OOZIE/configuration/oozie-env.xml

@@ -25,17 +25,6 @@
     <name>oozie_user</name>
     <deleted>true</deleted>
   </property>
-  <property>
-    <name>oozie_hostname</name>
-    <value></value>
-    <display-name>Database Host</display-name>
-    <description>
-      Specify the host on which the OOZIE database is hosted.
-    </description>
-    <value-attributes>
-      <overridable>false</overridable>
-    </value-attributes>
-  </property>
   <property>
     <name>oozie_database</name>
     <value>Existing MSSQL Server database with SQL authentication</value>

+ 31 - 2
ambari-server/src/main/resources/stacks/HDPWIN/2.3/services/OOZIE/configuration/oozie-site.xml

@@ -7,9 +7,9 @@
   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.
@@ -28,7 +28,18 @@
     <value-attributes>
       <overridable>false</overridable>
     </value-attributes>
+    <depends-on>
+      <property>
+        <type>oozie-env</type>
+        <name>oozie_database</name>
+      </property>
+      <property>
+        <type>oozie-site</type>
+        <name>oozie.db.schema.name</name>
+      </property>
+    </depends-on>
   </property>
+
   <property>
     <name>oozie.service.JPAService.create.db.schema</name>
     <value>true</value>
@@ -40,6 +51,24 @@
     </description>
   </property>
 
+  <property>
+    <name>oozie.service.JPAService.jdbc.driver</name>
+    <value>org.apache.derby.jdbc.EmbeddedDriver</value>
+    <display-name>JDBC Driver Class</display-name>
+    <description>
+      JDBC driver class.
+    </description>
+    <value-attributes>
+      <overridable>false</overridable>
+    </value-attributes>
+    <depends-on>
+      <property>
+        <type>oozie-env</type>
+        <name>oozie_database</name>
+      </property>
+    </depends-on>
+  </property>
+
   <property>
     <name>oozie.service.HadoopAccessorService.hadoop.configurations</name>
     <value>*=c:\hdp\hadoop\etc\hadoop</value>

+ 18 - 1
ambari-server/src/main/resources/stacks/HDPWIN/2.3/services/stack_advisor.py

@@ -23,6 +23,7 @@ class HDPWIN23StackAdvisor(HDPWIN22StackAdvisor):
     parentRecommendConfDict = super(HDPWIN23StackAdvisor, self).getServiceConfigurationRecommenderDict()
     childRecommendConfDict = {
       "TEZ": self.recommendTezConfigurations,
+      "OOZIE": self.recommendOozieConfigurations
     }
     parentRecommendConfDict.update(childRecommendConfDict)
     return parentRecommendConfDict
@@ -40,4 +41,20 @@ class HDPWIN23StackAdvisor(HDPWIN22StackAdvisor):
     if "tez-site" in services["configurations"] and "tez.runtime.sorter.class" in services["configurations"]["tez-site"]["properties"]:
       if services["configurations"]["tez-site"]["properties"]["tez.runtime.sorter.class"] == "LEGACY":
         putTezAttribute = self.putPropertyAttribute(configurations, "tez-site")
-        putTezAttribute("tez.runtime.io.sort.mb", "maximum", 2047)
+        putTezAttribute("tez.runtime.io.sort.mb", "maximum", 2047)
+
+  def recommendOozieConfigurations(self, configurations, clusterData, services, hosts):
+    super(HDPWIN23StackAdvisor, self).recommendOozieConfigurations(configurations, clusterData, services, hosts)
+
+    oozieSiteProperties = getSiteProperties(services['configurations'], 'oozie-site')
+    oozieEnvProperties = getSiteProperties(services['configurations'], 'oozie-env')
+    putOozieProperty = self.putProperty(configurations, "oozie-site", services)
+    putOozieEnvProperty = self.putProperty(configurations, "oozie-env", services)
+
+    if oozieEnvProperties and oozieSiteProperties and self.checkSiteProperties(oozieSiteProperties, 'oozie.service.JPAService.jdbc.driver') and self.checkSiteProperties(oozieEnvProperties, 'oozie_database'):
+      putOozieProperty('oozie.service.JPAService.jdbc.driver', self.getDBDriver(oozieEnvProperties['oozie_database']))
+    if oozieSiteProperties and oozieEnvProperties and self.checkSiteProperties(oozieSiteProperties, 'oozie.db.schema.name', 'oozie.service.JPAService.jdbc.url') and self.checkSiteProperties(oozieEnvProperties, 'oozie_database'):
+      oozieServerHost = self.getHostWithComponent('OOZIE', 'OOZIE_SERVER', services, hosts)
+      if oozieServerHost is not None:
+        dbConnection = self.getDBConnectionString(oozieEnvProperties['oozie_database']).format(oozieServerHost['Hosts']['host_name'], oozieSiteProperties['oozie.db.schema.name'])
+        putOozieProperty('oozie.service.JPAService.jdbc.url', dbConnection)

+ 98 - 4
ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py

@@ -45,9 +45,11 @@ class TestHDP21StackAdvisor(TestCase):
       "components" : []
     }
     expected = {
+      "oozie-site": {"properties":{}},
+      "oozie-env": {"properties":{}}
     }
 
-    self.stackAdvisor.recommendOozieConfigurations(configurations, clusterData, None, None)
+    self.stackAdvisor.recommendOozieConfigurations(configurations, clusterData, {"configurations":{}}, None)
     self.assertEquals(configurations, expected)
 
   def test_recommendOozieConfigurations_withFalconServer(self):
@@ -86,6 +88,9 @@ class TestHDP21StackAdvisor(TestCase):
         "properties" : {
           "falcon_user" : "falcon"
         }
+      },
+      "oozie-env": {
+        "properties": {}
       }
     }
 
@@ -107,10 +112,13 @@ class TestHDP21StackAdvisor(TestCase):
           "hive.tez.java.opts": "-server -Xmx1645m -Djava.net.preferIPv4Stack=true -XX:NewRatio=8 -XX:+UseNUMA -XX:+UseParallelGC -XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps",
           "hive.tez.container.size": "2056"
         }
+      },
+      "hive-env": {
+        "properties": {}
       }
     }
 
-    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, None, None)
+    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, {"configurations": {}}, None)
     self.maxDiff = None
     self.assertEquals(configurations, expected)
 
@@ -129,10 +137,13 @@ class TestHDP21StackAdvisor(TestCase):
           "hive.tez.java.opts": "-server -Xmx2401m -Djava.net.preferIPv4Stack=true -XX:NewRatio=8 -XX:+UseNUMA -XX:+UseParallelGC -XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps",
           "hive.tez.container.size": "3000"
         }
+      },
+      "hive-env": {
+        "properties": {}
       }
     }
 
-    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, None, None)
+    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, {"configurations":{}}, None)
     self.assertEquals(configurations, expected)
 
   def test_createComponentLayoutRecommendations_mastersIn10nodes(self):
@@ -164,6 +175,86 @@ class TestHDP21StackAdvisor(TestCase):
 
     self.assertEquals(sort_nested_lists(expected_layout), sort_nested_lists(groups))
 
+  def test_recommendHiveConfigurations_jdbcUrl(self):
+    services = {
+      "services" : [
+        {
+          "StackServices" : {
+            "service_name" : "HIVE",
+          },
+          "components" : [ {
+            "StackServiceComponents" : {
+              "component_name" : "HIVE_METASTORE",
+              "service_name" : "HIVE",
+              "hostnames" : ["example.com"]
+            }
+          }]
+        }
+      ],
+      "configurations": {}
+    }
+
+    hosts = json.load(open(os.path.join(self.testDirectory, 'hosts.json')))
+    clusterData = {
+      "mapMemory": 3000,
+      "reduceMemory": 2056,
+      "containers": 3,
+      "ramPerContainer": 256
+    }
+    configurations = {
+      "hive-site": {
+        "properties": {
+          "javax.jdo.option.ConnectionDriverName": "",
+          "ambari.hive.db.schema.name": "hive_name",
+          "javax.jdo.option.ConnectionURL": ""
+        }
+      },
+      "hive-env": {
+        "properties": {
+          "hive_database": "New MySQL Database"
+        }
+      }
+    }
+    services['configurations'] = configurations
+    hosts = {
+      "items": [
+        {
+          "Hosts": {
+            "host_name": "example.com"
+          }
+        }
+      ]
+    }
+
+    # new mysql
+    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, services, hosts)
+    self.assertEquals(configurations['hive-site']['properties']['javax.jdo.option.ConnectionURL'], "jdbc:mysql://example.com/hive_name?createDatabaseIfNotExist=true")
+    self.assertEquals(configurations['hive-site']['properties']['javax.jdo.option.ConnectionDriverName'], "com.mysql.jdbc.Driver")
+
+    # existing Mysql
+    services['configurations']['hive-env']['properties']['hive_database'] = 'Existing MySQL Database'
+    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, services, hosts)
+    self.assertEquals(configurations['hive-site']['properties']['javax.jdo.option.ConnectionURL'], "jdbc:mysql://example.com/hive_name")
+    self.assertEquals(configurations['hive-site']['properties']['javax.jdo.option.ConnectionDriverName'], "com.mysql.jdbc.Driver")
+
+    # existing postgres
+    services['configurations']['hive-env']['properties']['hive_database'] = 'Existing PostgreSQL Database'
+    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, services, hosts)
+    self.assertEquals(configurations['hive-site']['properties']['javax.jdo.option.ConnectionURL'], "jdbc:postgresql://example.com:5432/hive_name")
+    self.assertEquals(configurations['hive-site']['properties']['javax.jdo.option.ConnectionDriverName'], "org.postgresql.Driver")
+
+    # existing oracle
+    services['configurations']['hive-env']['properties']['hive_database'] = 'Existing Oracle Database'
+    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, services, hosts)
+    self.assertEquals(configurations['hive-site']['properties']['javax.jdo.option.ConnectionURL'], "jdbc:oracle:thin:@//example.com:1521/hive_name")
+    self.assertEquals(configurations['hive-site']['properties']['javax.jdo.option.ConnectionDriverName'], "oracle.jdbc.driver.OracleDriver")
+
+    # existing sqla
+    services['configurations']['hive-env']['properties']['hive_database'] = 'Existing SQL Anywhere Database'
+    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, services, hosts)
+    self.assertEquals(configurations['hive-site']['properties']['javax.jdo.option.ConnectionURL'], "jdbc:sqlanywhere:host=example.com;database=hive_name")
+    self.assertEquals(configurations['hive-site']['properties']['javax.jdo.option.ConnectionDriverName'], "sap.jdbc4.sqlanywhere.IDriver")
+
   def test_recommendHiveConfigurations_containersRamIsLess(self):
     configurations = {}
     clusterData = {
@@ -179,10 +270,13 @@ class TestHDP21StackAdvisor(TestCase):
           "hive.tez.java.opts": "-server -Xmx615m -Djava.net.preferIPv4Stack=true -XX:NewRatio=8 -XX:+UseNUMA -XX:+UseParallelGC -XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps",
           "hive.tez.container.size": "768"
         }
+      },
+      "hive-env": {
+        "properties": {}
       }
     }
 
-    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, None, None)
+    self.stackAdvisor.recommendHiveConfigurations(configurations, clusterData, {"configurations":{}}, None)
     self.assertEquals(configurations, expected)
 
   def test_recommendHbaseConfigurations(self):

+ 5 - 5
ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py

@@ -977,7 +977,7 @@ class TestHDP22StackAdvisor(TestCase):
     expected["yarn-site"]["property_attributes"]["yarn.scheduler.maximum-allocation-vcores"]["maximum"] = '5'
     self.stackAdvisor.recommendYARNConfigurations(configurations, clusterData, services, hosts)
     self.assertEquals(configurations, expected)
-    
+
     # Test - with no 'changed-configurations', we should get updated 'maximum's.
     services.pop("changed-configurations", None)
     services.pop("configurations", None)
@@ -1069,10 +1069,10 @@ class TestHDP22StackAdvisor(TestCase):
         },
        'property_attributes': {
          'hive.auto.convert.join.noconditionaltask.size': {'maximum': '805306368'},
-         'hive.server2.authentication.pam.services': {'delete': 'true'}, 
-         'hive.server2.custom.authentication.class': {'delete': 'true'}, 
+         'hive.server2.authentication.pam.services': {'delete': 'true'},
+         'hive.server2.custom.authentication.class': {'delete': 'true'},
          'hive.server2.authentication.kerberos.principal': {'delete': 'true'},
-         'hive.server2.authentication.kerberos.keytab': {'delete': 'true'}, 
+         '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'}]
@@ -3016,7 +3016,7 @@ class TestHDP22StackAdvisor(TestCase):
 
     # Test 4 - KMS empty test from previous call
     self.assertTrue("dfs.encryption.key.provider.uri" not in configurations["hdfs-site"]["properties"])
-    
+
     # Test 5 - Calculated from hosts install location
     services["services"].append(
                     {"StackServices":

+ 0 - 17
ambari-web/app/controllers/main/service/info/configs.js

@@ -396,25 +396,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
     }
 
     this.set('allConfigs', configs);
-    //add configs as names of host components
-    this.addDBProperties(configs);
   },
 
-  /**
-   * This method should add UI properties that are market as <code>'isRequiredByAgent': false<code>
-   * @param configs
-   */
-  addDBProperties: function(configs) {
-    if (this.get('content.serviceName') === 'HIVE') {
-      var propertyToAdd = App.configsCollection.getConfigByName('hive_hostname','hive-env'),
-        cfg = App.config.createDefaultConfig(propertyToAdd.name, propertyToAdd.serviceName, propertyToAdd.filename, true, propertyToAdd),
-        connectionUrl = configs.findProperty('name', 'javax.jdo.option.ConnectionURL');
-      if (cfg && connectionUrl) {
-        cfg.savedValue = cfg.value = databaseUtils.getDBLocationFromJDBC(connectionUrl.get('value'));
-        configs.pushObject(App.ServiceConfigProperty.create(cfg));
-      }
-    }
-  },
   /**
    * adds properties form stack that doesn't belong to cluster
    * to step configs

+ 7 - 7
ambari-web/app/controllers/wizard/step7_controller.js

@@ -1420,7 +1420,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
     return App.ajax.send({
       name: 'ambari.service',
       data: {
-        fields : "?fields=hostComponents/RootServiceHostComponents/properties/server.jdbc.database_name,hostComponents/RootServiceHostComponents/properties/server.jdbc.url"
+        fields : "?fields=hostComponents/RootServiceHostComponents/properties/server.jdbc.database_name,hostComponents/RootServiceHostComponents/properties/server.jdbc.url,hostComponents/RootServiceHostComponents/properties/server.jdbc.database"
       },
       sender: this,
       success: 'getAmbariDatabaseSuccess'
@@ -1434,11 +1434,11 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
    * @method getAmbariDatabaseSuccess
    */
   getAmbariDatabaseSuccess: function (data) {
-    var hiveDBHostname = this.get('stepConfigs').findProperty('serviceName', 'HIVE').configs.findProperty('name', 'hive_hostname').value;
-    var ambariServiceHostComponents = data.hostComponents;
-    if (ambariServiceHostComponents.length) {
-      var ambariDBInfo = JSON.stringify(ambariServiceHostComponents[0].RootServiceHostComponents.properties);
-      this.set('mySQLServerConflict', ambariDBInfo.contains('mysql') && ambariDBInfo.indexOf(hiveDBHostname) > 0);
+    var ambariServerDBType = Em.getWithDefault(data.hostComponents, '0.RootServiceHostComponents.properties', {})['server.jdbc.database'],
+        ambariServerHostName = Em.getWithDefault(data.hostComponents, '0.RootServiceHostComponents.host_name', false),
+        hiveConnectionURL = Em.getWithDefault(App.config.findConfigProperty(this.get('stepConfigs'), 'javax.jdo.option.ConnectionURL', 'hive-site.xml') || {}, 'value', '');
+    if (ambariServerHostName) {
+      this.set('mySQLServerConflict', ambariServerDBType.contains('mysql') && hiveConnectionURL.contains(ambariServerHostName));
     } else {
       this.set('mySQLServerConflict', false);
     }
@@ -1574,7 +1574,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
       onPrimary: function () {
         if (goToNextStep) {
           goToNextStep();
-          this.hide(); 
+          this.hide();
         }
       },
       onSecondary: function () {

+ 1 - 21
ambari-web/app/data/HDP2/ui_properties.js

@@ -17,26 +17,6 @@
  */
 
 module.exports = [
-  {
-    "name": "oozie_hostname",
-    "displayName": "Database Host",
-    "displayType": "host",
-    "serviceName": "OOZIE",
-    "filename": "oozie-env.xml",
-    "category": "OOZIE_SERVER",
-    "index": 3
-  },
-  {
-    "name": "hive_hostname",
-    "displayName": "Database Host",
-    "description": "Specify the host on which the database is hosted",
-    "displayType": "host",
-    "isRequiredByAgent": false,
-    "serviceName": "HIVE",
-    "filename": "hive-env.xml",
-    "category": "HIVE_METASTORE",
-    "index": 3
-  },
   {
     "name": "admin_principal",
     "displayName": "Admin principal",
@@ -57,4 +37,4 @@ module.exports = [
     "category": "Kadmin",
     "index": 2
   }
-];
+];

+ 1 - 5
ambari-web/app/data/db_properties_info.js

@@ -32,8 +32,6 @@ module.exports = {
   dpPropertiesByServiceMap: {
     'HIVE': {
       db_selector: 'hive_database',
-
-      host_name: 'hive_hostname',
       db_name: 'ambari.hive.db.schema.name',
 
       connection_url: 'javax.jdo.option.ConnectionURL',
@@ -45,8 +43,6 @@ module.exports = {
     },
     'OOZIE': {
       db_selector: 'oozie_database',
-
-      host_name: 'oozie_hostname',
       db_name: 'oozie.db.schema.name',
 
       connection_url: 'oozie.service.JPAService.jdbc.url',
@@ -116,4 +112,4 @@ module.exports = {
       'driver': 'org.apache.derby.jdbc.EmbeddedDriver'
     }
   }
-};
+};

+ 3 - 11
ambari-web/app/models/configs/objects/service_config_property.js

@@ -425,17 +425,9 @@ App.ServiceConfigProperty = Em.Object.extend({
         case 'supportTextConnection':
         case 'host':
           var connectionProperties = ['kdc_host'];
-          var hiveOozieHostNames = ['hive_hostname','oozie_hostname'];
-          if(hiveOozieHostNames.contains(this.get('name'))) {
-            if (validator.hasSpaces(value)) {
-              this.set('errorMessage', Em.I18n.t('host.spacesValidation'));
-              isError = true;
-            }
-          } else {
-            if ((validator.isNotTrimmed(value) && connectionProperties.contains(this.get('name')) || validator.isNotTrimmed(value))) {
-              this.set('errorMessage', Em.I18n.t('host.trimspacesValidation'));
-              isError = true;
-            }
+          if ((validator.isNotTrimmed(value) && connectionProperties.contains(this.get('name')) || validator.isNotTrimmed(value))) {
+            this.set('errorMessage', Em.I18n.t('host.trimspacesValidation'));
+            isError = true;
           }
           break;
         case 'password':

+ 0 - 2
ambari-web/app/utils/configs/config_initializer.js

@@ -77,8 +77,6 @@ App.ConfigInitializer = App.ConfigInitializerClass.create(App.MountPointsBasedIn
       'mapred.job.tracker': this.getSimpleComponentConfig('JOBTRACKER'),
       'mapred.job.tracker.http.address': this.getSimpleComponentConfig('JOBTRACKER'),
       'mapreduce.history.server.http.address': this.getSimpleComponentConfig('HISTORYSERVER'),
-      'hive_hostname': this.getSimpleComponentConfig('HIVE_SERVER', false),
-      'oozie_hostname': this.getSimpleComponentConfig('OOZIE_SERVER', false),
       'oozie.base.url': this.getComponentConfigWithAffixes('OOZIE_SERVER', '://'),
       'hawq_dfs_url': this.getSimpleComponentConfig('NAMENODE'),
       'hawq_rm_yarn_address': this.getSimpleComponentConfig('RESOURCEMANAGER'),

+ 2 - 4
ambari-web/app/utils/configs/database.js

@@ -41,14 +41,12 @@ module.exports = {
     HIVE: {
       dbType: 'hive_database',
       databaseName: 'ambari.hive.db.schema.name',
-      connectionUrl: 'javax.jdo.option.ConnectionURL',
-      fallbackHostName: 'hive_hostname'
+      connectionUrl: 'javax.jdo.option.ConnectionURL'
     },
     OOZIE: {
       dbType: 'oozie_database',
       connectionUrl: 'oozie.service.JPAService.jdbc.url',
-      databaseName: 'oozie.db.schema.name',
-      fallbackHostName: 'oozie_hostname'
+      databaseName: 'oozie.db.schema.name'
     },
     RANGER: {
       dbType: 'DB_FLAVOR',

+ 2 - 50
ambari-web/app/views/common/controls_view.js

@@ -524,19 +524,8 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
   }.property('serviceConfig.serviceName', 'serviceConfig.value'),
 
   onOptionsChange: function () {
-    if (this.get('hostNameProperty') && !this.get('nonDBRadioButtons').contains(this.get('serviceConfig.name'))) {
+    if (!this.get('nonDBRadioButtons').contains(this.get('serviceConfig.name'))) {
       /** if new db is selected host name must be same as master of selected service (and can't be changed)**/
-      if (this.get('isNewDb')) {
-        var initProperty = this.get('hostNameProperty.recommendedValue') || this.get('hostNameProperty.savedValue');
-        this.get('hostNameProperty').set('value', initProperty.toString());
-        this.get('hostNameProperty').set('isEditable', false);
-      } else {
-        this.get('hostNameProperty').set('isEditable', true);
-      }
-      this.setRequiredProperties(['driver', 'db_type']);
-      if (this.getPropertyByType('connection_url')) {
-        this.setConnectionUrl(this.get('hostNameProperty.value'), this.get('databaseProperty.value'));
-      }
       this.handleSpecialUserPassProperties();
     }
   }.observes('databaseProperty.value', 'hostNameProperty.value', 'serviceConfig.value'),
@@ -621,43 +610,6 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
     return null;
   },
 
-  /**
-   * This method update <code>connection_url<code> property, using template described in <code>dpPropertiesMap<code>
-   * and sets hostName as dbName in appropriate position of <code>connection_url<code> string
-   * @param {String} hostName
-   * @param {String} dbName
-   * @method setConnectionUrl
-   */
-  setConnectionUrl: function(hostName, dbName) {
-    var connectionUrlProperty = this.getPropertyByType('connection_url');
-    var connectionUrlTemplate = this.getDefaultPropertyValue('connection_url');
-    try {
-      var connectionUrlValue = connectionUrlTemplate.format(hostName, dbName);
-      connectionUrlProperty.set('value', connectionUrlValue);
-      connectionUrlProperty.set('recommendedValue', connectionUrlValue);
-    } catch(e) {
-      console.error('connection url property or connection url template is missing');
-    }
-    return connectionUrlProperty;
-  },
-
-  /**
-   * This method sets recommended values for properties <code>propertiesToUpdate<code> when radio button is changed
-   * @param {String[]} propertiesToUpdate - contains type of properties that should be updated;
-   * @method setRequiredProperties
-   * @returns App.ServiceConfigProperty[]
-   */
-  setRequiredProperties: function (propertiesToUpdate) {
-    propertiesToUpdate.forEach(function(pType) {
-      var property = this.getPropertyByType(pType);
-      var value = this.getDefaultPropertyValue(pType);
-      if (property && value) {
-        property.set('value', value);
-        property.set('recommendedValue', value);
-      }
-    }, this);
-  },
-
   /**
    * This method hides properties <code>user_name<code> and <code>password<code> in case selected db is
    * "Existing MSSQL Server database with integrated authentication" or similar
@@ -782,8 +734,8 @@ App.ServiceConfigRadioButton = Ember.Checkbox.extend(App.SupportsDependentConfig
     // causes JS error due to re-rendering.  For example, this occurs when switching the Config Group
     // in Service Config page
     if (this.get('clicked')) {
-      this.sendRequestRorDependentConfigs(this.get('parentView.serviceConfig'));
       Em.run.next(this, function() {
+        this.sendRequestRorDependentConfigs(this.get('parentView.serviceConfig'));
         this.set('parentView.serviceConfig.value', this.get('value'));
         this.set('clicked', false);
         this.updateForeignKeys();

+ 23 - 4
ambari-web/test/controllers/wizard/step7_test.js

@@ -1419,8 +1419,9 @@ describe('App.InstallerStep7Controller', function () {
             serviceName: 'HIVE',
             configs: [
               {
-                name: 'hive_hostname',
-                value: 'h0'
+                name: 'javax.jdo.option.ConnectionURL',
+                value: 'jdbc:mysql://h0/db_name?createDatabaseIfNotExist=true',
+                filename: 'hive-site.xml'
               }
             ]
           }
@@ -1439,8 +1440,25 @@ describe('App.InstallerStep7Controller', function () {
             hostComponents: [
               {
                 RootServiceHostComponents: {
+                  host_name: 'h0',
                   properties: {
-                    'server.jdbc.url': 'jdbc:mysql://h0/db0?createDatabaseIfNotExist=true'
+                    'server.jdbc.database': 'postgres'
+                  }
+                }
+              }
+            ]
+          },
+          mySQLServerConflict: false,
+          title: 'Ambari MySQL Server and Hive Server are on the same host but different database types'
+        },
+        {
+          data: {
+            hostComponents: [
+              {
+                RootServiceHostComponents: {
+                  host_name: 'h0',
+                  properties: {
+                    'server.jdbc.database': 'mysql'
                   }
                 }
               }
@@ -1454,8 +1472,9 @@ describe('App.InstallerStep7Controller', function () {
             hostComponents: [
               {
                 RootServiceHostComponents: {
+                  host_name: 'h1',
                   properties: {
-                    'server.jdbc.url': 'jdbc:mysql://h1/db1?createDatabaseIfNotExist=true'
+                    'server.jdbc.database': 'mysql'
                   }
                 }
               }

+ 1 - 29
ambari-web/test/utils/configs/config_initializer_test.js

@@ -247,22 +247,6 @@ describe('App.ConfigInitializer', function () {
         value: 'h0:2182,h1:2182',
         title: 'should add ZK host and port dynamically'
       },
-      'oozie_hostname': {
-        localDB: {
-          masterComponentHosts: [
-            {
-              component: 'OOZIE_SERVER',
-              hostName: 'h0'
-            },
-            {
-              component: 'OOZIE_SERVER',
-              hostName: 'h1'
-            }
-          ]
-        },
-        value: ['h0', 'h1'],
-        title: 'array that contains names of hosts with Oozie Server'
-      },
       'knox_gateway_host': {
         localDB: {
           masterComponentHosts: [
@@ -586,18 +570,6 @@ describe('App.ConfigInitializer', function () {
         rValue: 'c6407.ambari.apache.org:555',
         expectedValue: 'h1:555'
       },
-      {
-        config: 'hive_hostname',
-        localDB: getLocalDBForSingleComponent('HIVE_SERVER'),
-        rValue: 'c6407.ambari.apache.org',
-        expectedValue: 'h1'
-      },
-      {
-        config: 'oozie_hostname',
-        localDB: getLocalDBForSingleComponent('OOZIE_SERVER'),
-        rValue: 'c6407.ambari.apache.org',
-        expectedValue: 'h1'
-      },
       {
         config: 'oozie.base.url',
         localDB: getLocalDBForSingleComponent('OOZIE_SERVER'),
@@ -1245,4 +1217,4 @@ describe('App.ConfigInitializer', function () {
 
   });
 
-});
+});

+ 0 - 56
ambari-web/test/views/common/controls_view_test.js

@@ -29,62 +29,6 @@ describe('App.ServiceConfigRadioButtons', function () {
     view = App.ServiceConfigRadioButtons.create();
   });
 
-  describe('#setConnectionUrl', function () {
-    beforeEach(function () {
-      sinon.stub(view, 'getPropertyByType', function (name) {
-        return App.ServiceConfigProperty.create({'name': name});
-      });
-      sinon.stub(view, 'getDefaultPropertyValue', function () {
-        return 'host:{0},db:{1}';
-      });
-    });
-
-    afterEach(function () {
-      view.getPropertyByType.restore();
-      view.getDefaultPropertyValue.restore();
-    });
-
-    it('updates value for connection url', function () {
-      expect(view.setConnectionUrl('hostName', 'dbName').get('value')).to.equal('host:hostName,db:dbName');
-    });
-  });
-
-  describe('#setRequiredProperties', function () {
-
-    beforeEach(function () {
-      view.reopen({
-        serviceConfig: Em.Object.create(),
-        categoryConfigsAll: [
-          App.ServiceConfigProperty.create({
-            name: 'p1',
-            value: 'v1'
-          }),
-          App.ServiceConfigProperty.create({
-            name: 'p2',
-            value: 'v2'
-          })
-        ]
-      });
-      sinon.stub(view, 'getPropertyByType', function (name) {
-        return view.get('categoryConfigsAll').findProperty('name', name);
-      });
-      sinon.stub(view, 'getDefaultPropertyValue', function (name) {
-        return name + '_v';
-      });
-    });
-
-    afterEach(function () {
-      view.getPropertyByType.restore();
-      view.getDefaultPropertyValue.restore();
-    });
-
-    it('updates value for connection url', function () {
-      view.setRequiredProperties(['p2', 'p1']);
-      expect(view.get('categoryConfigsAll').findProperty('name', 'p1').get('value')).to.equal('p1_v');
-      expect(view.get('categoryConfigsAll').findProperty('name', 'p2').get('value')).to.equal('p2_v');
-    });
-  });
-
   describe('#handleDBConnectionProperty', function () {
 
     var cases = [