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

fix: Internode communication should be compressed too #454

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sorock/src/service/raft/communicator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod stream;
use heartbeat_multiplex::*;
use std::sync::Arc;
use tokio::task::AbortHandle;
use tonic::codec::CompressionEncoding;

pub struct HandleDrop(AbortHandle);
impl Drop for HandleDrop {
Expand All @@ -31,6 +32,8 @@ impl RaftConnection {

let chan = endpoint.connect_lazy();
raft::RaftClient::new(chan)
.send_compressed(CompressionEncoding::Zstd)
.accept_compressed(CompressionEncoding::Zstd)
};

let heartbeat_buffer = Arc::new(HeartbeatBuffer::new());
Expand Down
1 change: 1 addition & 0 deletions tests/sorock-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"

[dependencies]
anyhow.workspace = true
tonic.workspace = true

env = { path = "../env" }
sorock = { workspace = true }
Expand Down
3 changes: 3 additions & 0 deletions tests/sorock-tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::{ensure, Result};
use env::Env;
use sorock::service::raft::client::*;
use tonic::codegen::CompressionEncoding;

pub struct Builder {
with_persistency: bool,
Expand Down Expand Up @@ -66,6 +67,8 @@ impl Cluster {
pub fn admin(&self, id: u8) -> RaftClient {
let conn = self.env.get_connection(id);
RaftClient::new(conn)
.accept_compressed(CompressionEncoding::Zstd)
.send_compressed(CompressionEncoding::Zstd)
}

/// Request node `to` to add a node `id`.
Expand Down
Loading