Skip to content

Commit

Permalink
Don't use trim_log's response to determine the trim point, call descr…
Browse files Browse the repository at this point in the history
…ibe_log instead
  • Loading branch information
pcholakov committed Jan 8, 2025
1 parent 1087f12 commit 9592d6a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions server/tests/trim_gap_handling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use url::Url;

use restate_admin::cluster_controller::protobuf::cluster_ctrl_svc_client::ClusterCtrlSvcClient;
use restate_admin::cluster_controller::protobuf::{
ClusterStateRequest, CreatePartitionSnapshotRequest, TrimLogRequest,
ClusterStateRequest, CreatePartitionSnapshotRequest, DescribeLogRequest, TrimLogRequest,
};
use restate_local_cluster_runner::{
cluster::Cluster,
Expand Down Expand Up @@ -249,20 +249,25 @@ async fn trim_log(
trim_point: Lsn,
) -> googletest::Result<()> {
loop {
let response = client
// We have to keep retrying the trim operation as the admin node may decide to no-op it if
// the trim point is after the known global tail.
client
.trim_log(TrimLogRequest {
log_id: log_id.into(),
trim_point: trim_point.as_u64(),
})
.await?;

let response = client
.describe_log(DescribeLogRequest {
log_id: log_id.into(),
})
.await?
.into_inner();

if response
.trim_point
.is_some_and(|tp| tp >= trim_point.as_u64())
{
if response.trim_point >= trim_point.as_u64() {
break;
}

tokio::time::sleep(Duration::from_millis(250)).await;
}
Ok(())
Expand Down

0 comments on commit 9592d6a

Please sign in to comment.