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

(Updated Aug. 7, 2016, 10:52 p.m.)


Review request for Ambari, Alejandro Fernandez, Robert Levas, and Robert 
Nettleton.


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


Repository: ambari


Description
-------

Noticed the following on an upgraded cluster:
This is not related to EU it seems:

```
java.lang.NullPointerException
        at 
org.apache.ambari.server.controller.internal.AlertResourceProvider.toResource(AlertResourceProvider.java:277)
        at 
org.apache.ambari.server.controller.internal.AlertResourceProvider.getResources(AlertResourceProvider.java:234)
        at 
org.apache.ambari.server.controller.internal.AlertResourceProvider.queryForResources(AlertResourceProvider.java:160)
```

It looks like this is a problem with database consistency, namely that our 
upgrade logic does NOT properly enforce non-null and default values!
```
//TODO workaround for default values, possibly we will have full support later
if (columnInfo.getDefaultValue() != null) {
  columnInfo.setNullable(true);
      }
```

Turns out we're doing at least 2 things very wrong here when changing the DB on 
Ambari upgrade:
- Not enforcing non-NULL constraint on columns
- Not enforcing a default constraint on column

This is most likely due to limitations in EclipseLink's {{TableDefinition}} and 
{{FieldDefinition}} classes which we rely on for our upgrade logic.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessor.java 
5f126f6 
  ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java 
ea5f496 
  
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity.java
 77f5acc 
  
ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/DbmsHelper.java
 30c06fb 
  
ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/GenericDbmsHelper.java
 21fa361 
  
ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/OracleHelper.java
 88ef8fe 
  
ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java
 ac8bea1 

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


Testing (updated)
-------

Tested an upgrade from Ambari 2.2 / HDP 2.3 to Ambari 2.4.0 on:
- MySQL
- Postgres
- Oracle

Existing errors on trunk not a result of this patch.

Tests in error:
  AmbariManagementControllerTest.testScheduleSmokeTest:9759 ยป Rollback 
Exception...

Tests run: 4596, Failures: 0, Errors: 1, Skipped: 34

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31:28 min
[INFO] Finished at: 2016-08-07T22:35:25-04:00
[INFO] Final Memory: 47M/677M
[INFO] ------------------------------------------------------------------------


Thanks,

Jonathan Hurley

Reply via email to