@@ -195,6 +195,9 @@ pub(crate) struct DownstairsClient {
195
195
196
196
/// State for startup negotiation
197
197
negotiation_state : NegotiationState ,
198
+
199
+ /// Session ID for a clients connection to a downstairs.
200
+ connection_id : usize ,
198
201
}
199
202
200
203
impl DownstairsClient {
@@ -231,6 +234,7 @@ impl DownstairsClient {
231
234
region_metadata : None ,
232
235
repair_info : None ,
233
236
io_state_count : ClientIOStateCount :: new ( ) ,
237
+ connection_id : 0 ,
234
238
}
235
239
}
236
240
@@ -267,6 +271,7 @@ impl DownstairsClient {
267
271
region_metadata : None ,
268
272
repair_info : None ,
269
273
io_state_count : ClientIOStateCount :: new ( ) ,
274
+ connection_id : 0 ,
270
275
}
271
276
}
272
277
@@ -604,6 +609,7 @@ impl DownstairsClient {
604
609
self . state = DsState :: New ;
605
610
}
606
611
612
+ self . connection_id += 1 ;
607
613
// Restart with a short delay
608
614
self . start_task ( true , auto_promote) ;
609
615
}
@@ -2185,13 +2191,13 @@ impl DownstairsClient {
2185
2191
( self . io_state_count . new + self . io_state_count . in_progress ) as usize
2186
2192
}
2187
2193
2188
- /// Returns a unique ID for the current connect , or `None`
2194
+ /// Returns a unique ID for the current connection , or `None`
2189
2195
///
2190
2196
/// This can be used to disambiguate between messages returned from
2191
2197
/// different connections to the same Downstairs.
2192
2198
pub ( crate ) fn get_connection_id ( & self ) -> Option < u64 > {
2193
2199
if self . client_task . client_stop_tx . is_some ( ) {
2194
- Some ( self . stats . connected as u64 )
2200
+ Some ( self . connection_id as u64 )
2195
2201
} else {
2196
2202
None
2197
2203
}
0 commit comments