Skip to content

fix: OffsetNotAligned on second insert into fixed-size table#81

Merged
veeso merged 2 commits intomainfrom
fix/80-offset-not-aligned-on-second-insert-into-table
Apr 5, 2026
Merged

fix: OffsetNotAligned on second insert into fixed-size table#81
veeso merged 2 commits intomainfrom
fix/80-offset-not-aligned-on-second-insert-into-table

Conversation

@veeso
Copy link
Copy Markdown
Owner

@veeso veeso commented Apr 5, 2026

Summary

  • Fix OffsetNotAligned error when inserting a second record into tables with all fixed-size columns (e.g. Uint64 + Uint64 + 1-byte CustomDataType)
  • Root cause: table_registry::insert aligned write offset using E::ALIGNMENT instead of RawRecord<E>::ALIGNMENT, and page_ledger::commit double-wrapped the type computing RawRecord<RawRecord<E>>::ALIGNMENT instead of RawRecord<E>::ALIGNMENT
  • Add regression test with a 17-byte fixed-size record inserting 10 rows

Closes #80

Test plan

  • Regression test test_should_insert_multiple_fixed_size_records passes
  • All existing unit tests pass (just test)
  • Clippy clean (just clippy)

🤖 Generated with Claude Code

veeso added 2 commits April 5, 2026 20:59
The second insert into a table with all fixed-size columns (e.g. Uint64 +
Uint64 + 1-byte CustomDataType) failed with OffsetNotAligned because:

1. table_registry::insert aligned the write offset using E::ALIGNMENT
   instead of RawRecord<E>::ALIGNMENT (which includes the 2-byte header).
2. page_ledger::commit double-wrapped the type in RawRecord, computing
   RawRecord<RawRecord<E>>::ALIGNMENT instead of RawRecord<E>::ALIGNMENT,
   causing incorrect free-space tracking.

Closes #80
@cocogitto-bot
Copy link
Copy Markdown

cocogitto-bot bot commented Apr 5, 2026

✔️ 5179c7d...e5b8710 - Conventional commits check succeeded.

@veeso veeso merged commit 011a7cc into main Apr 5, 2026
4 checks passed
@veeso veeso deleted the fix/80-offset-not-aligned-on-second-insert-into-table branch April 5, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OffsetNotAligned on second insert into table with Uint64 + 1-byte CustomDataType + Uint64 layout

1 participant