| 1 |
# An inplace update had been able to abort before sending the inplace |
| 2 |
# invalidation message to the shared queue. If a heap_update() caller then |
| 3 |
# retrieved its oldtup from a cache, the heap_update() could revert the |
| 4 |
# inplace update. |
| 5 |
|
| 6 |
setup |
| 7 |
{ |
| 8 |
CREATE TABLE newly_indexed (c int); |
| 9 |
} |
| 10 |
|
| 11 |
teardown |
| 12 |
{ |
| 13 |
DROP TABLE newly_indexed; |
| 14 |
} |
| 15 |
|
| 16 |
session s1 |
| 17 |
step cir1 { BEGIN; CREATE INDEX i1 ON newly_indexed (c); ROLLBACK; } |
| 18 |
step read1 { |
| 19 |
SELECT relhasindex FROM pg_class WHERE oid = 'newly_indexed'::regclass; |
| 20 |
} |
| 21 |
|
| 22 |
session s2 |
| 23 |
step cic2 { CREATE INDEX i2 ON newly_indexed (c); } |
| 24 |
|
| 25 |
session s3 |
| 26 |
step cachefill3 { TABLE newly_indexed; } |
| 27 |
step ddl3 { ALTER TABLE newly_indexed ADD extra int; } |
| 28 |
|
| 29 |
|
| 30 |
permutation |
| 31 |
cachefill3 # populates the pg_class row in the catcache |
| 32 |
cir1 # sets relhasindex=true; rollback discards cache inval |
| 33 |
cic2 # sees relhasindex=true, skips changing it (so no inval) |
| 34 |
ddl3 # cached row as the oldtup of an update, losing relhasindex |
| 35 |
read1 # observe damage |
| 36 |
|
| 37 |
# without cachefill3, no bug |
| 38 |
permutation cir1 cic2 ddl3 read1 |