@@ -58,7 +58,7 @@ use mz_storage_types::read_policy::ReadPolicy;
58
58
use mz_storage_types:: time_dependence:: { TimeDependence , TimeDependenceError } ;
59
59
use prometheus:: proto:: LabelPair ;
60
60
use serde:: { Deserialize , Serialize } ;
61
- use timely:: progress:: { Antichain , ChangeBatch , Timestamp } ;
61
+ use timely:: progress:: { Antichain , Timestamp } ;
62
62
use timely:: PartialOrder ;
63
63
use tokio:: sync:: { mpsc, oneshot} ;
64
64
use tokio:: time:: { self , MissedTickBehavior } ;
@@ -539,8 +539,6 @@ where
539
539
logs. push ( ( log, id, shared) ) ;
540
540
}
541
541
542
- let ( read_holds_tx, read_holds_rx) = mpsc:: unbounded_channel ( ) ;
543
-
544
542
let client = instance:: Client :: spawn (
545
543
id,
546
544
self . build_info ,
@@ -553,11 +551,9 @@ where
553
551
Arc :: clone ( & self . dyncfg ) ,
554
552
self . response_tx . clone ( ) ,
555
553
self . introspection_tx . clone ( ) ,
556
- read_holds_tx. clone ( ) ,
557
- read_holds_rx,
558
554
) ;
559
555
560
- let instance = InstanceState :: new ( client, collections, read_holds_tx ) ;
556
+ let instance = InstanceState :: new ( client, collections) ;
561
557
self . instances . insert ( id, instance) ;
562
558
563
559
self . instance_workload_classes
@@ -608,7 +604,7 @@ where
608
604
/// Panics if the identified `instance` still has active replicas.
609
605
pub fn drop_instance ( & mut self , id : ComputeInstanceId ) {
610
606
if let Some ( instance) = self . instances . remove ( & id) {
611
- instance. call ( |i| i. check_empty ( ) ) ;
607
+ instance. call ( |i| i. shutdown ( ) ) ;
612
608
}
613
609
614
610
self . instance_workload_classes
@@ -1103,58 +1099,52 @@ struct InstanceState<T: ComputeControllerTimestamp> {
1103
1099
client : instance:: Client < T > ,
1104
1100
replicas : BTreeSet < ReplicaId > ,
1105
1101
collections : BTreeMap < GlobalId , Collection < T > > ,
1106
- /// Sender for updates to collection read holds.
1107
- ///
1108
- /// Copies of this sender are given to [`ReadHold`]s that are created in
1109
- /// [`InstanceState::acquire_read_hold`].
1110
- read_holds_tx : mpsc:: UnboundedSender < ( GlobalId , ChangeBatch < T > ) > ,
1111
1102
}
1112
1103
1113
1104
impl < T : ComputeControllerTimestamp > InstanceState < T > {
1114
- fn new (
1115
- client : instance:: Client < T > ,
1116
- collections : BTreeMap < GlobalId , Collection < T > > ,
1117
- read_holds_tx : mpsc:: UnboundedSender < ( GlobalId , ChangeBatch < T > ) > ,
1118
- ) -> Self {
1105
+ fn new ( client : instance:: Client < T > , collections : BTreeMap < GlobalId , Collection < T > > ) -> Self {
1119
1106
Self {
1120
1107
client,
1121
1108
replicas : Default :: default ( ) ,
1122
1109
collections,
1123
- read_holds_tx,
1124
1110
}
1125
1111
}
1126
1112
1127
1113
fn collection ( & self , id : GlobalId ) -> Result < & Collection < T > , CollectionMissing > {
1128
1114
self . collections . get ( & id) . ok_or ( CollectionMissing ( id) )
1129
1115
}
1130
1116
1131
- pub fn call < F > ( & self , f : F )
1117
+ fn call < F > ( & self , f : F )
1132
1118
where
1133
1119
F : FnOnce ( & mut Instance < T > ) + Send + ' static ,
1134
1120
{
1135
1121
let otel_ctx = OpenTelemetryContext :: obtain ( ) ;
1136
- self . client . send ( Box :: new ( move |instance| {
1137
- let _span = debug_span ! ( "instance::call" ) . entered ( ) ;
1138
- otel_ctx. attach_as_parent ( ) ;
1139
-
1140
- f ( instance)
1141
- } ) ) ;
1122
+ self . client
1123
+ . send ( Box :: new ( move |instance| {
1124
+ let _span = debug_span ! ( "instance::call" ) . entered ( ) ;
1125
+ otel_ctx. attach_as_parent ( ) ;
1126
+
1127
+ f ( instance)
1128
+ } ) )
1129
+ . expect ( "instance not dropped" ) ;
1142
1130
}
1143
1131
1144
- pub async fn call_sync < F , R > ( & self , f : F ) -> R
1132
+ async fn call_sync < F , R > ( & self , f : F ) -> R
1145
1133
where
1146
1134
F : FnOnce ( & mut Instance < T > ) -> R + Send + ' static ,
1147
1135
R : Send + ' static ,
1148
1136
{
1149
1137
let ( tx, rx) = oneshot:: channel ( ) ;
1150
1138
let otel_ctx = OpenTelemetryContext :: obtain ( ) ;
1151
- self . client . send ( Box :: new ( move |instance| {
1152
- let _span = debug_span ! ( "instance::call_sync" ) . entered ( ) ;
1153
- otel_ctx. attach_as_parent ( ) ;
1139
+ self . client
1140
+ . send ( Box :: new ( move |instance| {
1141
+ let _span = debug_span ! ( "instance::call_sync" ) . entered ( ) ;
1142
+ otel_ctx. attach_as_parent ( ) ;
1154
1143
1155
- let result = f ( instance) ;
1156
- let _ = tx. send ( result) ;
1157
- } ) ) ;
1144
+ let result = f ( instance) ;
1145
+ let _ = tx. send ( result) ;
1146
+ } ) )
1147
+ . expect ( "instance not dropped" ) ;
1158
1148
1159
1149
rx. await . expect ( "instance not dropped" )
1160
1150
}
@@ -1177,7 +1167,7 @@ impl<T: ComputeControllerTimestamp> InstanceState<T> {
1177
1167
since
1178
1168
} ) ;
1179
1169
1180
- let hold = ReadHold :: new ( id, since, self . read_holds_tx . clone ( ) ) ;
1170
+ let hold = ReadHold :: new ( id, since, self . client . read_hold_tx ( ) ) ;
1181
1171
Ok ( hold)
1182
1172
}
1183
1173
@@ -1196,7 +1186,6 @@ impl<T: ComputeControllerTimestamp> InstanceState<T> {
1196
1186
client : _,
1197
1187
replicas,
1198
1188
collections,
1199
- read_holds_tx : _,
1200
1189
} = self ;
1201
1190
1202
1191
let instance = self . call_sync ( |i| i. dump ( ) ) . await ?;
0 commit comments