You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@ambari.apache.org by Daniel Gergely <dg...@hortonworks.com> on 2016/04/13 17:00:40 UTC

Review Request 46148: NPE when deleting a host

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

Review request for Ambari, Laszlo Puskas, Oliver Szabo, Sandor Magyari, and Sebastian Toader.


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


Repository: ambari


Description
-------

When deleting a host, NPE may occur.
TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java caab7df 

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


Testing
-------


Thanks,

Daniel Gergely


Re: Review Request 46148: NPE when deleting a host

Posted by Oliver Szabo <os...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46148/#review128867
-----------------------------------------------------------


Ship it!




Ship It!

- Oliver Szabo


On April 14, 2016, 10:25 a.m., Daniel Gergely wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46148/
> -----------------------------------------------------------
> 
> (Updated April 14, 2016, 10:25 a.m.)
> 
> 
> Review request for Ambari, Laszlo Puskas, Oliver Szabo, Robert Levas, Sandor Magyari, and Sebastian Toader.
> 
> 
> Bugs: AMBARI-15862
>     https://issues.apache.org/jira/browse/AMBARI-15862
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> When deleting a host, NPE may occur.
> TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
> In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
> Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.
> 
> Lob and Basic annotations were removed, because that column in the database is not a CLOB. This turned out during running the test (in memory db is created based on these annotations).
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyHostGroupEntity.java 0a81286 
>   ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java c5554f7 
>   ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java daf8d12 
> 
> Diff: https://reviews.apache.org/r/46148/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Daniel Gergely
> 
>


Re: Review Request 46148: NPE when deleting a host

Posted by Sebastian Toader <st...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46148/#review128869
-----------------------------------------------------------


Ship it!




Ship It!

- Sebastian Toader


On April 14, 2016, 12:25 p.m., Daniel Gergely wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46148/
> -----------------------------------------------------------
> 
> (Updated April 14, 2016, 12:25 p.m.)
> 
> 
> Review request for Ambari, Laszlo Puskas, Oliver Szabo, Robert Levas, Sandor Magyari, and Sebastian Toader.
> 
> 
> Bugs: AMBARI-15862
>     https://issues.apache.org/jira/browse/AMBARI-15862
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> When deleting a host, NPE may occur.
> TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
> In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
> Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.
> 
> Lob and Basic annotations were removed, because that column in the database is not a CLOB. This turned out during running the test (in memory db is created based on these annotations).
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyHostGroupEntity.java 0a81286 
>   ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java c5554f7 
>   ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java daf8d12 
> 
> Diff: https://reviews.apache.org/r/46148/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Daniel Gergely
> 
>


Re: Review Request 46148: NPE when deleting a host

Posted by Laszlo Puskas <lp...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46148/#review128879
-----------------------------------------------------------


Ship it!




Ship It!

- Laszlo Puskas


On April 14, 2016, 11:41 a.m., Daniel Gergely wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46148/
> -----------------------------------------------------------
> 
> (Updated April 14, 2016, 11:41 a.m.)
> 
> 
> Review request for Ambari, Laszlo Puskas, Oliver Szabo, Robert Levas, Sandor Magyari, and Sebastian Toader.
> 
> 
> Bugs: AMBARI-15862
>     https://issues.apache.org/jira/browse/AMBARI-15862
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> When deleting a host, NPE may occur.
> TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
> In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
> Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.
> 
> Lob and Basic annotations were removed, because that column in the database is not a CLOB. This turned out during running the test (in memory db is created based on these annotations).
> 
> The new test case adds hostRequests to the cluster, some of them have no host name (=null) to simulate hosts that have not registered to the cluster yet. If no exception is thrown when deleting a registered host, then it is successful.
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyHostGroupEntity.java 0a81286 
>   ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java c5554f7 
>   ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java daf8d12 
> 
> Diff: https://reviews.apache.org/r/46148/diff/
> 
> 
> Testing
> -------
> 
> Branch 2.2.2
> 
> Results :
> 
> Tests run: 3553, Failures: 0, Errors: 0, Skipped: 36
> 
> ...
> 
> Total run:925
> Total errors:0
> Total failures:0
> 
> ...
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1:11:47.762s
> [INFO] Finished at: Thu Apr 14 13:40:06 CEST 2016
> [INFO] Final Memory: 46M/1060M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Daniel Gergely
> 
>


Re: Review Request 46148: NPE when deleting a host

Posted by Sandor Magyari <sm...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46148/#review128881
-----------------------------------------------------------


Ship it!




Ship It!

- Sandor Magyari


On April 14, 2016, 11:41 a.m., Daniel Gergely wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46148/
> -----------------------------------------------------------
> 
> (Updated April 14, 2016, 11:41 a.m.)
> 
> 
> Review request for Ambari, Laszlo Puskas, Oliver Szabo, Robert Levas, Sandor Magyari, and Sebastian Toader.
> 
> 
> Bugs: AMBARI-15862
>     https://issues.apache.org/jira/browse/AMBARI-15862
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> When deleting a host, NPE may occur.
> TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
> In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
> Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.
> 
> Lob and Basic annotations were removed, because that column in the database is not a CLOB. This turned out during running the test (in memory db is created based on these annotations).
> 
> The new test case adds hostRequests to the cluster, some of them have no host name (=null) to simulate hosts that have not registered to the cluster yet. If no exception is thrown when deleting a registered host, then it is successful.
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyHostGroupEntity.java 0a81286 
>   ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java c5554f7 
>   ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java daf8d12 
> 
> Diff: https://reviews.apache.org/r/46148/diff/
> 
> 
> Testing
> -------
> 
> Branch 2.2.2
> 
> Results :
> 
> Tests run: 3553, Failures: 0, Errors: 0, Skipped: 36
> 
> ...
> 
> Total run:925
> Total errors:0
> Total failures:0
> 
> ...
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1:11:47.762s
> [INFO] Finished at: Thu Apr 14 13:40:06 CEST 2016
> [INFO] Final Memory: 46M/1060M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Daniel Gergely
> 
>


Re: Review Request 46148: NPE when deleting a host

Posted by Sebastian Toader <st...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46148/#review128880
-----------------------------------------------------------


Ship it!




Ship It!

- Sebastian Toader


On April 14, 2016, 1:41 p.m., Daniel Gergely wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46148/
> -----------------------------------------------------------
> 
> (Updated April 14, 2016, 1:41 p.m.)
> 
> 
> Review request for Ambari, Laszlo Puskas, Oliver Szabo, Robert Levas, Sandor Magyari, and Sebastian Toader.
> 
> 
> Bugs: AMBARI-15862
>     https://issues.apache.org/jira/browse/AMBARI-15862
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> When deleting a host, NPE may occur.
> TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
> In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
> Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.
> 
> Lob and Basic annotations were removed, because that column in the database is not a CLOB. This turned out during running the test (in memory db is created based on these annotations).
> 
> The new test case adds hostRequests to the cluster, some of them have no host name (=null) to simulate hosts that have not registered to the cluster yet. If no exception is thrown when deleting a registered host, then it is successful.
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyHostGroupEntity.java 0a81286 
>   ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java c5554f7 
>   ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java daf8d12 
> 
> Diff: https://reviews.apache.org/r/46148/diff/
> 
> 
> Testing
> -------
> 
> Branch 2.2.2
> 
> Results :
> 
> Tests run: 3553, Failures: 0, Errors: 0, Skipped: 36
> 
> ...
> 
> Total run:925
> Total errors:0
> Total failures:0
> 
> ...
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1:11:47.762s
> [INFO] Finished at: Thu Apr 14 13:40:06 CEST 2016
> [INFO] Final Memory: 46M/1060M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Daniel Gergely
> 
>


Re: Review Request 46148: NPE when deleting a host

Posted by Daniel Gergely <dg...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46148/
-----------------------------------------------------------

(Updated ápr. 14, 2016, 11:41 de)


Review request for Ambari, Laszlo Puskas, Oliver Szabo, Robert Levas, Sandor Magyari, and Sebastian Toader.


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


Repository: ambari


Description
-------

When deleting a host, NPE may occur.
TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.

Lob and Basic annotations were removed, because that column in the database is not a CLOB. This turned out during running the test (in memory db is created based on these annotations).

The new test case adds hostRequests to the cluster, some of them have no host name (=null) to simulate hosts that have not registered to the cluster yet. If no exception is thrown when deleting a registered host, then it is successful.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyHostGroupEntity.java 0a81286 
  ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java c5554f7 
  ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java daf8d12 

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


Testing (updated)
-------

Branch 2.2.2

Results :

Tests run: 3553, Failures: 0, Errors: 0, Skipped: 36

...

Total run:925
Total errors:0
Total failures:0

...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:11:47.762s
[INFO] Finished at: Thu Apr 14 13:40:06 CEST 2016
[INFO] Final Memory: 46M/1060M
[INFO] ------------------------------------------------------------------------


Thanks,

Daniel Gergely


Re: Review Request 46148: NPE when deleting a host

Posted by Daniel Gergely <dg...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46148/
-----------------------------------------------------------

(Updated ápr. 14, 2016, 10:49 de)


Review request for Ambari, Laszlo Puskas, Oliver Szabo, Robert Levas, Sandor Magyari, and Sebastian Toader.


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


Repository: ambari


Description (updated)
-------

When deleting a host, NPE may occur.
TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.

Lob and Basic annotations were removed, because that column in the database is not a CLOB. This turned out during running the test (in memory db is created based on these annotations).

The new test case adds hostRequests to the cluster, some of them have no host name (=null) to simulate hosts that have not registered to the cluster yet. If no exception is thrown when deleting a registered host, then it is successful.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyHostGroupEntity.java 0a81286 
  ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java c5554f7 
  ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java daf8d12 

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


Testing
-------


Thanks,

Daniel Gergely


Re: Review Request 46148: NPE when deleting a host

Posted by Daniel Gergely <dg...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46148/
-----------------------------------------------------------

(Updated ápr. 14, 2016, 10:25 de)


Review request for Ambari, Laszlo Puskas, Oliver Szabo, Robert Levas, Sandor Magyari, and Sebastian Toader.


Changes
-------

Test added


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


Repository: ambari


Description (updated)
-------

When deleting a host, NPE may occur.
TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.

Lob and Basic annotations were removed, because that column in the database is not a CLOB. This turned out during running the test (in memory db is created based on these annotations).


Diffs (updated)
-----

  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyHostGroupEntity.java 0a81286 
  ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java c5554f7 
  ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java daf8d12 

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


Testing
-------


Thanks,

Daniel Gergely


Re: Review Request 46148: NPE when deleting a host

Posted by Daniel Gergely <dg...@hortonworks.com>.

> On ápr. 13, 2016, 3:05 du, Oliver Szabo wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java, line 914
> > <https://reviews.apache.org/r/46148/diff/1/?file=1342675#file1342675line914>
> >
> >     Can you provide a test for that case when the hostname is null? (to avoid that someone change the code here again)

Yes, will do, but ClustersImpl has no test at all right now, so it will take a while to build up a testcase for that.


- Daniel


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


On ápr. 13, 2016, 3:04 du, Daniel Gergely wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46148/
> -----------------------------------------------------------
> 
> (Updated ápr. 13, 2016, 3:04 du)
> 
> 
> Review request for Ambari, Laszlo Puskas, Oliver Szabo, Sandor Magyari, and Sebastian Toader.
> 
> 
> Bugs: AMBARI-15862
>     https://issues.apache.org/jira/browse/AMBARI-15862
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> When deleting a host, NPE may occur.
> TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
> In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
> Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java caab7df 
> 
> Diff: https://reviews.apache.org/r/46148/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Daniel Gergely
> 
>


Re: Review Request 46148: NPE when deleting a host

Posted by Oliver Szabo <os...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46148/#review128689
-----------------------------------------------------------




ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java (line 914)
<https://reviews.apache.org/r/46148/#comment192154>

    Can you provide a test for that case when the hostname is null? (to avoid that someone change the code here again)


- Oliver Szabo


On April 13, 2016, 3:04 p.m., Daniel Gergely wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46148/
> -----------------------------------------------------------
> 
> (Updated April 13, 2016, 3:04 p.m.)
> 
> 
> Review request for Ambari, Laszlo Puskas, Oliver Szabo, Sandor Magyari, and Sebastian Toader.
> 
> 
> Bugs: AMBARI-15862
>     https://issues.apache.org/jira/browse/AMBARI-15862
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> When deleting a host, NPE may occur.
> TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
> In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
> Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java caab7df 
> 
> Diff: https://reviews.apache.org/r/46148/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Daniel Gergely
> 
>


Re: Review Request 46148: NPE when deleting a host

Posted by Daniel Gergely <dg...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46148/
-----------------------------------------------------------

(Updated ápr. 13, 2016, 3:04 du)


Review request for Ambari, Laszlo Puskas, Oliver Szabo, Sandor Magyari, and Sebastian Toader.


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


Repository: ambari


Description
-------

When deleting a host, NPE may occur.
TopologyHostRequests are created with hostName=null at the first time, and when hosts are registered, then these null values are replaced with the correct host names.
In the case when a host is being deleted, a loop checks the host name for all the requests, and if there is a request with hostName=null, a NPE is thrown.
Swapping the sides of **equals** method can solve the problem, since the variable **hostname** is checked before and not null.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java caab7df 

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


Testing
-------


Thanks,

Daniel Gergely