Commit 2ce7566 1 parent 400c24d commit 2ce7566 Copy full SHA for 2ce7566
File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1318,9 +1318,22 @@ impl WritableStoreTrait for WritableStore {
1318
1318
1319
1319
async fn restart ( self : Arc < Self > ) -> Result < Option < Arc < dyn WritableStoreTrait > > , StoreError > {
1320
1320
if self . poisoned ( ) {
1321
+ // When the writer is poisoned, the background thread has
1322
+ // finished since `start_writer` returns whenever it encounters
1323
+ // an error. Just to make extra-sure, we log a warning if the
1324
+ // join handle indicates that the writer hasn't stopped yet.
1321
1325
let logger = self . store . logger . clone ( ) ;
1322
- if let Err ( e) = self . stop ( ) . await {
1323
- warn ! ( logger, "Writable had error when stopping, it is safe to ignore this error" ; "error" => e. to_string( ) ) ;
1326
+ match & self . writer {
1327
+ Writer :: Sync ( _) => { /* can't happen, a sync writer never gets poisoned */ }
1328
+ Writer :: Async { join_handle, queue } => {
1329
+ let err = match queue. check_err ( ) {
1330
+ Ok ( ( ) ) => "error missing" . to_string ( ) ,
1331
+ Err ( e) => e. to_string ( ) ,
1332
+ } ;
1333
+ if !join_handle. is_finished ( ) {
1334
+ warn ! ( logger, "Writer was poisoned, but background thread didn't finish. Creating new writer regardless" ; "error" => err) ;
1335
+ }
1336
+ }
1324
1337
}
1325
1338
let store = Arc :: new ( self . store . store . 0 . clone ( ) ) ;
1326
1339
store
You can’t perform that action at this time.
0 commit comments