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

ManagedCursor: chunk position info #267

Merged
merged 5 commits into from
May 15, 2024
Merged

Conversation

eolivelli
Copy link
Collaborator

@eolivelli eolivelli commented May 15, 2024

This is an alternative implemetation to "Compression".
The idea is that we can persist the Position info, that can be huge, in multiple smaller BK entries.

The format is simple: in case of chunking we write all the entries and then a JSON footer.
During recover we read the footer and the previous N entries.

This patch is the initial part of the work, because we have to handle recovery of the case in which the broker crashes while writing the entries.
In this case we have to scan the ledger backward until we find a well-formed entry or a new "footer"

// this is not JSON
return ChunkSequenceFooter.NOT_CHUNKED;
}
return ObjectMapperFactory.getMapper().getObjectMapper().readValue(data, ChunkSequenceFooter.class);
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't possible that first char is { for other reason?
maybe we should catch JSONProcessingException and assume it's not a ChunkSequenceFooter

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think that it is possible with a ProtoBuf encoded message

@eolivelli eolivelli merged commit 846fed2 into 3.1_fx_merged May 15, 2024
1 check passed
@eolivelli eolivelli deleted the chunk-cursor-position branch May 15, 2024 16:16
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.

None yet

2 participants