Project

General

Profile

Bug #10838

Unique index violation should be cured even at flush time

Added by Alexandru Lungu 8 months ago. Updated 8 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:

History

#1 Updated by Alexandru Lungu 8 months ago

Make a tbl persistent table with unique index of (f1, f2).

procedure make_data:
   for each tbl:
      delete tbl.
   end.
   create tbl.
   tbl.f1 = "d210".
   tbl.f2 = 1.
   release tbl.  // WRITE TRIGGER D210 1
   create tbl.
   tbl.f1 = "d210".
   tbl.f2 = 2. // WRITE TRIGGER D210 2
   release tbl.
end.

do transaction:
    define buffer buf for tbl.

    do transaction:
       run make_data.
    end.

    message "start".

    find first tbl where tbl.f2 = 1.
    tbl.f2 = -1. // 1 -> -1

    find first buf where buf.f2 = 2.
    buf.f2 = 1. // 2 -> 1

    message "pre-release".

    release buf. // WRITE TRIGGER D210 1

    message "post-release".
end.  // WRITE TRIGGER D210 -1
message "finish".

The issue is that after the last release, there are two records with value (d210, 1) on the unique index at the same time with their WRITE TRIGGER called. In OE, there is no error, but in FWD we attempt to INSERT a conflicting row in PG, resulting in a validation exception.

FWD has a "cure" mechanism in case the validation doesn't request flushing, so that we can have two records with the same value on the unique index as long as one of these two wasn't flushed (i.e. WRITE trigger called). However, this testcase should that curing should also happen if we really attempt to flush (with WRITE trigger).

See more explanations on #10296-19.

Also available in: Atom PDF