Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the Cached index using TVars #1197

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

jasagredo
Copy link
Contributor

@jasagredo jasagredo commented Jul 31, 2024

In the past some nodes have been crashing because of a misalingment in the data in the Cached Index. Ensuring that the changes are atomic via stm seems to solve the problem.

In terms of logic, this PR only moves the modifications into atomically blocks, the overall logic is the same.

Depends on #1196
Closes #359

@jasagredo jasagredo force-pushed the js/tvar-cache branch 3 times, most recently from 4c1408f to 0533805 Compare July 31, 2024 15:01
@jasagredo jasagredo self-assigned this Jul 31, 2024
In the past some nodes have been crashing because of a misalingment in the data in the Cached Index.
Ensuring that the changes are atomic via `stm` seems to solve the problem.

In terms of logic, this PR only moves the modifications into `atomically` blocks, the overall logic
is the same.
return $ Just $ Right pastChunkInfo
| otherwise -> do
((Just $ Right pastChunkInfo, TracePastChunkHit chunk nbPastChunks), cached')
| otherwise ->
-- Cache miss for an chunk in the past. We don't want to hold on to
-- the 'cacheVar' MVar, blocking all other access to the cace, while
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- the 'cacheVar' MVar, blocking all other access to the cace, while
-- the 'cacheVar' TVar, blocking all other access to the cace, while

@@ -409,13 +409,14 @@ newEnv hasFS registry tracer cacheConfig chunkInfo chunk = do
-- Will expire past chunks that haven't been used for 'expireUnusedAfter' from
-- the cache.
expireUnusedChunks ::
forall h m blk.
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary tyvar bindings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

[BUG] - MissingBlockError for block k from tip
3 participants