> On May 1, 2017, 6:59 p.m., Alejandro Fernandez wrote: > > ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ViewInstanceDAO.java > > Lines 186 (patched) > > <https://reviews.apache.org/r/58886/diff/1/?file=1704053#file1704053line186> > > > > Why does the cluster ID change? > > If that's the root cause, we should fix that instead. > > Nitiraj Rathore wrote: > So I think if the cluster install fails because of some reason. A > reattempt from UI is done and at that time the cluster id is changed. But > this change is not propogated to ViewRegistry and it does not delete already > created auto view instances or changes their cluster id. > Yes this solution is not elegant. Although this bug is rare but when it > comes it creates problems even in correcting the views from the UI. And so > the severity of the bug is high. > I think a better solution would be to fire one event like > "ClusterDeleted" which will be picked up by ViewRegistry and it will delete > the views which were created for that cluster id. > Auto instances will again get created with new cluster id. This solution > might take more time to implement as it touches more surface. > We will log another bug for this change. But the current patch handles > the sitution and keeps ambari and views properly running. > > Alejandro Fernandez wrote: > I'm on the fence about adding code that works around an existing bug, > especially since the root-cause may lead to other areas that need similar > logic. > Instead, I think it's better to reuse the existing cluster object > (especially if the name coincides with an entity that already exists). > Furthermore, if a cluster is deleted, shouldn't the views have FKs to the > cluster_id so that you can't have orphan views? > > Let's come up with a correct way of fixing this.
ok - Nitiraj ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/58886/#review173490 ----------------------------------------------------------- On May 2, 2017, 8:11 a.m., Nitiraj Rathore wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/58886/ > ----------------------------------------------------------- > > (Updated May 2, 2017, 8:11 a.m.) > > > Review request for Ambari, DIPAYAN BHOWMICK, Gaurav Nagar, Pallav > Kulshreshtha, Rohit Choudhary, venkat sairam, and Ashwin Rajeev. > > > Bugs: AMBARI-20905 > https://issues.apache.org/jira/browse/AMBARI-20905 > > > Repository: ambari > > > Description > ------- > > If installation fails and is retried the cluster id changes but some view > instances keep older cluster ids which stop views from being displayed later > on. > remove the view instances which contains invalid cluster id before creating > any autoview instance. > > > Diffs > ----- > > > ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ViewInstanceDAO.java > 061c7223d6 > > ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java > b632c54043 > ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java > 24eceb21c6 > > ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProviderTest.java > 25afe92ce4 > > ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProviderTest.java > 8836af6ead > > ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java > a3728d46b3 > > > Diff: https://reviews.apache.org/r/58886/diff/2/ > > > Testing > ------- > > updated testcases where ever needed. Manual testing also done. > > > Thanks, > > Nitiraj Rathore > >