Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't reference to key fields of active record in master table when they are not changed in WAIT transaction [CORE2604] #3014

Open
firebird-automations opened this issue Aug 28, 2009 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Petr Savelyev (petr.savelyev)

Is related to CORE1606

Votes: 2

Improvement foreign key handling is broken for WAIT transactions.

create table master (id int not null primary key, f varchar(20));

create table child (id int not null primary key, master_id int not null references master);
insert into master values(1, '1');

First connect:
update master set f = '111' where id = 1;

Second connect:
set transaction read write wait;
insert into child values (1, 1);

Now second connect waits for commit/rollback of first transaction instead of insert record immediately. In NO WAIT transactions insert works correct.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Petr,

there is no column "f" in the master table, so this statement is not valid:

update master set *f* = '111' where id = 1;

Are you sure that the case details are valid?

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

I can confirm the issue.

The reason is that engine first check for state of concurrent transaction (update master ...) and used WAIT mode of current transaction while waiting for concurrent transaction lock. Therefore WAIT transaction will never see record, changed by still active concurrent transaction.

The check for PK\UK values of master record (implemented by FK handling improvement) occurs after.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

Link: This issue is related to CORE1606 [ CORE1606 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

priority: Major [ 3 ] => Minor [ 4 ]

issuetype: Bug [ 1 ] => Improvement [ 4 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Joseba Nevado (j.nevado_speexx.com)

Hi, this is still an ongoing issue in FB3, any chance this can be fixed?
If the second transaction has a isc_tpb_lock_timeout configured, the second statement will wait the specified timeout seconds, and then complete successfully, instead of completing immediately. Of course, if the first transaction finishes earlier then the second transaction will then complete immediately after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants