On Thu, Jun 17, 2021 at 6:50 PM Mark Dilger <mark.dil...@enterprisedb.com> wrote: > > > On Jun 17, 2021, at 3:39 AM, osumi.takami...@fujitsu.com wrote: > > > > For the 1st check, isn't it better to use RelationIsValid() ? > > Yes, you are right. > > > Additionally, In what kind of actual scenario, did you think that > > we come to the part to "log a complaint" ? > > The way that RelationGetIndexList assigns rd_replidindex to the Relation > seems to lack sufficient locking. After scanning pg_index to find indexes > associated with the relation, pg_index is closed and the access share lock > released. I couldn't prove to myself that by the time we use the > rd_replidindex field thus computed that it was safe to assume that the Oid > stored there still refers to an index. The most likely problem would be that > the index has since been dropped in a concurrent transaction, but it also > seems just barely possible that the Oid has been reused and refers to > something else, a table perhaps. >
I think such a problem won't happen because we are using historic snapshots in this context. We rely on that in a similar way in reorderbuffer.c, see ReorderBufferProcessTXN. -- With Regards, Amit Kapila.