Skip to content

Commit

Permalink
coord: Optimize read hold updates (MaterializeInc#14006)
Browse files Browse the repository at this point in the history
This commit updates the logic for read holds updates so that an update
is only sent if the read timestamp has actually changed. This prevents
network calls from being sent that have no effect on the read policy.
  • Loading branch information
jkosh44 authored Aug 1, 2022
1 parent 16d9bb7 commit bbb59f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/adapter/src/coord/message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//! messages from various sources (ex: controller, clients, background tasks, etc).

use chrono::DurationRound;
use timely::PartialOrder;
use tracing::{event, Level};

use mz_controller::{ComputeInstanceEvent, ControllerResponse};
Expand Down Expand Up @@ -314,7 +315,7 @@ impl<S: Append + 'static> Coordinator<S> {
timeline,
TimelineState {
mut oracle,
read_holds,
mut read_holds,
},
) in global_timelines
{
Expand All @@ -332,7 +333,9 @@ impl<S: Append + 'static> Coordinator<S> {
.fast_forward(now, |ts| self.catalog.persist_timestamp(&timeline, ts))
.await;
let read_ts = oracle.read_ts();
let read_holds = self.update_read_hold(read_holds, read_ts).await;
if read_holds.time.less_than(&read_ts) {
read_holds = self.update_read_hold(read_holds, read_ts).await;
}
self.global_timelines
.insert(timeline, TimelineState { oracle, read_holds });
}
Expand Down

0 comments on commit bbb59f6

Please sign in to comment.