Refactor Run modules to use modern record extensions#830
Refactor Run modules to use modern record extensions#830mwihoti wants to merge 6 commits intoIntersectMBO:mainfrom
Conversation
|
Hi @jorisdral , I just pushed an update for Run module with the new record language extensions, I'm moving next to Index |
There was a problem hiding this comment.
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 enableDuplicateRecordFields,NoFieldSelectors, andOverloadedRecordDot. In other modules where we only want to use the.fieldsyntax, it should be fine to only enableOverloadedRecordDot, so let's change that so that we only use the.fieldsyntax on values of typeRunandRunReader. 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
|
Thanks, I will work on the changes |
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
343017b to
5823d35
Compare
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
|
Hi @jorisdral I've updated changes based on the feedback |
|
Hello, @jorisdral I'would like to proceed next to index, could you check if what I've done aligns well |
| let blooms = V.map (\(DeRef r) -> r.bloomFilter ) runs | ||
| indexes = V.map (\(DeRef r) -> r.index ) runs | ||
| handles = V.map (\(DeRef r) -> r.kOpsFile ) runs |
There was a problem hiding this comment.
| let blooms = V.map (\(DeRef r) -> r.bloomFilter ) runs | |
| indexes = V.map (\(DeRef r) -> r.index ) runs | |
| handles = V.map (\(DeRef r) -> r.kOpsFile ) runs | |
| let blooms = V.map (\(DeRef r) -> r.bloomFilter) runs | |
| indexes = V.map (\(DeRef r) -> r.index ) runs | |
| handles = V.map (\(DeRef r) -> r.kOpsFile ) runs |
| env ( pure ( V.map (\(DeRef r) -> r.bloomFilter ) rs | ||
| , V.map (\(DeRef r) -> r.index ) rs | ||
| , V.map (\(DeRef r) -> r.kOpsFile ) rs |
There was a problem hiding this comment.
| env ( pure ( V.map (\(DeRef r) -> r.bloomFilter ) rs | |
| , V.map (\(DeRef r) -> r.index ) rs | |
| , V.map (\(DeRef r) -> r.kOpsFile ) rs | |
| env ( pure ( V.map (\(DeRef r) -> r.bloomFilter) rs | |
| , V.map (\(DeRef r) -> r.index ) rs | |
| , V.map (\(DeRef r) -> r.kOpsFile ) rs |
| rnf numEntries `seq` rwhnf refCounter `seq` rnf fsPaths `seq` | ||
| rnf bloomFilter `seq` rnf index `seq` rnf kOpsFile `seq` | ||
| rnf blobFile `seq` rnf dataCaching `seq` rwhnf hasFS `seq` rwhnf hasBlockIO | ||
|
|
| numEntries = runNumEntries | ||
| , refCounter = refCounter | ||
| , fsPaths = runRunFsPaths |
There was a problem hiding this comment.
| numEntries = runNumEntries | |
| , refCounter = refCounter | |
| , fsPaths = runRunFsPaths | |
| numEntries = runNumEntries | |
| , refCounter = refCounter | |
| , fsPaths = runRunFsPaths |
| -> m () | ||
| close RunReader{..} = do | ||
| when (readerRunDataCaching == Run.NoCacheRunData) $ | ||
| close r = do -- Use 'r' instead of RunReader{..} |
There was a problem hiding this comment.
This is not resolved yet: remove the comment
|
|
||
| {-# INLINE tableSessionSalt #-} | ||
| -- | Inherited from session for ease of access. | ||
| -- | Inherited from session for easenve of access. |
There was a problem hiding this comment.
| -- | Inherited from session for easenve of access. | |
| -- | Inherited from session for ease of access. |
| !wbblobs = tableWriteBufferBlobs content | ||
| wbblobs' <- withRollback reg (dupRef wbblobs) releaseRef | ||
| let runs = cachedRuns (tableCache content) | ||
| let runs = cachedRuns(tableCache content) |
There was a problem hiding this comment.
| let runs = cachedRuns(tableCache content) | |
| let runs = cachedRuns (tableCache content) |
| traceWith childTableTracer $ TraceIncrementalUnions (NE.map tableId ts) | ||
| childTableId <- uniqueToTableId <$> incrUniqCounter sesh.sessionUniqCounter | ||
| let childTableTracer = TraceTable childTableId `contramap` sesh.lsmTreeTracer | ||
| traceWith childTableTracer $ TraceIncrementalUnions (NE.map (\t -> t.tableId) ts) |
There was a problem hiding this comment.
| traceWith childTableTracer $ TraceIncrementalUnions (NE.map (\t -> t.tableId) ts) | |
| traceWith childTableTracer $ TraceIncrementalUnions (NE.map (.tableId) ts) |
There was a problem hiding this comment.
There are redundant parentheses around record-dot syntax in this module
| (V.mapStrict (\(DeRef r) -> r.bloomFilter) runs) | ||
| (V.mapStrict (\(DeRef r) -> r.index ) runs) | ||
| (V.mapStrict (\(DeRef r) -> r.kOpsFile) runs) |
There was a problem hiding this comment.
| (V.mapStrict (\(DeRef r) -> r.bloomFilter) runs) | |
| (V.mapStrict (\(DeRef r) -> r.index ) runs) | |
| (V.mapStrict (\(DeRef r) -> r.kOpsFile) runs) | |
| (V.mapStrict (\(DeRef r) -> r.bloomFilter) runs) | |
| (V.mapStrict (\(DeRef r) -> r.index ) runs) | |
| (V.mapStrict (\(DeRef r) -> r.kOpsFile ) runs) |

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
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