You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@ambari.apache.org by Dmitro Lisnichenko <dl...@hortonworks.com> on 2016/11/28 17:10:58 UTC

Re: Review Request 54080: Preview: Auto-fix common issues found by the DB consistency checker

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

(Updated Nov. 28, 2016, 7:10 p.m.)


Review request for Ambari, Jonathan Hurley and Nate Cole.


Changes
-------

Current patch preview contains:
*Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade (seems to work)
*Schema name in postgres is not ambari (we print warnings for any DB type, is it ok?)
*Engine type check for MySQL (not well-tested yet). Should we check engine type for every table, or just for entire schema?


Bugs: AMBARI-18990
    https://issues.apache.org/jira/browse/AMBARI-18990


Repository: ambari


Description
-------

Proposed auto-fixes
*Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
*Deleted services cause config table inconsistent
*Primary key constrain issue from old Ambari version
*Schema name in postgres is not ambari
*Inconsistency view

# If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
# If there are no selected configs, then select the latest ones (could be a bit dangerous)
# If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)

For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)


Diffs (updated)
-----

  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
  ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java PRE-CREATION 

Diff: https://reviews.apache.org/r/54080/diff/


Testing
-------

Work is still in progress. Publishing current patch to get early feedback


Thanks,

Dmitro Lisnichenko


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Nate Cole <nc...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/#review158177
-----------------------------------------------------------


Ship it!




Ship It!

- Nate Cole


On Dec. 6, 2016, 11:29 a.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Dec. 6, 2016, 11:29 a.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Schema name in postgres is not ambari
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5ce6a 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d467a 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a6947ca 
>   ambari-server/src/main/python/ambari-server.py ee6259be04 
>   ambari-server/src/main/python/ambari_server_main.py b35cfc984f 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Checked on live cluster
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Alejandro Fernandez <af...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/#review158258
-----------------------------------------------------------


Fix it, then Ship it!




At some point we also need a cmd-line driven terminal that will prompt users on how to fix these items.
Auto-fixing only applies to very simple use cases.


ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java (line 137)
<https://reviews.apache.org/r/54080/#comment229041>

    Let's remove this, "(may make things worse in some cases)"


- Alejandro Fernandez


On Dec. 6, 2016, 6:44 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Dec. 6, 2016, 6:44 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Schema name in postgres is not ambari
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5ce6a 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d467a 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a6947ca 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java bf0faee752 
>   ambari-server/src/main/python/ambari-server.py ee6259be04 
>   ambari-server/src/main/python/ambari_server_main.py b35cfc984f 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java 45e319a97b 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Checked on live cluster
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.

> On Dec. 6, 2016, 9:39 p.m., Jonathan Hurley wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java, line 431
> > <https://reviews.apache.org/r/54080/diff/4/?file=1577852#file1577852line431>
> >
> >     JPA spec doesn't mention return type of this method; can it be null?

According to javadoc of query.getResultList(), it should always return a list of objects


- Dmitro


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


On Dec. 7, 2016, 5:56 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Dec. 7, 2016, 5:56 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Schema name in postgres is not ambari
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d4 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a694 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java bf0faee 
>   ambari-server/src/main/python/ambari-server.py ee6259b 
>   ambari-server/src/main/python/ambari_server_main.py b35cfc9 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java 45e319a 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Checked on live cluster
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Jonathan Hurley <jh...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/#review158205
-----------------------------------------------------------


Fix it, then Ship it!




Mostly nits to cleanup and clarify...


ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 431)
<https://reviews.apache.org/r/54080/#comment228978>

    JPA spec doesn't mention return type of this method; can it be null?



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 443)
<https://reviews.apache.org/r/54080/#comment228976>

    JavaDoc. The name is confused since it gets configs not mapped to a service (which is different from configs with no mappings)



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 447)
<https://reviews.apache.org/r/54080/#comment228977>

    Let's make this a NamedQuery so it's compiled on startup which helps detect errors.



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 473)
<https://reviews.apache.org/r/54080/#comment228985>

    Clarify to:
    "Checking that there are the same number of actual and desired host components"



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 541)
<https://reviews.apache.org/r/54080/#comment228979>

    We can probably just move this below and make it:
    
    "Ensuring that the schema set for Postgres is correct"



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 559)
<https://reviews.apache.org/r/54080/#comment228980>

    NULL possibility? Maybe use StringUtils for safety.



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 566)
<https://reviews.apache.org/r/54080/#comment228981>

    Let's clarify this a bit:
    `"The schema {} defined for Ambari from ambari.properties has not been found in the database. This means that the Ambari tables are stored under the public schema which can lead to problems.", conf.getDatabaseSchema()`



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 591)
<https://reviews.apache.org/r/54080/#comment228982>

    We can just move this below so that it always runs for MySQL and says:
    
    `Checking to ensure that the MySQL DB engine type is set to InnoDB`



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (lines 609 - 614)
<https://reviews.apache.org/r/54080/#comment228984>

    If there are 30 tables with this problem, that's a lot of repeated error messages. Can we:
    
    - Loop through, adding tables to a list.
    - Print the error once with a StringUtils.join(",")


- Jonathan Hurley


On Dec. 6, 2016, 1:44 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Dec. 6, 2016, 1:44 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Schema name in postgres is not ambari
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5ce6a 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d467a 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a6947ca 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java bf0faee752 
>   ambari-server/src/main/python/ambari-server.py ee6259be04 
>   ambari-server/src/main/python/ambari_server_main.py b35cfc984f 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java 45e319a97b 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Checked on live cluster
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Nate Cole <nc...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/#review158675
-----------------------------------------------------------


Ship it!




Ship It!

- Nate Cole


On Dec. 7, 2016, 10:56 a.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Dec. 7, 2016, 10:56 a.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Schema name in postgres is not ambari
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d4 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a694 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java bf0faee 
>   ambari-server/src/main/python/ambari-server.py ee6259b 
>   ambari-server/src/main/python/ambari_server_main.py b35cfc9 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java 45e319a 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Checked on live cluster
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Jonathan Hurley <jh...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/#review158672
-----------------------------------------------------------


Ship it!




Ship It!

- Jonathan Hurley


On Dec. 7, 2016, 10:56 a.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Dec. 7, 2016, 10:56 a.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Schema name in postgres is not ambari
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d4 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a694 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java bf0faee 
>   ambari-server/src/main/python/ambari-server.py ee6259b 
>   ambari-server/src/main/python/ambari_server_main.py b35cfc9 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java 45e319a 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Checked on live cluster
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/
-----------------------------------------------------------

(Updated Dec. 7, 2016, 5:56 p.m.)


Review request for Ambari, Jonathan Hurley and Nate Cole.


Changes
-------

Fix typo


Bugs: AMBARI-18990
    https://issues.apache.org/jira/browse/AMBARI-18990


Repository: ambari


Description
-------

Proposed auto-fixes
*Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
*Deleted services cause config table inconsistent
*Schema name in postgres is not ambari

# If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.

For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)


Diffs (updated)
-----

  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d4 
  ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a694 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java bf0faee 
  ambari-server/src/main/python/ambari-server.py ee6259b 
  ambari-server/src/main/python/ambari_server_main.py b35cfc9 
  ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java 45e319a 

Diff: https://reviews.apache.org/r/54080/diff/


Testing
-------

Checked on live cluster


Thanks,

Dmitro Lisnichenko


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/
-----------------------------------------------------------

(Updated Dec. 7, 2016, 5:50 p.m.)


Review request for Ambari, Jonathan Hurley and Nate Cole.


Changes
-------

Fixed comments


Bugs: AMBARI-18990
    https://issues.apache.org/jira/browse/AMBARI-18990


Repository: ambari


Description
-------

Proposed auto-fixes
*Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
*Deleted services cause config table inconsistent
*Schema name in postgres is not ambari

# If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.

For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)


Diffs (updated)
-----

  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d4 
  ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a694 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java bf0faee 
  ambari-server/src/main/python/ambari-server.py ee6259b 
  ambari-server/src/main/python/ambari_server_main.py b35cfc9 
  ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java 45e319a 

Diff: https://reviews.apache.org/r/54080/diff/


Testing
-------

Checked on live cluster


Thanks,

Dmitro Lisnichenko


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/
-----------------------------------------------------------

(Updated Dec. 6, 2016, 8:44 p.m.)


Review request for Ambari, Jonathan Hurley and Nate Cole.


Changes
-------

Fixed unit tests, added logging on actions that alter DB


Bugs: AMBARI-18990
    https://issues.apache.org/jira/browse/AMBARI-18990


Repository: ambari


Description
-------

Proposed auto-fixes
*Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
*Deleted services cause config table inconsistent
*Schema name in postgres is not ambari

# If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.

For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)


Diffs (updated)
-----

  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5ce6a 
  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d467a 
  ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a6947ca 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java bf0faee752 
  ambari-server/src/main/python/ambari-server.py ee6259be04 
  ambari-server/src/main/python/ambari_server_main.py b35cfc984f 
  ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java 45e319a97b 

Diff: https://reviews.apache.org/r/54080/diff/


Testing
-------

Checked on live cluster


Thanks,

Dmitro Lisnichenko


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/
-----------------------------------------------------------

(Updated Dec. 6, 2016, 6:29 p.m.)


Review request for Ambari, Jonathan Hurley and Nate Cole.


Bugs: AMBARI-18990
    https://issues.apache.org/jira/browse/AMBARI-18990


Repository: ambari


Description (updated)
-------

Proposed auto-fixes
*Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
*Deleted services cause config table inconsistent
*Schema name in postgres is not ambari

# If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.

For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5ce6a 
  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d467a 
  ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a6947ca 
  ambari-server/src/main/python/ambari-server.py ee6259be04 
  ambari-server/src/main/python/ambari_server_main.py b35cfc984f 

Diff: https://reviews.apache.org/r/54080/diff/


Testing
-------

Checked on live cluster


Thanks,

Dmitro Lisnichenko


Re: Review Request 54080: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/
-----------------------------------------------------------

(Updated Dec. 6, 2016, 6:24 p.m.)


Review request for Ambari, Jonathan Hurley and Nate Cole.


Changes
-------

Final implementation


Summary (updated)
-----------------

Auto-fix common issues found by the DB consistency checker


Bugs: AMBARI-18990
    https://issues.apache.org/jira/browse/AMBARI-18990


Repository: ambari


Description
-------

Proposed auto-fixes
*Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
*Deleted services cause config table inconsistent
*Primary key constrain issue from old Ambari version
*Schema name in postgres is not ambari
*Inconsistency view

# If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
# If there are no selected configs, then select the latest ones (could be a bit dangerous)
# If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)

For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)


Diffs (updated)
-----

  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5ce6a 
  ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java 6fa36d467a 
  ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java 1f2a6947ca 
  ambari-server/src/main/python/ambari-server.py ee6259be04 
  ambari-server/src/main/python/ambari_server_main.py b35cfc984f 

Diff: https://reviews.apache.org/r/54080/diff/


Testing (updated)
-------

Checked on live cluster


Thanks,

Dmitro Lisnichenko


Re: Review Request 54080: Preview: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.

> On Nov. 28, 2016, 7:28 p.m., Jonathan Hurley wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java, lines 518-523
> > <https://reviews.apache.org/r/54080/diff/2/?file=1571156#file1571156line518>
> >
> >     Is this a different check from above?

yes, in these checks we check different tables (state vs desired state)


- Dmitro


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


On Nov. 28, 2016, 7:10 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2016, 7:10 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Primary key constrain issue from old Ambari version
> *Schema name in postgres is not ambari
> *Inconsistency view
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> # If there are no selected configs, then select the latest ones (could be a bit dangerous)
> # If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Work is still in progress. Publishing current patch to get early feedback
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Preview: Auto-fix common issues found by the DB consistency checker

Posted by Jonathan Hurley <jh...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/#review157062
-----------------------------------------------------------




ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 421)
<https://reviews.apache.org/r/54080/#comment227472>

    Transactional?



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (lines 430 - 434)
<https://reviews.apache.org/r/54080/#comment227466>

    Why use raw SQL for this? Why not JPQL?



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (lines 518 - 523)
<https://reviews.apache.org/r/54080/#comment227473>

    Is this a different check from above?



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 609)
<https://reviews.apache.org/r/54080/#comment227474>

    Shouldn't this check only be needed for Postgres?



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 656)
<https://reviews.apache.org/r/54080/#comment227476>

    Hmmm - the ability to support (or even have InnoDB on) doesn't mean that the Ambari tables were created with it. 
    
    I think we need to check this table-by-table.



ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (line 660)
<https://reviews.apache.org/r/54080/#comment227475>

    enums can use ==



ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java (line 20)
<https://reviews.apache.org/r/54080/#comment227477>

    JavaDoc.


- Jonathan Hurley


On Nov. 28, 2016, 12:10 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2016, 12:10 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Primary key constrain issue from old Ambari version
> *Schema name in postgres is not ambari
> *Inconsistency view
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> # If there are no selected configs, then select the latest ones (could be a bit dangerous)
> # If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Work is still in progress. Publishing current patch to get early feedback
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Preview: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.

> On Nov. 29, 2016, 5:42 p.m., Jonathan Hurley wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java, lines 518-523
> > <https://reviews.apache.org/r/54080/diff/2/?file=1571156#file1571156line518>
> >
> >     Really? They both are SELECTing from hostcomponentstate and JOINing on hostcomponentdesiredstate

If I get your question right, the difference is in first query we check where **hcs**.component_name is null (host component state), and in second query we check where **hcds**.component_name is null (host component desired state).


- Dmitro


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


On Nov. 28, 2016, 7:10 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2016, 7:10 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Primary key constrain issue from old Ambari version
> *Schema name in postgres is not ambari
> *Inconsistency view
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> # If there are no selected configs, then select the latest ones (could be a bit dangerous)
> # If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Work is still in progress. Publishing current patch to get early feedback
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Preview: Auto-fix common issues found by the DB consistency checker

Posted by Jonathan Hurley <jh...@hortonworks.com>.

> On Nov. 29, 2016, 10:42 a.m., Jonathan Hurley wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java, lines 518-523
> > <https://reviews.apache.org/r/54080/diff/2/?file=1571156#file1571156line518>
> >
> >     Really? They both are SELECTing from hostcomponentstate and JOINing on hostcomponentdesiredstate
> 
> Dmitro Lisnichenko wrote:
>     If I get your question right, the difference is in first query we check where **hcs**.component_name is null (host component state), and in second query we check where **hcds**.component_name is null (host component desired state).

Ah, OK - it is checking null for name on a different table. However, we can replace this with simple JPA queries, right? So I guess the point is moot.


- Jonathan


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


On Nov. 28, 2016, 12:10 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2016, 12:10 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Primary key constrain issue from old Ambari version
> *Schema name in postgres is not ambari
> *Inconsistency view
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> # If there are no selected configs, then select the latest ones (could be a bit dangerous)
> # If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Work is still in progress. Publishing current patch to get early feedback
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Preview: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.

> On Nov. 29, 2016, 5:42 p.m., Jonathan Hurley wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java, lines 518-523
> > <https://reviews.apache.org/r/54080/diff/2/?file=1571156#file1571156line518>
> >
> >     Really? They both are SELECTing from hostcomponentstate and JOINing on hostcomponentdesiredstate
> 
> Dmitro Lisnichenko wrote:
>     If I get your question right, the difference is in first query we check where **hcs**.component_name is null (host component state), and in second query we check where **hcds**.component_name is null (host component desired state).
> 
> Jonathan Hurley wrote:
>     Ah, OK - it is checking null for name on a different table. However, we can replace this with simple JPA queries, right? So I guess the point is moot.

yes, I've already replaced


- Dmitro


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


On Nov. 28, 2016, 7:10 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2016, 7:10 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Primary key constrain issue from old Ambari version
> *Schema name in postgres is not ambari
> *Inconsistency view
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> # If there are no selected configs, then select the latest ones (could be a bit dangerous)
> # If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Work is still in progress. Publishing current patch to get early feedback
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Preview: Auto-fix common issues found by the DB consistency checker

Posted by Jonathan Hurley <jh...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/#review157258
-----------------------------------------------------------




ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (lines 518 - 523)
<https://reviews.apache.org/r/54080/#comment227785>

    Really? They both are SELECTing from hostcomponentstate and JOINing on hostcomponentdesiredstate


- Jonathan Hurley


On Nov. 28, 2016, 12:10 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2016, 12:10 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Primary key constrain issue from old Ambari version
> *Schema name in postgres is not ambari
> *Inconsistency view
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> # If there are no selected configs, then select the latest ones (could be a bit dangerous)
> # If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Work is still in progress. Publishing current patch to get early feedback
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Preview: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.

> On Nov. 28, 2016, 7:11 p.m., Dmitro Lisnichenko wrote:
> > Current patch preview contains:
> > * Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade (seems to work) 
> > * Schema name in postgres is not ambari (we print warnings for any DB type, is it ok?)
> > * Engine type check for MySQL (not well-tested yet). Should we check engine type for every table, or just for entire schema?

Current patch preview contains:
- Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade (seems to work)   
- Schema name in postgres is not ambari (we print warnings for any DB type, is it ok?)
- Engine type check for MySQL (not well-tested yet). Should we check engine type for every table, or just for entire schema?


- Dmitro


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


On Nov. 28, 2016, 7:10 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2016, 7:10 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Primary key constrain issue from old Ambari version
> *Schema name in postgres is not ambari
> *Inconsistency view
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> # If there are no selected configs, then select the latest ones (could be a bit dangerous)
> # If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Work is still in progress. Publishing current patch to get early feedback
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Preview: Auto-fix common issues found by the DB consistency checker

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/#review157059
-----------------------------------------------------------



Current patch preview contains:
* Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade (seems to work) 
* Schema name in postgres is not ambari (we print warnings for any DB type, is it ok?)
* Engine type check for MySQL (not well-tested yet). Should we check engine type for every table, or just for entire schema?

- Dmitro Lisnichenko


On Nov. 28, 2016, 7:10 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2016, 7:10 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Primary key constrain issue from old Ambari version
> *Schema name in postgres is not ambari
> *Inconsistency view
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> # If there are no selected configs, then select the latest ones (could be a bit dangerous)
> # If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Work is still in progress. Publishing current patch to get early feedback
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>


Re: Review Request 54080: Preview: Auto-fix common issues found by the DB consistency checker

Posted by Nate Cole <nc...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54080/#review157058
-----------------------------------------------------------




ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java (lines 411 - 421)
<https://reviews.apache.org/r/54080/#comment227464>

    Would rather use JPA entities and a named query here instead.  I realize this class uses SQL and you were following the pattern, but still.



ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java (lines 28 - 35)
<https://reviews.apache.org/r/54080/#comment227465>

    This class shouldn't be necessary - we already have entities that we can check that contain the same information.


- Nate Cole


On Nov. 28, 2016, 12:10 p.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54080/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2016, 12:10 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-18990
>     https://issues.apache.org/jira/browse/AMBARI-18990
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Proposed auto-fixes
> *Inconsistency for table hostcomponentdesiredstate and hostcomponentstate for stack upgrade.
> *Deleted services cause config table inconsistent
> *Primary key constrain issue from old Ambari version
> *Schema name in postgres is not ambari
> *Inconsistency view
> 
> # If there are missing states (service, component, host), etc, then automatically add one with a value of UNKNOWN or INSTALLED.
> # If there are no selected configs, then select the latest ones (could be a bit dangerous)
> # If there are multiple selected configs for the same type, then unselect all but the most recent (could be a bit dangerous)
> 
> For dangerous options, by default fail with warning, and provide console option to perform fixes anyway (like the fsck does)
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java 9c3ae5c 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/MissedHostComponentState.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54080/diff/
> 
> 
> Testing
> -------
> 
> Work is still in progress. Publishing current patch to get early feedback
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>