[ 
https://issues.apache.org/jira/browse/AMBARI-16836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nitiraj Singh Rathore updated AMBARI-16836:
-------------------------------------------
    Status: Patch Available  (was: Open)

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.

> View Instance: Data Migration
> -----------------------------
>
>                 Key: AMBARI-16836
>                 URL: https://issues.apache.org/jira/browse/AMBARI-16836
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-views
>    Affects Versions: 2.4.0
>            Reporter: Nitiraj Singh Rathore
>            Assignee: Nitiraj Singh Rathore
>             Fix For: 2.4.0
>
>         Attachments: AMBARI-16836_branch-2.4-1.patch
>
>
> Provide instructions for performing the following:
> 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
> 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.
> 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?
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to