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
Config parameter 'DeadlockTimeout ': mystic affect of its PARITY / ODDNESS on DDL results [CORE5080] #5367
Comments
Commented by: @hvlad Run your script twice using the same value for DeadlockTimeout ... |
Commented by: @hvlad Add SET AUTODDL OFF at beginning of script and see what happens. |
Commented by: @pavel-zotov No matter whether DeadlockTimeout is odd or even, I get: C:\MIX\firebird\QA\fbt-repo\tmp>isql /:e30 -i c5080.sql RDB$GENERATOR_NAME G ISQL Version: WI-V3.0.0.32281 Firebird 3.0 Release Candidate 2 C:\MIX\firebird\QA\fbt-repo\tmp>isql /:e30 -i c5080.sql |
Commented by: @hvlad Observed behaviour: |
Commented by: @pavel-zotov > Add SET AUTODDL OFF at beginning of script and see what happens. No exceptions after adding this. This is the 1st time I can recall that adding set autoddl OFF can help to solving something rlated to DDL :-) |
Commented by: @pavel-zotov Vlad, can you please explain me:
|
Commented by: @hvlad In AUTODLL ON mode (which is default mode) ISQL handle DML and DDL statements in different transactions. All this you may see yourself using trace :) |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @pavel-zotov
Found for current snapshots of 2.5.6 and 3.0, all arch (SS/SC/CS).
Create this script:
set term ^;
execute block as
begin
execute statement 'drop sequence g';
when any do begin end
end
^
-- commit -------------------------- [ 1 ]
^
create sequence g
^
-- commit -------------------------- [ 2 ]
^
create or alter procedure sp_get_remote_data returns(received_value int) as
begin
for
execute statement ('execute block returns(curr_gen int) as begin curr_gen = gen_id(g,1); suspend; end')
on external rdb$get_context('SYSTEM','DB_NAME')
as user 'SYSDBA' password 'masterkey' role 'R_' || right( uuid_to_char(gen_uuid()),12 )
into received_value
do
suspend;
end
^
commit
^
set term ;^
set list on;
select g.*, gen_id(g,0) as gen_current_value
from rdb$generators g
where g.rdb$generator_name = upper('g');
Then open firebird.conf and set DeadlockTimeout to any ODD value (7,9,11,... - whatever, up to 32767).
Running this script will result (show for 2.5 only; on 3.0 we'll have more info but outcome is the same):
RDB$GENERATOR_NAME G
RDB$GENERATOR_ID 35
RDB$SYSTEM_FLAG 0
RDB$DESCRIPTION <null>
GEN_CURRENT_VALUE 0
Then change DeadlockTimeout to EVEN value (2,4,6, ...) and run script again (NOTE: restart of server can be skipped, its no matter here).
Result will be:
Statement failed, SQLSTATE = 40001
deadlock
-deadlock
-concurrent transaction number is 329
Statement failed, SQLSTATE = 42000
invalid request BLR at offset 75
-generator G is not defined
Also, not on lines marked as [ 1 ] and [ 2 ]. When comments from these COMMIT statements are removed, all work fine.
PS. Checked on:
WI-V2.5.6.26963
WI-V3.0.0.32281
The text was updated successfully, but these errors were encountered: