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

Serge Huber reassigned UNOMI-516:
---------------------------------

    Assignee: Serge Huber

> Error in migration from 1.4 to 1.5 when patches have been used
> --------------------------------------------------------------
>
>                 Key: UNOMI-516
>                 URL: https://issues.apache.org/jira/browse/UNOMI-516
>             Project: Apache Unomi
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.7
>            Reporter: Serge Huber
>            Assignee: Serge Huber
>            Priority: Major
>             Fix For: 2.0.0, 1.6.0
>
>         Attachments: unomierror.png
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When migrating from 1.4 with a dataset that never used patches the following 
> error occurs:
> !unomierror.png!
> A workaround is to force some mappings to exist for example with the 
> following request:
> {code}
> curl -X PUT "localhost:9210/context/_mapping/patch?pretty" -H 'Content-Type: 
> application/json' -d'
> {
>   "dynamic_templates": [
>     {
>       "all": {
>         "match": "*",
>         "match_mapping_type": "string",
>         "mapping": {
>           "type": "text",
>           "analyzer": "folding",
>           "fields": {
>             "keyword": {
>               "type": "keyword",
>               "ignore_above": 256
>             }
>           }
>         }
>       }
>     }
>   ],
>   "properties": {
>     "patchedItemId": {
>       "type": "text"
>     },
>     "patchedItemType": {
>       "type": "text"
>     },
>     "operation": {
>       "type": "text"
>     },
>     "data": {
>       "type": "object"
>     },
>     "lastApplication": {
>       "type": "date"
>     }
>   }
> }
> '
> {code}
> Here's the full procedure for upgrading from 1.4.0 to 1.5.x using the above 
> request: 
> # We are assuming the following start state: both Unomi versions are shutdown 
> or uninstalled and both ES version are shutdown or uninstalled.
> # If needed purge ES 7 install by shutting it down and deleting the "data" 
> directory : TARGET_ES: rm -rf data
> # Make sure your ES 5 config/elasticsearch.yml looks something like this:
> cluster.name: contextElasticSearch
> http.port: 9210
> transport.tcp.port: 9310
> # Make sure your ES 7 config/elasticsearch.yml contains the following 
> settings: 
> reindex.remote.whitelist: "localhost:9210"
> # Start ES 7 : TARGET_ES: bin/elasticsearch
> # Start ES 5 : SOURCE_ES: bin/elasticsearch
> # Assuming ES 5 is on port 9210, execute the above CURL request
> # Uncompress Unomi 1.5.7 or at the very least remove its "data" directory. 
> UNOMI_1.5.7: rm -rf data
> # Start Unomi 1.5.7 with : bin/karaf
> # Type in Unomi 1.5.7 console: migrate 1.4.0
> # Answer all prompts, and now the migration should complete successfully.
> Here's an example of a successfully migration:
> {code}
> unomi-1.5.7 loom$ rm -rf data
> unomi-1.5.7 loom$ bin/karaf
>         __ __                  ____      
>        / //_/____ __________ _/ __/      
>       / ,<  / __ `/ ___/ __ `/ /_        
>      / /| |/ /_/ / /  / /_/ / __/        
>     /_/ |_|\__,_/_/   \__,_/_/         
>   Apache Karaf (4.2.8)
> Hit '<tab>' for a list of available commands
> and '[cmd] --help' for help on a specific command.
> Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
> karaf@root()> migrate 1.4.0
> [WARNING] You are about to execute a migration, this a very sensitive 
> operation, are you sure? (yes/no): yes                                        
>                                                                               
>                                        
> Starting migration process from version: 1.4.0
> current version: 1.5.7
> We need to initialize a HttpClient, do we need to trust all certificates? 
> (yes/no): yes                                                                 
>                                                                               
>                                    
> Enter ElasticSearch 7 TARGET address (default = http://localhost:9200):       
>                                                                               
>                                                                               
>                                
> Starting migration to version 1.5.0, do you want to proceed? (yes/no):        
>                                                                               
>                                                                               
>                                
> Starting migration to version 1.5.0, do you want to proceed? (yes/no):        
>                                                                               
>                                                                               
>                                
> Starting migration to version 1.5.0, do you want to proceed? (yes/no):        
>                                                                               
>                                                                               
>                                
> Starting migration to version 1.5.0, do you want to proceed? (yes/no): yes    
>                                                                               
>                                                                               
>                                
> SOURCE Elasticsearch 5.6 cluster address (default: http://localhost:9210) :   
>                                                                               
>                                                                               
>                                
> SOURCE index name (default: context) :                                        
>                                                                               
>                                                                               
>                                
> TARGET index prefix (default: context) :                                      
>                                                                               
>                                                                               
>                                
> Number of shards for TARGET (default: 5) :                                    
>                                                                               
>                                                                               
>                                
> Number of replicas for TARGET (default: 1) :                                  
>                                                                               
>                                                                               
>                                
> Reindexing geonames to context-geonameentry...
> Reindexing completed in 232ms. 
> Result={"took":86,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-userlist...
> Reindexing completed in 20ms. 
> Result={"took":13,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-actiontype...
> Reindexing completed in 20ms. 
> Result={"took":14,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-campaign...
> Reindexing completed in 15ms. 
> Result={"took":11,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-campaignevent...
> Reindexing completed in 13ms. 
> Result={"took":10,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-conditiontype...
> Reindexing completed in 14ms. 
> Result={"took":10,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context-2021-10 to context-event-date-2021-10...
> Reindexing completed in 93ms. 
> Result={"took":88,"timed_out":false,"total":6,"updated":0,"created":6,"deleted":0,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-exportconfig...
> Reindexing completed in 14ms. 
> Result={"took":9,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-goal...
> Reindexing completed in 16ms. 
> Result={"took":11,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-importconfig...
> Reindexing completed in 18ms. 
> Result={"took":11,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-patch...
> Reindexing completed in 11ms. 
> Result={"took":8,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-persona...
> Reindexing completed in 24ms. 
> Result={"took":21,"timed_out":false,"total":2,"updated":0,"created":2,"deleted":0,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-personasession...
> Reindexing completed in 28ms. 
> Result={"took":24,"timed_out":false,"total":2,"updated":0,"created":2,"deleted":0,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-profile...
> Reindexing completed in 21ms. 
> Result={"took":17,"timed_out":false,"total":1,"updated":0,"created":1,"deleted":0,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-propertytype...
> Reindexing completed in 39ms. 
> Result={"took":35,"timed_out":false,"total":39,"updated":0,"created":39,"deleted":0,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-rule...
> Reindexing completed in 28ms. 
> Result={"took":23,"timed_out":false,"total":10,"updated":0,"created":10,"deleted":0,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-rulestats...
> Reindexing completed in 26ms. 
> Result={"took":22,"timed_out":false,"total":9,"updated":0,"created":9,"deleted":0,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-scoring...
> Reindexing completed in 15ms. 
> Result={"took":11,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context to context-segment...
> Reindexing completed in 15ms. 
> Result={"took":10,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Reindexing context-2021-10 to context-session-date-2021-10...
> Reindexing completed in 34ms. 
> Result={"took":29,"timed_out":false,"total":1,"updated":0,"created":1,"deleted":0,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
> Migration operations completed in 7162ms
> Migration to version 1.5.0 done successfully
> karaf@root()> unomi:start
> Initializing Unomi...
>         ____ ___     A P A C H E     .__
>        |    |   \____   ____   _____ |__|
>        |    |   /    \ /  _ \ /     \|  |
>        |    |  /   |  (  <_> )  Y Y  \  |
>        |______/|___|  /\____/|__|_|  /__|
>                     \/             \/
> --------------------------------------------------------------------------
>   1.5.7  Build:7abee  Timestamp:1627053381505
> --------------------------------------------------------------------------
> Successfully started 16 bundles and 2 required services in 33696 ms
> karaf@root()>                                                                 
>                                                                               
>                                                                               
>                                
> karaf@root()> profile-list
> ID                                   │ Scope       │ Segments │ Consents │ 
> Last visit           │ Last update
> ─────────────────────────────────────┼─────────────┼──────────┼──────────┼──────────────────────┼────────────
> ec16daf7-4202-4438-a0ef-0e86731f7d36 │ systemscope │          │          │ 
> 2021-10-14T08:11:17Z │
> karaf@root()> session-list
> ID                                   │ Scope             │ Last event         
>            │ Duration │ Profile                              │ Timestamp
> ─────────────────────────────────────┼───────────────────┼───────────────────────────────┼──────────┼──────────────────────────────────────┼──────────────────────────────
> 5318fc80-23a0-bd2a-92e3-29046c9acdb6 │ realEstateManager │ Thu Oct 14 
> 10:11:20 CEST 2021 │ 3387     │ ec16daf7-4202-4438-a0ef-0e86731f7d36 │ Thu 
> Oct 14 10:11:17 CEST 2021
> karaf@root()> logout
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to