Skip to content

Commit

Permalink
Raise create work flow isolation back to Serializable (#348)
Browse files Browse the repository at this point in the history
## Description

After PR #346 merged, raise back isolation level from repeatable read to serializable.
Also add create unique index ddl to tinkerbell-init.sql.

## How Has This Been Tested?

- Manually

## How are existing users impacted? What migration steps/scripts do we need?

- No

## Checklist:

I have:

- [ ] updated the documentation and/or roadmap (if required)
- [ ] added unit or e2e tests
- [ ] provided instructions on how to upgrade
  • Loading branch information
mergify[bot] authored Oct 26, 2020
2 parents 3b230d5 + 084b6cc commit 2683ed2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion db/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var (

// CreateWorkflow creates a new workflow
func (d TinkDB) CreateWorkflow(ctx context.Context, wf Workflow, data string, id uuid.UUID) error {
tx, err := d.instance.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelRepeatableRead})
tx, err := d.instance.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable})
if err != nil {
return errors.Wrap(err, "BEGIN transaction")
}
Expand Down
2 changes: 2 additions & 0 deletions deploy/db/tinkerbell-init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ CREATE TABLE IF NOT EXISTS workflow_worker_map (
, worker_id UUID NOT NULL
);

CREATE UNIQUE INDEX IF NOT EXISTS uidx_workflow_worker_map ON workflow_worker_map (workflow_id, worker_id);

CREATE TABLE IF NOT EXISTS workflow_data (
workflow_id UUID NOT NULL
, version INT
Expand Down

0 comments on commit 2683ed2

Please sign in to comment.