summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas2022-09-28 11:51:48 +0000
committerRobert Haas2022-09-28 11:58:09 +0000
commit0222be137188ac3912d244d832a328be0944f3e9 (patch)
tree38d3f8d05df2aa37f55ce4d0bf0fdc6a7b442632
parentd0b1dbcb98454a353919d789c71c6d9a89e961eb (diff)
Fix alignment problems with SharedInvalSmgrMsg.
SharedInvalSmgrMsg can't require 8-byte alignment, because then SharedInvalidationMessage will require 8-byte alignment, which will then cause ParseCommitRecord to fail on machines that are picky about alignment, because it assumes that everything that gets packed into a commit record requires only 4-byte alignment. Another problem with 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c. Discussion: http://postgr.es/m/[email protected]
-rw-r--r--src/backend/utils/cache/inval.c9
-rw-r--r--src/include/storage/sinval.h7
2 files changed, 12 insertions, 4 deletions
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index eb5782f82a4..fecbf06a04d 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -663,7 +663,9 @@ LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
*/
RelFileLocatorBackend rlocator;
- rlocator.locator = msg->sm.rlocator;
+ rlocator.locator.dbOid = msg->sm.dbOid;
+ rlocator.locator.spcOid = msg->sm.spcOid;
+ rlocator.locator.relNumber = (((uint64) msg->sm.relNumber_hi) << 32) | msg->sm.relNumber_lo;
rlocator.backend = (msg->sm.backend_hi << 16) | (int) msg->sm.backend_lo;
smgrcloserellocator(rlocator);
}
@@ -1466,7 +1468,10 @@ CacheInvalidateSmgr(RelFileLocatorBackend rlocator)
msg.sm.id = SHAREDINVALSMGR_ID;
msg.sm.backend_hi = rlocator.backend >> 16;
msg.sm.backend_lo = rlocator.backend & 0xffff;
- msg.sm.rlocator = rlocator.locator;
+ msg.sm.dbOid = rlocator.locator.dbOid;
+ msg.sm.spcOid = rlocator.locator.spcOid;
+ msg.sm.relNumber_hi = rlocator.locator.relNumber >> 32;
+ msg.sm.relNumber_lo = rlocator.locator.relNumber & 0xffffffff;
/* check AddCatcacheInvalidationMessage() for an explanation */
VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h
index aca0347a3d3..4a267be935c 100644
--- a/src/include/storage/sinval.h
+++ b/src/include/storage/sinval.h
@@ -86,11 +86,14 @@ typedef struct
typedef struct
{
- /* note: field layout chosen to pack into 16 bytes */
+ /* note: field layout chosen to pack into 20 bytes */
int8 id; /* type field --- must be first */
int8 backend_hi; /* high bits of backend ID, if temprel */
uint16 backend_lo; /* low bits of backend ID, if temprel */
- RelFileLocator rlocator; /* spcOid, dbOid, relNumber */
+ Oid dbOid;
+ Oid spcOid;
+ uint32 relNumber_hi; /* avoid 8 byte alignment requirement */
+ uint32 relNumber_lo;
} SharedInvalSmgrMsg;
#define SHAREDINVALRELMAP_ID (-4)