Bug 1235091 - Add database upgrade scripts to BPMS distribution
Summary: Add database upgrade scripts to BPMS distribution
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: Migration Tool
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: CR1
: 6.2.0
Assignee: Ryan Zhang
QA Contact: Tibor Zimanyi
URL:
Whiteboard:
Depends On:
Blocks: 1260377 1272120 1273622 1276039
TreeView+ depends on / blocked
 
Reported: 2015-06-24 01:04 UTC by Toshiya Kobayashi
Modified: 2020-03-27 20:12 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
: 1273622 (view as bug list)
Environment:
Last Closed: 2020-03-27 20:12:58 UTC
Type: Enhancement
Embargoed:


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

Description Toshiya Kobayashi 2015-06-24 01:04:02 UTC
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-24 02:43:30 UTC
Created attachment 1042585 [details]
BZ1235091_reproducer.zip

Attached BZ1235091_reproducer.zip. See README.txt in the zip.

Comment 2 Kris Verlaenen 2015-06-24 19:27:29 UTC
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 04:48:34 UTC
Ok, will do it in ER3.

Comment 5 Alessandro Lazarotti 2015-10-05 22:11:03 UTC
We need it properly documented in Migration Guide.

Comment 6 Alessandro Lazarotti 2015-10-09 02:55:16 UTC
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-15 01:56:12 UTC
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 13:29:27 UTC
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 09:48:26 UTC
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 15:44:53 UTC
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 09:13:57 UTC
(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 08:10:42 UTC
I believe all related issues have been fixed. 
Mark this as MODIFIED.

Comment 22 Tibor Zimanyi 2015-11-12 16:24:21 UTC
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 18:50:55 UTC
Tibor, are there BZs opened about the issues above ?

Comment 24 Tibor Zimanyi 2015-11-13 07:37:29 UTC
- 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 15:54:45 UTC
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-18 02:47:34 UTC
(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 15:40:35 UTC
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 10:58:38 UTC
Petr, see comment 30 - this needs to be documented in the release notes.

Comment 32 Tibor Zimanyi 2015-11-23 07:39:13 UTC
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 10:00:34 UTC
So no other issues found. I'm verifying this.

Comment 34 Petr Penicka 2015-12-07 22:45:39 UTC
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.