Fix inconsistent code with shared invalidations of snapshots
authorMichael Paquier
Mon, 28 Dec 2020 13:17:02 +0000 (22:17 +0900)
committerMichael Paquier
Mon, 28 Dec 2020 13:17:02 +0000 (22:17 +0900)
The code in charge of processing a single invalidation message has been
using since 568d413 the structure for relation mapping messages.  This
had fortunately no consequence as both locate the database ID at the
same location, but it could become a problem in the future if this area
of the code changes.

Author: Konstantin Knizhnik
Discussion: https://postgr.es/m/8044c223-4d3a-2cdb-42bf-29940840ce94@postgrespro.ru
Backpatch-through: 9.5

src/backend/utils/cache/inval.c

index f09e3a9affa0df824bb0d5e87aaa3c051dde4459..3ccf7ccb2ae04128f132f2d00269b6d52ce5e433 100644 (file)
@@ -619,9 +619,9 @@ LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
    else if (msg->id == SHAREDINVALSNAPSHOT_ID)
    {
        /* We only care about our own database and shared catalogs */
-       if (msg->rm.dbId == InvalidOid)
+       if (msg->sn.dbId == InvalidOid)
            InvalidateCatalogSnapshot();
-       else if (msg->rm.dbId == MyDatabaseId)
+       else if (msg->sn.dbId == MyDatabaseId)
            InvalidateCatalogSnapshot();
    }
    else