Skip to content

Commit

Permalink
disable cache for oracle sequences (#446)
Browse files Browse the repository at this point in the history
* disable cache for oracle sequences

* another fix to oracle scripts

* update changelog [ci-skip]

* initialize seq

* drop and recreate nflow_workflow_action_id_seq

* Tune Oracle SQL scripts

* Tune oracle update script still more

* Update CHANGELOG.md

Co-authored-by: Esa Puttonen <[email protected]>
  • Loading branch information
efonsell and eputtone authored Mar 31, 2021
1 parent 03e53a3 commit 67e2290
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- Sortable workflow definitions, workflow instance search result and executors tables
- Persist workflow instance query parameters to URL
- Support wildcard characters when searching workflow instances by business key or external id
- Database scripts
- Fix issues in Oracle scripts

**Details**
- `nflow-jetty`
Expand All @@ -20,6 +22,10 @@
- y18n 4.0.1
- `nflow-engine`
- Support SQL wildcards in workflow instance queries by business key or external id
- Database scripts
- Disable cache for Oracle sequences
- Fix `nflow_workflow_action_insert` trigger in Oracle database scripts
- Fix syntax error in `create table nflow_workflow` statement in `oracle.create.ddl.sql`

## 7.2.4 (2021-02-25)

Expand Down
10 changes: 5 additions & 5 deletions nflow-engine/src/main/resources/scripts/db/oracle.create.ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ create table nflow_workflow (
id int not null primary key,
status varchar(32) not null,
type varchar(64) not null,
priority smallint not null default 0,
priority smallint default 0 not null,
parent_workflow_id int default null,
parent_action_id int default null,
business_key varchar(64),
Expand All @@ -31,7 +31,7 @@ create index nflow_workflow_polling on nflow_workflow(next_activation, status, e
create index idx_workflow_parent on nflow_workflow(parent_workflow_id)
/

create sequence nflow_workflow_id_seq
create sequence nflow_workflow_id_seq nocache
/

create or replace trigger nflow_workflow_insert
Expand Down Expand Up @@ -70,15 +70,15 @@ create table nflow_workflow_action (
create index nflow_workflow_action_workflow on nflow_workflow_action(workflow_id)
/

create sequence nflow_workflow_action_id_seq
create sequence nflow_workflow_action_id_seq nocache
/

create or replace trigger nflow_workflow_action_insert
before insert on nflow_workflow_action
for each row
declare
begin
:new.id := nflow_workflow_id_seq.nextval;
:new.id := nflow_workflow_action_id_seq.nextval;
end;
/

Expand All @@ -104,7 +104,7 @@ create table nflow_executor (
)
/

create sequence nflow_executor_id_seq
create sequence nflow_executor_id_seq nocache
/

create or replace trigger nflow_executor_insert
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
alter sequence nflow_executor_id_seq nocache
/

alter sequence nflow_workflow_id_seq nocache
/

drop sequence nflow_workflow_action_id_seq
/

declare
id_with_slack number;
begin
select nvl(max(id),0) + 1000 into id_with_slack from nflow_workflow_action;
execute immediate 'create sequence nflow_workflow_action_id_seq start with ' || id_with_slack || ' nocache';
end;
/

create or replace trigger nflow_workflow_action_insert
before insert on nflow_workflow_action
for each row
declare
begin
:new.id := nflow_workflow_action_id_seq.nextval;
end;
/

0 comments on commit 67e2290

Please sign in to comment.