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

Review request for Ambari, DIPAYAN BHOWMICK, Gaurav Nagar, Pallav Kulshreshtha, 
Rohit Choudhary, and Ashwin Rajeev.


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


Repository: ambari


Description
-------

1) TWO INSTANCES, SAME VERSION
User has view100 instance A. Create view100 instance B. After creation of 
instance B, how the Admin will migrate data (entity, instance, perms) from A -> 
B
To migrate from view "VIEW" ver 1.0.0 instance A to view "VIEW" ver 1.0.0 
instance B, admin should make the call
curl -v -u admin:admin -X PUT -H X-Requested-By:1 
http://127.0.0.1:8080/api/v1/views/VIEW/versions/1.0.0/instances/B/migrate/1.0.0/A
so we're calling method /migrate on the target instance and passing the origin 
instance version and name.
2) TWO INSTANCES, NEWER VERSION
User has view100 instance A. Create view200 instance B. After creation of 
instance B, how the Admin will migrate data (entity, instance, perms) from A -> 
B.
If version is different, the migration process is absolutely same, just specify 
proper version in the call:
To migrate from view "VIEW" ver 1.0.0 instance A to view "VIEW" ver 2.0.0 
instance B, the call is
curl -v -u admin:admin -X PUT -H X-Requested-By:1 
http://127.0.0.1:8080/api/v1/views/VIEW/versions/2.0.0/instances/B/migrate/1.0.0/A
Note that to make the migration the origin view should be loaded in the ambari, 
which means that the jar file of previous version should be present in 
/var/lib/ambari-server/resources/views.
3) NEWER VERSION IN NEW AMBARI
User has view100 instance A in Ambari 2.2.2. They upgrade to Ambari 2.4.0 with 
a newer version of view200. The view200 instance is not auto-created. So would 
they just follow #2?
Because of the packaging system, old jar version will be removed in the case of 
upgrade (old version jar will be removed and new version will be installed), 
which means that view of old version will not be loaded, so manual upgrade will 
not be available.
As well as access to old instances will not be available.
But there's mechanism for auto-migration for upgraded views. During the startup 
Ambari looks for old views and tries to migrate data from them if there's an 
instance of same name. This is done for auto-instances but can be used for any, 
so admin needs to just create an instance of same name as old one and restart 
the Ambari. ViewRegistry will detect that there's instance of same name in new 
and old views and will migrate data.
4) NEW INSTANCE -> NEWER VERSION
User has view100 instance A and when they create view200 instance B, 
automatically migrate data (entity, instance, perms) from A -> B.
Automatic migration is now works only for newer version of view from older ones 
with same name, but manual migration can migrate from any instance to any. So 
just follow #2.
One more note: this patch saves the functionality of upgrading the view without 
changing the version, so if it's small bugfix version can be remained the same. 
Ambari will detect that jar file is newer than extracted directory and will 
re-extract the view.


Diffs
-----

  
ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewDataMigrationService.java
 c6846ce 
  
ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationContextImpl.java
 94e3e28 
  
ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationUtility.java
 PRE-CREATION 
  ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java 
3550f98 
  ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java 
bda1079 
  ambari-server/src/main/python/ambari_server/serverUpgrade.py cdcce1c 
  
ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewDataMigrationServiceTest.java
 1eb7ac2 
  
ambari-server/src/test/java/org/apache/ambari/server/view/ViewDataMigrationContextImplTest.java
 a636e0b 
  
ambari-server/src/test/java/org/apache/ambari/server/view/ViewDataMigrationUtilityTest.java
 PRE-CREATION 
  
ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java 
5b24b19 

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


Testing
-------

Update the unit test cases.


Thanks,

Nitiraj Rathore

Reply via email to