Skip to content

Refactor Run modules to use modern record extensions#830

Closed
mwihoti wants to merge 10 commits into
IntersectMBO:mainfrom
mwihoti:feature/811-modern-record-extensions
Closed

Refactor Run modules to use modern record extensions#830
mwihoti wants to merge 10 commits into
IntersectMBO:mainfrom
mwihoti:feature/811-modern-record-extensions

Conversation

@mwihoti
Copy link
Copy Markdown
Contributor

@mwihoti mwihoti commented Mar 25, 2026

Description

Following the successful pilot with Internal.Arena, this PR refactors the Run module and several related components to use the modern record language extensions.

changes

  • Record Modernization: Refactored the Run record fields to use shorter, prefix-free names (e.g., runIndex - index, runFilter - bloomFilter), which significantly improves the developer experience with dot notation.
  • Test Suite Cleanup: Extensively updated the StateMachine and Lookup test suites to use dot notation instead of traditional field accessors.

cabal build lsm-tree:lib:core -- Builds successfully
cabal test lsm-tree-test --pattern "Run" -- 129/129 tests pass
cabal test all -- Verified for compilation and linking

link
to the issue.

Checklist

  • Read our contribution guidelines at CONTRIBUTING.md, and make sure that this PR complies with the guidelines.

@mwihoti
Copy link
Copy Markdown
Contributor Author

mwihoti commented Mar 25, 2026

Hi @jorisdral , I just pushed an update for Run module with the new record language extensions, I'm moving next to Index

Copy link
Copy Markdown
Collaborator

@jorisdral jorisdral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the contribution, I like the new field names for the Run and RunReader module 😄.

Two high-level comments:

  • In modules where we refactor field names (Run/RunReader), we should enable DuplicateRecordFields, NoFieldSelectors, and OverloadedRecordDot. In other modules where we only want to use the .field syntax, it should be fine to only enable OverloadedRecordDot, so let's change that so that we only use the .field syntax on values of type Run and RunReader. That probably makes the diff of this PR also smaller
  • There are some residual parentheses here and there. In particular, we don't need parentheses around syntax like value.field

Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Run.hs Outdated
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Run.hs Outdated
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Run.hs Outdated
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Run.hs
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Run.hs Outdated
Comment thread lsm-tree/test/Test/Database/LSMTree/StateMachine.hs Outdated
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/MergeSchedule.hs Outdated
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Config/Override.hs Outdated
Comment thread lsm-tree/src/Database/LSMTree/Simple.hs Outdated
Comment thread lsm-tree/test/Database/LSMTree/Class.hs Outdated
@mwihoti
Copy link
Copy Markdown
Contributor Author

mwihoti commented Mar 26, 2026

Thanks, I will work on the changes

@mwihoti mwihoti force-pushed the feature/811-modern-record-extensions branch from 343017b to 5823d35 Compare April 3, 2026 06:01
@mwihoti
Copy link
Copy Markdown
Contributor Author

mwihoti commented Apr 3, 2026

Hi @jorisdral I've updated changes based on the feedback
image

@mwihoti
Copy link
Copy Markdown
Contributor Author

mwihoti commented Apr 15, 2026

Hello, @jorisdral I'would like to proceed next to index, could you check if what I've done aligns well

Copy link
Copy Markdown
Collaborator

@jorisdral jorisdral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwihoti thanks very much! I think the changes look good now. I have some remaining comments but they are only about formatting. Once those are resolved, we can merge this PR 😃

Comment thread lsm-tree/bench/macro/lsm-tree-bench-lookups.hs Outdated
Comment thread lsm-tree/bench/micro/Bench/Database/LSMTree/Internal/Lookup.hs Outdated
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Run.hs
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Run.hs Outdated
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/RunReader.hs Outdated
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Unsafe.hs Outdated
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Unsafe.hs Outdated
Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Unsafe.hs Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are redundant parentheses around record-dot syntax in this module

Comment thread lsm-tree/src-core/Database/LSMTree/Internal/Unsafe.hs Outdated
mwihoti added 7 commits May 6, 2026 18:37
  extension scope

  - Remove unnecessary parentheses around dot-access expressions (value.field)
  - Only enable DuplicateRecordFields/NoFieldSelectors in Run and RunReader
    where field names were actually refactored; other modules get
  OverloadedRecordDot only
Snapshot.hs: use exported runFsPaths accessor instead of internal r.fsPaths
Unsafe.hs: restore parens around function applications
 Config/Override.hs: fix corrupted override instance for MergeBatchSize
Benchmarks: update to dot syntax with renamed fields (bloomFilter, index,
    kOpsFile) and add OverloadedRecordDot pragma to both benchmark files
@mwihoti mwihoti force-pushed the feature/811-modern-record-extensions branch from 6568b11 to 04c4cec Compare May 6, 2026 15:40
@mwihoti
Copy link
Copy Markdown
Contributor Author

mwihoti commented May 8, 2026

Hi, @jorisdral I've solved based on comments.

@jorisdral
Copy link
Copy Markdown
Collaborator

jorisdral commented May 18, 2026

@mwihoti thank you! I've opened #850 so that I could make some last-minute modifications (removing some changes that were not strictly necessary for the renaming of Run/RunReader fields). Once CI passes, I'll merge that one and close #830. Thank you again for the contribution 🚀

@mwihoti
Copy link
Copy Markdown
Contributor Author

mwihoti commented May 18, 2026

@jorisdral you are welcome, let me know if I can proceed on index

@jorisdral jorisdral closed this May 18, 2026
@jorisdral
Copy link
Copy Markdown
Collaborator

@jorisdral you are welcome, let me know if I can proceed on index

Feel free to proceed whenever you want

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.

2 participants