Skip to content

Commit

Permalink
Merge pull request #5153 from lindig/private/christianlin/CA-379459
Browse files Browse the repository at this point in the history
CA-379459 make shutdown mutex per redo_log
  • Loading branch information
lindig authored Aug 17, 2023
2 parents 6b0ddfe + 7ac30e9 commit c065c29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ocaml/database/redo_log.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type redo_log_conf = {
; pid: (Forkhelpers.pidty * string * string) option ref
; dying_processes_mutex: Mutex.t
; num_dying_processes: int ref
; mutex: Mutex.t (** exclusive access to this configuration *)
}

type 'a redo_log = redo_log_conf
Expand Down Expand Up @@ -545,8 +546,6 @@ let maybe_retry f log =

(* Close any existing socket and kill the corresponding process. *)

let shutdown_m = Mutex.create ()

let shutdown' log =
if is_enabled log then (
D.debug "Shutting down connection to I/O process for '%s'" log.name ;
Expand Down Expand Up @@ -601,7 +600,7 @@ let shutdown' log =
(* ignore any errors *)
)

let shutdown log = with_lock shutdown_m (fun () -> shutdown' log)
let shutdown log = with_lock log.mutex (fun () -> shutdown' log)

let broken log =
set_time_of_last_failure log ;
Expand Down Expand Up @@ -783,6 +782,7 @@ let create ~name ~state_change_callback ~read_only =
; pid= ref None
; dying_processes_mutex= Mutex.create ()
; num_dying_processes= ref 0
; mutex= Mutex.create ()
}
in
with_lock redo_log_creation_mutex (fun () ->
Expand Down

0 comments on commit c065c29

Please sign in to comment.