Skip to content

Compress digest#193

Open
guilload wants to merge 4 commits into
mainfrom
guilload/compress-digest
Open

Compress digest#193
guilload wants to merge 4 commits into
mainfrom
guilload/compress-digest

Conversation

@guilload

Copy link
Copy Markdown
Member

No description provided.

@guilload guilload force-pushed the guilload/compress-digest branch 6 times, most recently from e7c4bf9 to 3831f08 Compare June 26, 2026 17:25
@guilload guilload marked this pull request as ready for review June 26, 2026 17:25
Comment thread chitchat/src/digest.rs Outdated
}

fn serialized_len(&self) -> usize {
if self.compress {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is not ideal but we already follow the same "pattern" for the Delta. Will fix if it starts showing up on CPU profiles.

@guilload guilload force-pushed the guilload/compress-digest branch from 3831f08 to 8645943 Compare June 26, 2026 18:02
Comment thread chitchat/src/digest.rs Outdated
Comment thread chitchat/src/digest.rs
let mut stream_writer =
CompressedStreamWriter::with_block_threshold(DIGEST_BLOCK_THRESHOLD);
for (chitchat_id, node_digest) in &self.node_digests {
stream_writer.append(chitchat_id);

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.

The API between CompressedStreamWriter and deserialize_stream might be needlessly asymetric.

If we do no need the flexibility, we could have a typed CompressedStreamWriter<(ChitchatId, NodeDigest)> where we append chitchat_id and node_digest together.

Comment thread chitchat/src/digest.rs Outdated
Comment thread chitchat/src/message.rs
Comment thread chitchat/src/lib.rs Outdated
let self_digest = self.compute_digest(&scheduled_for_deletion);
let delta_mtu = MAX_UDP_DATAGRAM_PAYLOAD_SIZE - 1 - self_digest.serialized_len();
let delta_mtu = MAX_UDP_DATAGRAM_PAYLOAD_SIZE
- ChitchatMessage::HEADER_LEN

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.

I don't think this is correct, the MAGIC number and version you added are included in serialized_len for instance

Comment thread chitchat/src/lib.rs Outdated
let delta = self.cluster_state.compute_partial_delta_respecting_mtu(
&digest,
MAX_UDP_DATAGRAM_PAYLOAD_SIZE - 1,
MAX_UDP_DATAGRAM_PAYLOAD_SIZE - ChitchatMessage::HEADER_LEN,

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.

no there a no Syn in the message and HEADER_LEN include the syn magic/version.

@fulmicoton-dd

fulmicoton-dd commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

ChitchatMessage has versioning. I suggest we rely on that instead of having versioning and magic number for each of its component

@quickwit-oss quickwit-oss deleted a comment from fulmicoton-dd Jul 1, 2026
@guilload guilload force-pushed the guilload/compress-digest branch 2 times, most recently from 30b7cb7 to b3730fd Compare July 1, 2026 18:57
@guilload guilload force-pushed the guilload/compress-digest branch from b3730fd to 3a6c200 Compare July 1, 2026 19:12
Comment thread chitchat/src/message.rs
/// reconciliation algorithm and its own digest.
SynAck { digest: Digest, delta: Delta },
SynAck {
protocol_version: ProtocolVersion,

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.

I think it might be better to separate the version from the model.

struct VersionedChitchatMessage {
    version: ProtocolVersion,
    message: ChitchatMessage,
}

(I said enum in the call, that was dumb).

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.

We might want to remove the serialize bullshit to a separate module if it is getting larger with the different version too.

@fulmicoton-dd fulmicoton-dd left a comment

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.

LGTM but I think it would be worth doing putting version outside of the model

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.

3 participants