futurewei-cloud / chogori-opengauss

Other
2 stars 7 forks source link

Investigate pggate foreign key implementation #46

Open jfunston opened 1 year ago

jfunston commented 1 year ago

Pggate has an interface for a foreign key cache (PgGate_ForeignKeyReferenceExists, etc). Currently this cache is implemented in a per session way. Depending on how pg uses this cache, it may be broken in a distributed setting. For example, connection A inserts and commits to table A (row gets inserted into foreign key cache), then connection B deletes and commits that row, then connection A inserts to table B with a foreign key constraint on table A. The cache may allow the last insert to succeed even if it should fail due to the foreign key constraint.