Skip to content

Commit 0222be1

Browse files
committed
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 05d4cbf. Discussion: http://postgr.es/m/3825454.1664310917@sss.pgh.pa.us
1 parent d0b1dbc commit 0222be1

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/backend/utils/cache/inval.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,9 @@ LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
663663
*/
664664
RelFileLocatorBackend rlocator;
665665

666-
rlocator.locator = msg->sm.rlocator;
666+
rlocator.locator.dbOid = msg->sm.dbOid;
667+
rlocator.locator.spcOid = msg->sm.spcOid;
668+
rlocator.locator.relNumber = (((uint64) msg->sm.relNumber_hi) << 32) | msg->sm.relNumber_lo;
667669
rlocator.backend = (msg->sm.backend_hi << 16) | (int) msg->sm.backend_lo;
668670
smgrcloserellocator(rlocator);
669671
}
@@ -1466,7 +1468,10 @@ CacheInvalidateSmgr(RelFileLocatorBackend rlocator)
14661468
msg.sm.id = SHAREDINVALSMGR_ID;
14671469
msg.sm.backend_hi = rlocator.backend >> 16;
14681470
msg.sm.backend_lo = rlocator.backend & 0xffff;
1469-
msg.sm.rlocator = rlocator.locator;
1471+
msg.sm.dbOid = rlocator.locator.dbOid;
1472+
msg.sm.spcOid = rlocator.locator.spcOid;
1473+
msg.sm.relNumber_hi = rlocator.locator.relNumber >> 32;
1474+
msg.sm.relNumber_lo = rlocator.locator.relNumber & 0xffffffff;
14701475
/* check AddCatcacheInvalidationMessage() for an explanation */
14711476
VALGRIND_MAKE_MEM_DEFINED(&msg, sizeof(msg));
14721477

src/include/storage/sinval.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,14 @@ typedef struct
8686

8787
typedef struct
8888
{
89-
/* note: field layout chosen to pack into 16 bytes */
89+
/* note: field layout chosen to pack into 20 bytes */
9090
int8 id; /* type field --- must be first */
9191
int8 backend_hi; /* high bits of backend ID, if temprel */
9292
uint16 backend_lo; /* low bits of backend ID, if temprel */
93-
RelFileLocator rlocator; /* spcOid, dbOid, relNumber */
93+
Oid dbOid;
94+
Oid spcOid;
95+
uint32 relNumber_hi; /* avoid 8 byte alignment requirement */
96+
uint32 relNumber_lo;
9497
} SharedInvalSmgrMsg;
9598

9699
#define SHAREDINVALRELMAP_ID (-4)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy