Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 342a1ff

Browse files
committed
Add some test coverage of EvalPlanQual with non-locked tables.
A Salesforce colleague of mine griped that the regression tests don't exercise EvalPlanQualFetchRowMarks() and allied routines. Which is a fair complaint. Add test cases that go through the REFERENCE and COPY code paths. Unfortunately we don't have sufficient infrastructure right now to exercise the FDW code path in the isolation tests, but this is surely better than before.
1 parent efe72a8 commit 342a1ff

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

src/test/isolation/expected/eval-plan-qual.out

+40
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,43 @@ a b c
104104
2 2 2
105105
2 3 0
106106
step c2: COMMIT;
107+
108+
starting permutation: wx2 partiallock c2 c1 read
109+
step wx2: UPDATE accounts SET balance = balance + 450 WHERE accountid = 'checking';
110+
step partiallock:
111+
SELECT * FROM accounts a1, accounts a2
112+
WHERE a1.accountid = a2.accountid
113+
FOR UPDATE OF a1;
114+
<waiting ...>
115+
step c2: COMMIT;
116+
step partiallock: <... completed>
117+
accountid balance accountid balance
118+
119+
checking 1050 checking 600
120+
savings 600 savings 600
121+
step c1: COMMIT;
122+
step read: SELECT * FROM accounts ORDER BY accountid;
123+
accountid balance
124+
125+
checking 1050
126+
savings 600
127+
128+
starting permutation: wx2 lockwithvalues c2 c1 read
129+
step wx2: UPDATE accounts SET balance = balance + 450 WHERE accountid = 'checking';
130+
step lockwithvalues:
131+
SELECT * FROM accounts a1, (values('checking'),('savings')) v(id)
132+
WHERE a1.accountid = v.id
133+
FOR UPDATE OF a1;
134+
<waiting ...>
135+
step c2: COMMIT;
136+
step lockwithvalues: <... completed>
137+
accountid balance id
138+
139+
checking 1050 checking
140+
savings 600 savings
141+
step c1: COMMIT;
142+
step read: SELECT * FROM accounts ORDER BY accountid;
143+
accountid balance
144+
145+
checking 1050
146+
savings 600

src/test/isolation/specs/eval-plan-qual.spec

+16
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ step "writep1" { UPDATE p SET b = -1 WHERE a = 1 AND b = 1 AND c = 0; }
5050
step "writep2" { UPDATE p SET b = -b WHERE a = 1 AND c = 0; }
5151
step "c1" { COMMIT; }
5252

53+
# these tests are meant to exercise EvalPlanQualFetchRowMarks,
54+
# ie, handling non-locked tables in an EvalPlanQual recheck
55+
56+
step "partiallock" {
57+
SELECT * FROM accounts a1, accounts a2
58+
WHERE a1.accountid = a2.accountid
59+
FOR UPDATE OF a1;
60+
}
61+
step "lockwithvalues" {
62+
SELECT * FROM accounts a1, (values('checking'),('savings')) v(id)
63+
WHERE a1.accountid = v.id
64+
FOR UPDATE OF a1;
65+
}
66+
5367
session "s2"
5468
setup { BEGIN ISOLATION LEVEL READ COMMITTED; }
5569
step "wx2" { UPDATE accounts SET balance = balance + 450 WHERE accountid = 'checking'; }
@@ -79,3 +93,5 @@ permutation "wy1" "wy2" "c1" "c2" "read"
7993
permutation "upsert1" "upsert2" "c1" "c2" "read"
8094
permutation "readp1" "writep1" "readp2" "c1" "c2"
8195
permutation "writep2" "returningp1" "c1" "c2"
96+
permutation "wx2" "partiallock" "c2" "c1" "read"
97+
permutation "wx2" "lockwithvalues" "c2" "c1" "read"

0 commit comments

Comments
 (0)