> On Sept. 12, 2017, 11:59 a.m., Jonathan Hurley wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
> > Lines 415-449 (patched)
> > <https://reviews.apache.org/r/62245/diff/1/?file=1820185#file1820185line415>
> >
> >     Does it make sense to just query for all configuration types which are 
> > selected more than once directly?
> >     
> >     ```SELECT COUNT(type_name), type_name FROM clusterconfig WHERE selected 
> > = 1 GROUP BY type_name HAVING COUNT(type_name) > 1```
> 
> Dmitro Lisnichenko wrote:
>     even if I use this query, I'll only get config type names and counts. And 
> I would still have to fetch these entities in order to modify them (set 
> selected to false)

True, but you could eliminate all of the looping and tracking to find 
duplicates with 1 SQL call.


- Jonathan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62245/#review185203
-----------------------------------------------------------


On Sept. 12, 2017, 10:28 a.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/62245/
> -----------------------------------------------------------
> 
> (Updated Sept. 12, 2017, 10:28 a.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-21935
>     https://issues.apache.org/jira/browse/AMBARI-21935
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Sometimes Ambari is coming up with issues like more than 1 selected configs.
> 
> Error:
> {noformat}
> ERROR - You have config(s), in cluster BMOHDPQA01, that is(are) selected more 
> than once in clusterconfigmapping table: 
> falcon-startup.properties,zoo.cfg,zeppelin-config,zookeeper-log4j,tagsync-application-properties,storm-worker-log4j,hive-log4j2,admin-properties,oozie-env,ssl-server,hadoop-policy,infra-solr-log4j,oozie-log4j,core-site,mahout-log4j,kafka-broker,pig-log4j,livy-env,zeppelin-env,hive-log4j,slider-client,tez-env,storm-env,ranger-storm-plugin-properties,oozie-site,falcon-env,beeline-log4j2,ranger-storm-policymgr-ssl,falcon-runtime.properties,ranger-storm-security,hbase-policy,ams-env,capacity-scheduler,webhcat-log4j,atlas-log4j,livy-log4j-properties,spark-metrics-properties,hbase-env,ranger-atlas-security,flume-env,sqoop-atlas-application.properties,admin-log4j,hiveserver2-interactive-site,ranger-tagsync-site,application-properties,ranger-kafka-policymgr-ssl,ranger-admin-site,ranger-env,ranger-storm-audit,ranger-hbase-policymgr-ssl,hdfs-log4j
> {noformat}
> 
> It is very difficult to fix these kind of issues with queries. including auto 
> fix for this will be very helpful.
> 
> 
> Diffs
> -----
> 
>   
> ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
>  575485bd54 
>   
> ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java 
> a23b914f34 
>   
> ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
>  9bf03b343f 
>   
> ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java
>  6c6c00f947 
> 
> 
> Diff: https://reviews.apache.org/r/62245/diff/1/
> 
> 
> Testing
> -------
> 
> mvn clean test
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>

Reply via email to