1010use std:: collections:: HashSet ;
1111use std:: fmt:: Debug ;
1212use std:: marker:: PhantomData ;
13- use std:: mem;
1413use std:: time:: Instant ;
1514
1615use differential_dataflow:: difference:: Semigroup ;
@@ -24,19 +23,19 @@ use tokio::sync::{mpsc, oneshot};
2423use tracing:: { debug, debug_span, warn, Instrument , Span } ;
2524
2625use crate :: internal:: machine:: { retry_external, Machine } ;
27- use crate :: internal:: maintenance:: RoutineMaintenance ;
2826use crate :: internal:: paths:: { PartialRollupKey , RollupId } ;
2927use crate :: ShardId ;
3028
31- #[ derive( Debug , Clone , PartialEq ) ]
29+ #[ derive( Debug , Clone ) ]
30+ #[ cfg_attr( test, derive( PartialEq ) ) ]
3231pub struct GcReq {
3332 pub shard_id : ShardId ,
3433 pub new_seqno_since : SeqNo ,
3534}
3635
3736#[ derive( Debug ) ]
3837pub struct GarbageCollector < K , V , T , D > {
39- sender : UnboundedSender < ( GcReq , oneshot:: Sender < RoutineMaintenance > ) > ,
38+ sender : UnboundedSender < ( GcReq , oneshot:: Sender < ( ) > ) > ,
4039 _phantom : PhantomData < fn ( ) -> ( K , V , T , D ) > ,
4140}
4241
@@ -106,7 +105,7 @@ where
106105{
107106 pub fn new ( mut machine : Machine < K , V , T , D > ) -> Self {
108107 let ( gc_req_sender, mut gc_req_recv) =
109- mpsc:: unbounded_channel :: < ( GcReq , oneshot:: Sender < RoutineMaintenance > ) > ( ) ;
108+ mpsc:: unbounded_channel :: < ( GcReq , oneshot:: Sender < ( ) > ) > ( ) ;
110109
111110 // spin off a single task responsible for executing GC requests.
112111 // work is enqueued into the task through a channel
@@ -142,7 +141,7 @@ where
142141
143142 let start = Instant :: now ( ) ;
144143 machine. metrics . gc . started . inc ( ) ;
145- let mut maintenance = Self :: gc_and_truncate ( & mut machine, consolidated_req)
144+ Self :: gc_and_truncate ( & mut machine, consolidated_req)
146145 . instrument ( gc_span)
147146 . await ;
148147 machine. metrics . gc . finished . inc ( ) ;
@@ -156,9 +155,8 @@ where
156155 // inform all callers who enqueued GC reqs that their work is complete
157156 for sender in gc_completed_senders {
158157 // we can safely ignore errors here, it's possible the caller
159- // wasn't interested in waiting and dropped their receiver.
160- // maintenance will be somewhat-arbitrarily assigned to the first oneshot.
161- let _ = sender. send ( mem:: take ( & mut maintenance) ) ;
158+ // wasn't interested in waiting and dropped their receiver
159+ let _ = sender. send ( ( ) ) ;
162160 }
163161 }
164162 } ) ;
@@ -172,10 +170,7 @@ where
172170 /// Enqueues a [GcReq] to be consumed by the GC background task when available.
173171 ///
174172 /// Returns a future that indicates when GC has cleaned up to at least [GcReq::new_seqno_since]
175- pub fn gc_and_truncate_background (
176- & self ,
177- req : GcReq ,
178- ) -> Option < oneshot:: Receiver < RoutineMaintenance > > {
173+ pub fn gc_and_truncate_background ( & self , req : GcReq ) -> Option < oneshot:: Receiver < ( ) > > {
179174 let ( gc_completed_sender, gc_completed_receiver) = oneshot:: channel ( ) ;
180175 let new_gc_sender = self . sender . clone ( ) ;
181176 let send = new_gc_sender. send ( ( req, gc_completed_sender) ) ;
@@ -193,10 +188,7 @@ where
193188 Some ( gc_completed_receiver)
194189 }
195190
196- pub async fn gc_and_truncate (
197- machine : & mut Machine < K , V , T , D > ,
198- req : GcReq ,
199- ) -> RoutineMaintenance {
191+ pub async fn gc_and_truncate ( machine : & mut Machine < K , V , T , D > , req : GcReq ) {
200192 assert_eq ! ( req. shard_id, machine. shard_id( ) ) ;
201193 // NB: Because these requests can be processed concurrently (and in
202194 // arbitrary order), all of the logic below has to work even if we've
@@ -232,7 +224,7 @@ where
232224 "gc {} early returning, already GC'd past {}" ,
233225 req. shard_id, req. new_seqno_since,
234226 ) ;
235- return RoutineMaintenance :: default ( ) ;
227+ return ;
236228 }
237229
238230 let mut deleteable_batch_blobs = HashSet :: new ( ) ;
@@ -312,7 +304,7 @@ where
312304 . state_versions
313305 . write_rollup_blob ( & machine. shard_metrics , & state, & rollup_key)
314306 . await ;
315- let ( applied, maintenance ) = machine
307+ let applied = machine
316308 . add_and_remove_rollups ( ( rollup_seqno, & rollup_key) , & deleteable_rollup_blobs)
317309 . await ;
318310 // We raced with some other GC process to write this rollup out. Ours
@@ -359,7 +351,5 @@ where
359351 "gc {} truncated diffs through seqno {}" ,
360352 req. shard_id, req. new_seqno_since
361353 ) ;
362-
363- maintenance
364354 }
365355}
0 commit comments