You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible to get rows with duplicate values in columns with a unique constraint.
Sample database backup is in fb-dupl-uniq.fbk.gz
Notice the unique constraint on test(obj_id, prj_id) and the procedure add_obj_to_prj which inserts records in TEST ignoring constraint violation. That procedure is invoked by an after update/insert trigger of table OBJ.
To trigger the problem, run the following shell command:
(triggers updates in 5000 rows, in random order, in 6 parallel processes)
for j in $(seq 1 6); do ( ( for i in $(seq 1 5000); do echo $i; done | shuf | while read i; do printf "update obj set data='Object %d' where id='911%07d';\n commit;\n" $i $i; done ) | isql-fb localhost:/var/lib/firebird/3.0/data/test.fdb ) &; done
there may be some update conflicts, but that's irrelevant -- I see the problem even when there are no update conflicts.
The above may need to be run several times, or the process count to be increased to surpass the number of CPU cores.
Execute the following SQL to see if the problem is there:
select obj_id, prj_id, count(*) from test
group by 1,2
having count(*) > 1;
Test Details: Sent letter to dimitr, 16.01.2018 09:24, wait for reply. => Can not add such test to fpt-repo because it can be reproduced under heavy load and races only
Submitted by: Damyan Ivanov (dam)
Attachments:
fb-dupl-uniq.fbk.gz
It is possible to get rows with duplicate values in columns with a unique constraint.
Sample database backup is in fb-dupl-uniq.fbk.gz
Notice the unique constraint on test(obj_id, prj_id) and the procedure add_obj_to_prj which inserts records in TEST ignoring constraint violation. That procedure is invoked by an after update/insert trigger of table OBJ.
To trigger the problem, run the following shell command:
(triggers updates in 5000 rows, in random order, in 6 parallel processes)
for j in$(seq 1 6); do ( ( for i in $ (seq 1 5000); do echo $i; done | shuf | while read i; do printf "update obj set data='Object %d' where id='911%07d';\n commit;\n" $i $i; done ) | isql-fb localhost:/var/lib/firebird/3.0/data/test.fdb ) &; done
there may be some update conflicts, but that's irrelevant -- I see the problem even when there are no update conflicts.
The above may need to be run several times, or the process count to be increased to surpass the number of CPU cores.
Execute the following SQL to see if the problem is there:
select obj_id, prj_id, count(*) from test
group by 1,2
having count(*) > 1;
Commits: 66d9f43 0166b87
====== Test Details ======
Can not add such test to fpt-repo because it can be reproduced under heavy load and races only
The text was updated successfully, but these errors were encountered: