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

GDSCODE can have value = 0 in WHEN-section under some concurrent env., only in SC or CS (not in SS) [CORE4565] #4882

Closed
firebird-automations opened this issue Sep 30, 2014 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Sample of code:

create or alter procedure sp_handle_rows (
a_doc_id bigint,
a_old_optype bigint)
as
declare v_gdscode int;
declare v_dd_id bigint;
declare v_this varchar(80) = 'sp_handle_rows';
begin

for
    select <http://d.id>
    from doc\_data d
    where d\.doc\_id = :a\_doc\_id
    into v\_dd\_id
do
begin
    delete from qdistr q
    where
        q\.snd\_optype\_id = :a\_old\_optype
        and q\.rcv\_optype\_id in \( 1200, 3300 \)
        and q\.snd\_id = :v\_dd\_id;
end

when any do
begin
v_gdscode = gdscode;
if ( v_gdscode not in( 335544336, 335544878 ) ) then
begin
in autonomous transaction do
insert into perf_log(
unit,
fb_gdscode)
values(
:v_this,
:v_gdscode);
end

    exception;

end

end

Here it might be that in WHEN ANY section value of `gdscode` variable can be 0 (ZERO) rather than one that reflects lock-conflict.
This occurs only in SuperCLASSIC (and only in 3.x) and never in SuperServer.
Two or more concurrent attaches must work at the same data of table QDistr. After some time record in log table ('PERF_LOG') will appear with fb_gdscode = 0.

I've sent full test to Vlad, got from him instruction where to update source and hope that this will work OK (currently testing it; final report will be later).

PS. Many thanks to Vlad. This was headache during last two monthes.

Commits: 312a1e4 8216554 8718301 FirebirdSQL/fbt-repository@441e7fa FirebirdSQL/fbt-repository@53da427

====== Test Details ======

Letters to / from Vlad: 29-sep-2014. As he said, this bug could be reproduced in the single attachment, w/o concurrent attachments. Hope that such test will be implemented.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 1 [ 10332 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Deferred

Test Details: Letters to / from Vlad: 29-sep-2014. As he said, this bug could be reproduced in the single attachment, w/o concurrent attachments. Hope that such test will be implemented.

Test Specifics: [Architecture (SS/CS) specific]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Patch is backported into B2_5_Release

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

Fix Version: 2.5.9 [ 10862 ]

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