You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Rohit Choudhary <rc...@hortonworks.com> on 2015/08/12 17:47:41 UTC

Review Request 37398: Ambari server upgrade does not re-extract the jar content of the views

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

Review request for Ambari, Mahadev Konar and Srimanth Gunturi.


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


Repository: ambari


Description
-------

The issue of not extracting the jar is because of the following:

* *serverUpgrade.py* has a method "upgrade", which deletes only the admin view directory for upgrade between 1.7.0  & 2.0.0, 
 
```
admin_views_dirs = get_admin_views_dir(properties)
  for admin_views_dir in admin_views_dirs:
    shutil.rmtree(admin_views_dir)
```


* *serverSetup.py*, has a method extract_views which internally calls the ViewExtractor - 

```
VIEW_EXTRACT_CMD = "{0} -cp {"org.apache.ambari.server.view.ViewRegistry extract {2} "> " + configDefaults.SERVER_OUT_FILE + " 2>&1"
```


The fix would require removing existing view directories and extracting the views by using the extract_views in the upgrade script. The removal of directories is must because currently the ViewExtractor skips, if the archive directory exists, as under:
*ViewExtractor.java*
  
```
// Skip if the archive has already been extracted
            if (!archiveDir.exists()) {
```

Therefore, the fix is done within the upgrade step, where a new method to delete the extracted jars is added. The work directory therefore removes all the exploded view artifacts. At the time of server restart the extract_view method calls the ViewExtractor, and since the directory is not present, it explodes the jar into the work directory.


Diffs
-----

  ambari-server/src/main/python/ambari_server/serverConfiguration.py 8ad6c9c 
  ambari-server/src/main/python/ambari_server/serverUpgrade.py 2ab4c94 

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


Testing
-------

Tested upgrade scripts on local VMs for:
- Dummy upgrade without changing repository artifact. Checked that the exploded artifacts are getting deleted and recreated
- Upgraded Ambari server 2.0 to 2.1 version.


Thanks,

Rohit Choudhary


Re: Review Request 37398: Ambari server upgrade does not re-extract the jar content of the views

Posted by Srimanth Gunturi <sr...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37398/#review95209
-----------------------------------------------------------

Ship it!


Ship It!

- Srimanth Gunturi


On Aug. 12, 2015, 3:47 p.m., Rohit Choudhary wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/37398/
> -----------------------------------------------------------
> 
> (Updated Aug. 12, 2015, 3:47 p.m.)
> 
> 
> Review request for Ambari, Mahadev Konar and Srimanth Gunturi.
> 
> 
> Bugs: AMBARI-12747
>     https://issues.apache.org/jira/browse/AMBARI-12747
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The issue of not extracting the jar is because of the following:
> 
> * *serverUpgrade.py* has a method "upgrade", which deletes only the admin view directory for upgrade between 1.7.0  & 2.0.0, 
>  
> ```
> admin_views_dirs = get_admin_views_dir(properties)
>   for admin_views_dir in admin_views_dirs:
>     shutil.rmtree(admin_views_dir)
> ```
> 
> 
> * *serverSetup.py*, has a method extract_views which internally calls the ViewExtractor - 
> 
> ```
> VIEW_EXTRACT_CMD = "{0} -cp {"org.apache.ambari.server.view.ViewRegistry extract {2} "> " + configDefaults.SERVER_OUT_FILE + " 2>&1"
> ```
> 
> 
> The fix would require removing existing view directories and extracting the views by using the extract_views in the upgrade script. The removal of directories is must because currently the ViewExtractor skips, if the archive directory exists, as under:
> *ViewExtractor.java*
>   
> ```
> // Skip if the archive has already been extracted
>             if (!archiveDir.exists()) {
> ```
> 
> Therefore, the fix is done within the upgrade step, where a new method to delete the extracted jars is added. The work directory therefore removes all the exploded view artifacts. At the time of server restart the extract_view method calls the ViewExtractor, and since the directory is not present, it explodes the jar into the work directory.
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/python/ambari_server/serverConfiguration.py 8ad6c9c 
>   ambari-server/src/main/python/ambari_server/serverUpgrade.py 2ab4c94 
> 
> Diff: https://reviews.apache.org/r/37398/diff/
> 
> 
> Testing
> -------
> 
> Tested upgrade scripts on local VMs for:
> - Dummy upgrade without changing repository artifact. Checked that the exploded artifacts are getting deleted and recreated
> - Upgraded Ambari server 2.0 to 2.1 version.
> 
> 
> Thanks,
> 
> Rohit Choudhary
> 
>