Skip to content

Commit fefe8c1

Browse files
committed
Fix alignment incompatibility between 32-bit and 64-bit builds. Partially sync with the tablespace branch to simplify merging the code later.
1 parent 428dd18 commit fefe8c1

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/jrd/ods.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,21 @@ struct index_root_page
365365
{
366366
pag irt_header;
367367
USHORT irt_relation; // relation id (for consistency)
368-
USHORT irt_count; // Number of indices
368+
USHORT irt_count; // number of indices
369+
ULONG irt_unused; // so far used as a padding to ensure the same
370+
// alignment between 32-bit and 64-bit builds
369371
struct irt_repeat
370372
{
371373
friend class index_root_page; // to allow offset check for private members
372374
private:
373375
union
374376
{
375377
FB_UINT64 irt_transaction; // transaction in progress
376-
ULONG irt_root; // page number of index root
378+
struct
379+
{
380+
ULONG irt_page_num; // page number
381+
ULONG irt_page_space_id; // page space
382+
} irt_root; // index root page
377383
};
378384
public:
379385
USHORT irt_desc; // offset to key descriptions
@@ -429,13 +435,13 @@ inline constexpr USHORT irt_condition = 64;
429435

430436
inline bool index_root_page::irt_repeat::isUsed() const
431437
{
432-
return (irt_flags & irt_in_progress) || (irt_root != 0);
438+
return (irt_flags & irt_in_progress) || (irt_root.irt_page_num != 0);
433439
}
434440

435441
inline void index_root_page::irt_repeat::setEmpty()
436442
{
437443
irt_transaction = 0;
438-
fb_assert(irt_root == 0);
444+
fb_assert(irt_root.irt_page_num == 0 && irt_root.irt_page_space_id == 0);
439445
irt_flags = 0;
440446
}
441447

@@ -452,12 +458,13 @@ inline void index_root_page::irt_repeat::setInProgress(TraNumber traNumber)
452458

453459
inline ULONG index_root_page::irt_repeat::getRoot() const
454460
{
455-
return (irt_flags & irt_in_progress) ? 0 : irt_root;
461+
return (irt_flags & irt_in_progress) ? 0 : irt_root.irt_page_num;
456462
}
457463

458464
inline void index_root_page::irt_repeat::setRoot(ULONG rootPage)
459465
{
460-
irt_root = rootPage;
466+
irt_root.irt_page_num = rootPage;
467+
irt_root.irt_page_space_id = 0;
461468
irt_flags &= ~irt_in_progress;
462469
}
463470

0 commit comments

Comments
 (0)