Skip to content

Commit 55efc6f

Browse files
committed
Make itemsize calculation same in writetup_rum and readtup_rum
It was incorrectly set different RumSortSize vs RumScanSize
1 parent d9963d9 commit 55efc6f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/rumsort.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,13 @@ copytup_rumitem(RumTuplesortstate * state, SortTuple *stup, void *tup)
203203
#define LogicalTapeReadExact_compat(state, LT_ARG, args...) LogicalTapeReadExact(state->tapeset, LT_ARG, ##args)
204204
#endif
205205

206+
#define ITEMSIZE(is_scanitem) is_scanitem ? sizeof(RumScanItem) : RumSortItemSize(state->nKeys);
207+
206208
static void
207209
writetup_rum_internal(RumTuplesortstate * state, LT_TYPE LT_ARG, SortTuple *stup, bool is_item)
208210
{
209-
RumSortItem *item = (RumSortItem *) stup->tuple;
210-
size_t size = is_item ? sizeof(*item) : RumSortItemSize(state->nKeys);
211+
void *item = stup->tuple;
212+
size_t size = ITEMSIZE(is_item);
211213
unsigned int writtenlen = size + sizeof(unsigned int);
212214

213215
LogicalTapeWrite(TAPE(state, LT_ARG),
@@ -239,7 +241,7 @@ readtup_rum_internal(RumTuplesortstate * state, SortTuple *stup,
239241
LT_TYPE LT_ARG, unsigned int len, bool is_item)
240242
{
241243
unsigned int tuplen = len - sizeof(unsigned int);
242-
size_t size = is_item ? sizeof(RumScanItem) : RumSortItemSize(state->nKeys);
244+
size_t size = ITEMSIZE(is_item);
243245
void *item = palloc(size);
244246

245247
Assert(tuplen == RumSortItemSize(state->nKeys));

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