@@ -1714,7 +1714,7 @@ impl Downstairs {
1714
1714
pub ( crate ) fn on_reconciliation_ack (
1715
1715
& mut self ,
1716
1716
client_id : ClientId ,
1717
- m : Message ,
1717
+ repair_id : ReconciliationId ,
1718
1718
up_state : & UpstairsState ,
1719
1719
) -> bool {
1720
1720
let Some ( next) = self . reconcile_current_work . as_mut ( ) else {
@@ -1742,10 +1742,6 @@ impl Downstairs {
1742
1742
return false ;
1743
1743
}
1744
1744
1745
- let Message :: RepairAckId { repair_id } = m else {
1746
- panic ! ( "invalid message {m:?} for on_reconciliation_ack" ) ;
1747
- } ;
1748
-
1749
1745
if self . clients [ client_id] . on_reconciliation_job_done ( repair_id, next) {
1750
1746
self . reconcile_current_work = None ;
1751
1747
self . reconcile_repair_needed -= 1 ;
@@ -1763,17 +1759,11 @@ impl Downstairs {
1763
1759
pub ( crate ) fn on_reconciliation_failed (
1764
1760
& mut self ,
1765
1761
client_id : ClientId ,
1766
- m : Message ,
1762
+ repair_id : ReconciliationId ,
1763
+ extent_id : ExtentId ,
1764
+ error : CrucibleError ,
1767
1765
up_state : & UpstairsState ,
1768
1766
) {
1769
- let Message :: ExtentError {
1770
- repair_id,
1771
- extent_id,
1772
- error,
1773
- } = m
1774
- else {
1775
- panic ! ( "invalid message {m:?}" ) ;
1776
- } ;
1777
1767
error ! (
1778
1768
self . clients[ client_id] . log,
1779
1769
"extent {extent_id} error on job {repair_id}: {error}"
@@ -6119,9 +6109,7 @@ pub(crate) mod test {
6119
6109
// Send an ack to trigger the reconciliation state check
6120
6110
let nw = ds. on_reconciliation_ack (
6121
6111
ClientId :: new ( 0 ) ,
6122
- Message :: RepairAckId {
6123
- repair_id : close_id,
6124
- } ,
6112
+ close_id,
6125
6113
& UpstairsState :: Active ,
6126
6114
) ;
6127
6115
assert ! ( !nw) ;
@@ -6166,28 +6154,15 @@ pub(crate) mod test {
6166
6154
ds. send_next_reconciliation_req ( ) ;
6167
6155
6168
6156
// Downstairs 0 and 2 are okay, but 1 failed (for some reason!)
6169
- let msg = Message :: RepairAckId { repair_id : rep_id } ;
6170
- assert ! ( !ds. on_reconciliation_ack(
6171
- ClientId :: new( 0 ) ,
6172
- msg. clone( ) ,
6173
- & up_state
6174
- ) ) ;
6157
+ assert ! ( !ds. on_reconciliation_ack( ClientId :: new( 0 ) , rep_id, & up_state) ) ;
6175
6158
ds. on_reconciliation_failed (
6176
6159
ClientId :: new ( 1 ) ,
6177
- Message :: ExtentError {
6178
- repair_id : rep_id,
6179
- extent_id : ExtentId ( 1 ) ,
6180
- error : CrucibleError :: GenericError (
6181
- "test extent error" . to_owned ( ) ,
6182
- ) ,
6183
- } ,
6160
+ rep_id,
6161
+ ExtentId ( 1 ) ,
6162
+ CrucibleError :: GenericError ( "test extent error" . to_owned ( ) ) ,
6184
6163
& up_state,
6185
6164
) ;
6186
- assert ! ( !ds. on_reconciliation_ack(
6187
- ClientId :: new( 2 ) ,
6188
- msg. clone( ) ,
6189
- & up_state
6190
- ) ) ;
6165
+ assert ! ( !ds. on_reconciliation_ack( ClientId :: new( 2 ) , rep_id, & up_state) ) ;
6191
6166
6192
6167
// Getting the next work to do should verify the previous is done,
6193
6168
// and handle a state change for a downstairs.
@@ -6255,34 +6230,18 @@ pub(crate) mod test {
6255
6230
6256
6231
// Ack the close job. Reconciliation isn't done at this point, because
6257
6232
// there's another job in the task list.
6258
- let msg = Message :: RepairAckId {
6259
- repair_id : close_id,
6260
- } ;
6261
6233
for i in ClientId :: iter ( ) {
6262
- assert ! ( !ds. on_reconciliation_ack( i, msg . clone ( ) , & up_state) ) ;
6234
+ assert ! ( !ds. on_reconciliation_ack( i, close_id , & up_state) ) ;
6263
6235
}
6264
6236
6265
6237
// The third ack will have sent the next reconciliation job
6266
6238
assert ! ( ds. reconcile_task_list. is_empty( ) ) ;
6267
6239
6268
6240
// Now, make sure we consider this done only after all three are done
6269
- let msg = Message :: RepairAckId { repair_id : rep_id } ;
6270
- assert ! ( !ds. on_reconciliation_ack(
6271
- ClientId :: new( 0 ) ,
6272
- msg. clone( ) ,
6273
- & up_state
6274
- ) ) ;
6275
- assert ! ( !ds. on_reconciliation_ack(
6276
- ClientId :: new( 1 ) ,
6277
- msg. clone( ) ,
6278
- & up_state
6279
- ) ) ;
6241
+ assert ! ( !ds. on_reconciliation_ack( ClientId :: new( 0 ) , rep_id, & up_state) ) ;
6242
+ assert ! ( !ds. on_reconciliation_ack( ClientId :: new( 1 ) , rep_id, & up_state) ) ;
6280
6243
// The third ack finishes reconciliation!
6281
- assert ! ( ds. on_reconciliation_ack(
6282
- ClientId :: new( 2 ) ,
6283
- msg. clone( ) ,
6284
- & up_state
6285
- ) ) ;
6244
+ assert ! ( ds. on_reconciliation_ack( ClientId :: new( 2 ) , rep_id, & up_state) ) ;
6286
6245
assert_eq ! ( ds. reconcile_repair_needed, 0 ) ;
6287
6246
assert_eq ! ( ds. reconcile_repaired, 2 ) ;
6288
6247
}
@@ -6328,19 +6287,10 @@ pub(crate) mod test {
6328
6287
assert_eq ! ( job. state[ ClientId :: new( 1 ) ] , ReconcileIOState :: InProgress ) ;
6329
6288
assert_eq ! ( job. state[ ClientId :: new( 2 ) ] , ReconcileIOState :: InProgress ) ;
6330
6289
6331
- let msg = Message :: RepairAckId { repair_id : rep_id } ;
6332
- assert ! ( !ds. on_reconciliation_ack(
6333
- ClientId :: new( 1 ) ,
6334
- msg. clone( ) ,
6335
- & up_state
6336
- ) ) ;
6290
+ assert ! ( !ds. on_reconciliation_ack( ClientId :: new( 1 ) , rep_id, & up_state) ) ;
6337
6291
// The second ack finishes reconciliation, because it was skipped for
6338
6292
// client 0 (which was the source of repairs).
6339
- assert ! ( ds. on_reconciliation_ack(
6340
- ClientId :: new( 2 ) ,
6341
- msg. clone( ) ,
6342
- & up_state
6343
- ) ) ;
6293
+ assert ! ( ds. on_reconciliation_ack( ClientId :: new( 2 ) , rep_id, & up_state) ) ;
6344
6294
assert_eq ! ( ds. reconcile_repair_needed, 0 ) ;
6345
6295
assert_eq ! ( ds. reconcile_repaired, 1 ) ;
6346
6296
}
@@ -6375,11 +6325,8 @@ pub(crate) mod test {
6375
6325
6376
6326
// If we get back an ack from client 0, something has gone terribly
6377
6327
// wrong (because the jobs should have been skipped for it)
6378
- ds. on_reconciliation_ack (
6379
- ClientId :: new ( 0 ) ,
6380
- Message :: RepairAckId { repair_id : rep_id } ,
6381
- & up_state,
6382
- ) ; // this should panic!
6328
+ ds. on_reconciliation_ack ( ClientId :: new ( 0 ) , rep_id, & up_state) ;
6329
+ // this should panic!
6383
6330
}
6384
6331
6385
6332
#[ test]
@@ -6414,17 +6361,8 @@ pub(crate) mod test {
6414
6361
assert ! ( !ds. send_next_reconciliation_req( ) ) ;
6415
6362
6416
6363
// Now, make sure we consider this done only after all three are done
6417
- let msg = Message :: RepairAckId { repair_id : rep_id } ;
6418
- assert ! ( !ds. on_reconciliation_ack(
6419
- ClientId :: new( 1 ) ,
6420
- msg. clone( ) ,
6421
- & up_state
6422
- ) ) ;
6423
- assert ! ( !ds. on_reconciliation_ack(
6424
- ClientId :: new( 2 ) ,
6425
- msg. clone( ) ,
6426
- & up_state
6427
- ) ) ;
6364
+ assert ! ( !ds. on_reconciliation_ack( ClientId :: new( 1 ) , rep_id, & up_state) ) ;
6365
+ assert ! ( !ds. on_reconciliation_ack( ClientId :: new( 2 ) , rep_id, & up_state) ) ;
6428
6366
// don't finish
6429
6367
6430
6368
ds. send_next_reconciliation_req ( ) ; // panics!
0 commit comments