Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1235091 - Add database upgrade scripts to BPMS distribution
Add database upgrade scripts to BPMS distribution
Status: VERIFIED
Product: JBoss BPMS Platform 6
Classification: Retired
Component: Migration Tool (Show other bugs)
6.1.0
Unspecified Unspecified
urgent Severity urgent
: CR1
: 6.2.0
Assigned To: Ryan Zhang
Tibor Zimanyi
:
Depends On:
Blocks: 1260377 1272120 1273622 1276039
  Show dependency treegraph
 
Reported: 2015-06-23 21:04 EDT by Toshiya Kobayashi
Modified: 2015-12-21 11:15 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1273622 (view as bug list)
Environment:
Last Closed:
Type: Enhancement
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
BZ1235091_reproducer.zip (1.08 MB, application/zip)
2015-06-23 22:43 EDT, Toshiya Kobayashi
no flags Details

  None (edit)
Description Toshiya Kobayashi 2015-06-23 21:04:02 EDT
Description of problem:

Migration from 6.x to 6.y would include database schema changes. Schema update is processed by Hibernate. But if a column is newly added to a table, the value will be 'null' when migrated.

Community installer includes upgrade-scripts to populate such columns.

https://github.com/droolsjbpm/jbpm/tree/master/jbpm-installer/db/upgrade-scripts

I think we need to include the scripts in our distribution (e.g. supplementary-tools) and let them involved in our QA migration test.

Steps to Reproduce:
1. Start a process instance with PerProcessInstanceRuntimeManager in BPMS 6.0.3. The process instance waits at a User Task.
2. Migrate the database to BPMS 6.1.0. (hibernate.hbm2ddl.auto=update)
3. Look at ContextMappingInfo table
4. Resume the process instance in BPMS 6.1.0

Actual results:

ContextMappingInfo.OWNER_ID is NULL.

mysql> select * from ContextMappingInfo;
+-----------+------------+-------------+---------+----------+
| mappingId | CONTEXT_ID | KSESSION_ID | OPTLOCK | OWNER_ID |
+-----------+------------+-------------+---------+----------+
|         1 | 1          |           2 |       0 | NULL     |
+-----------+------------+-------------+---------+----------+

Get SessionNotFoundException when calling RuntimeEngine.getKieSession()

2015-06-22 09:56:25,738 ERROR [http-8080-7]
org.kie.internal.runtime.manager.SessionNotFoundException: No session found for context 1
       at org.jbpm.runtime.manager.impl.PerProcessInstanceRuntimeManager$PerProcessInstanceInitializer.initKieSession(PerProcessInstanceRuntimeManager.java:442)
       at org.jbpm.runtime.manager.impl.RuntimeEngineImpl.getKieSession(RuntimeEngineImpl.java:70)

Expected results:

A user run the update script after the step 2. Now OWNER_ID (and other columns) are populated.

RuntimeEngine.getKieSession() doesn't throw an Exception.
Comment 1 Toshiya Kobayashi 2015-06-23 22:43:30 EDT
Created attachment 1042585 [details]
BZ1235091_reproducer.zip

Attached BZ1235091_reproducer.zip. See README.txt in the zip.
Comment 2 Kris Verlaenen 2015-06-24 15:27:29 EDT
Ryan, could you add these migration scripts we have in the installer in the community to the supplementary tools?
Comment 4 Ryan Zhang 2015-09-09 00:48:34 EDT
Ok, will do it in ER3.
Comment 5 Alessandro Lazarotti 2015-10-05 18:11:03 EDT
We need it properly documented in Migration Guide.
Comment 6 Alessandro Lazarotti 2015-10-08 22:55:16 EDT
Important: As we did not offer this to product 6.0 to 6.1, we need to offer a script that can migrate customers using 6.1 but also for those using 6.0, to 6.2.
Comment 9 Alessandro Lazarotti 2015-10-14 21:56:12 EDT
See that such scripts needs to have the name changed.
They are two scripts mentioning migration from 6.0 to 6.1 and 6.1 to 6.2, while in fact the product 6.1 is == community 6.2, so this naming can confuse customers. I am not sure if there is a 6.2 to 6.3 in community at this point but we need to align the named versions with product versions. Maybe adding as bame bpms61-to-bpms62 as example.
Comment 10 Alessandro Lazarotti 2015-10-19 09:29:27 EDT
And sure, the scripts must support migration from product 6.1 to 6.2 and migration from 6.0 to 6.2.
Comment 13 Ryan Zhang 2015-10-20 05:48:26 EDT
I have added the following into supplementary-tools:
jboss-brms-bpmsuite-6.2-supplementary-tools/
upgrade-scripts/
├── db2
│   ├── bpmsuite-6.0-to-6.1.sql
│   └── bpmsuite-6.1-to-6.2.sql
├── h2
│   ├── bpmsuite-6.0-to-6.1.sql
│   └── bpmsuite-6.1-to-6.2.sql
├── mysql5
│   ├── bpmsuite-6.0-to-6.1.sql
│   └── bpmsuite-6.1-to-6.2.sql
├── oracle
│   ├── bpmsuite-6.0-to-6.1.sql
│   └── bpmsuite-6.1-to-6.2.sql
├── postgresql
│   ├── bpmsuite-6.0-to-6.1.sql
│   └── bpmsuite-6.1-to-6.2.sql
├── sqlserver
│   ├── bpmsuite-6.0-to-6.1.sql
│   └── bpmsuite-6.1-to-6.2.sql
└── sybase
    ├── bpmsuite-6.0-to-6.1.sql
    └── bpmsuite-6.1-to-6.2.sql

Is there anything missing?
Comment 17 Kris Verlaenen 2015-10-22 11:44:53 EDT
Added bpms-* upgrade scripts as well:
master: http://github.com/droolsjbpm/jbpm/commit/137a5f946
6.3.x: http://github.com/droolsjbpm/jbpm/commit/54a751ed9

@Ryan, please pick up these (instead of the rename you suggested before).
Comment 18 Ryan Zhang 2015-10-23 05:13:57 EDT
(In reply to Kris Verlaenen from comment #17)
> Added bpms-* upgrade scripts as well:
> master: http://github.com/droolsjbpm/jbpm/commit/137a5f946
> 6.3.x: http://github.com/droolsjbpm/jbpm/commit/54a751ed9
> 
> @Ryan, please pick up these (instead of the rename you suggested before).

I see and will do. Thanks Kris!
Comment 21 Ryan Zhang 2015-11-03 03:10:42 EST
I believe all related issues have been fixed. 
Mark this as MODIFIED.
Comment 22 Tibor Zimanyi 2015-11-12 11:24:21 EST
Found some issues with this: 

- In supplementary tools there should be bundled also scripts for mysql with innodb. There is a separate folder with these scripts in jbpm-installer module alongside normal mysql5 scripts (named mysqlinnodb).
- There was a mistake in sqlserver scripts. See issue here [1]. I made a PR for this - link in mentioned issue. 
- In DB2 scripts, SessionInfo id column datatype was not properly updated when there were no sessions stored in SessionInfo table. See issue here [2]. After discussion with @fspolti, I made a PR also for this - link in mentioned issue. 

Other scripts passed fine.  

[1] https://issues.jboss.org/browse/JBPM-4825
[2] https://issues.jboss.org/browse/JBPM-4826
Comment 23 Alessandro Lazarotti 2015-11-12 13:50:55 EST
Tibor, are there BZs opened about the issues above ?
Comment 24 Tibor Zimanyi 2015-11-13 02:37:29 EST
- The SessionInfo id BZ is here [1].
- The InnoDB thing is now not tracked in BZ and the SQLServer scripts thing is tracked only in JIRA [2] for now, because I think these issues are related to this BZ (newly created productized scripts and packaging them to supplementary tools). But if it is needed to track them separately, I will create the tickets. Please, let me know.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1272120
[2] https://issues.jboss.org/browse/JBPM-4825
Comment 26 Kris Verlaenen 2015-11-13 10:54:45 EST
Both pull requests related to the second and third issue mentioned in comment 22 were merged to 6.3.x:
https://github.com/droolsjbpm/jbpm/commit/751359c9bbca1b49e850723b9f527b8cd220f7d6
https://github.com/droolsjbpm/jbpm/commit/b29c4fd348b33821623930c4631db8d282ba8e35

Keeping it assigned to Ryan for the mysql innodb fix.
Comment 27 Ryan Zhang 2015-11-17 21:47:34 EST
(In reply to Kris Verlaenen from comment #26)
> Both pull requests related to the second and third issue mentioned in
> comment 22 were merged to 6.3.x:
> https://github.com/droolsjbpm/jbpm/commit/
> 751359c9bbca1b49e850723b9f527b8cd220f7d6
> https://github.com/droolsjbpm/jbpm/commit/
> b29c4fd348b33821623930c4631db8d282ba8e35
> 
> Keeping it assigned to Ryan for the mysql innodb fix.

OK, I have added mysql innodb into the supplementary tools.

@Tibo, However, I can't find the dashbuilder sql for mysql innodb.

Shoud we assign this to dashbuilder owner to add the mysql innodb?

Let me mark this as MODIFIED for test on CR1 first.
Comment 30 Tibor Zimanyi 2015-11-19 10:40:35 EST
Retested the scripts, the fixes I mentioned in previous comments are resolved, everything passed except one problem I found. See JIRA here [1]. 

I made PRs for this: 

Master: https://github.com/droolsjbpm/jbpm/pull/343
6.3.x: https://github.com/droolsjbpm/jbpm/pull/344

When this is merged into scripts, I think we are fine with this issue and I can verify it. 

[1] https://issues.jboss.org/browse/JBPM-4843
Comment 31 Lukáš Petrovický 2015-11-20 05:58:38 EST
Petr, see comment 30 - this needs to be documented in the release notes.
Comment 32 Tibor Zimanyi 2015-11-23 02:39:13 EST
Setting this to MODIFIED, because semicolon issue is not a blocker and can be merged into later versions. 

I created new BZ, so we have this tracked separately [1].

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1284367
Comment 33 Tibor Zimanyi 2015-11-24 05:00:34 EST
So no other issues found. I'm verifying this.
Comment 34 Petr Penicka 2015-12-07 17:45:39 EST
Created JIRA for the release note: https://issues.jboss.org/browse/BXMSDOC-105

Note You need to log in before you can comment on or make changes to this bug.