From 511eba7d59f1c51f40d91a3fb508b469cb72491f Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Thu, 28 Oct 2010 17:00:47 +0100 Subject: [PATCH] CA-42914: Improve debugging in redo-log code In particular, highlight the I/O process lifecycle operations. Signed-off-by: Jonathan Davies --- ocaml/database/block_device_io.ml | 3 ++- ocaml/database/redo_log.ml | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ocaml/database/block_device_io.ml b/ocaml/database/block_device_io.ml index 26a88d2f..394044f1 100644 --- a/ocaml/database/block_device_io.ml +++ b/ocaml/database/block_device_io.ml @@ -309,7 +309,7 @@ let transfer_data_from_sock_to_fd sock dest_fd available_space target_response_t (* Open the data channel *) let s = listen_on sock in let data_client = accept_conn s target_response_time in - R.debug "Accepted connection on data socket"; + R.info "Accepted connection on data socket"; ignore_exn (fun () -> Unix.close s); (* Read all the data from the data channel, writing it straight into the block device, keeping track of accumulated length *) @@ -328,6 +328,7 @@ let transfer_data_from_sock_to_fd sock dest_fd available_space target_response_t ) (fun () -> (* Close the connection *) + R.info "Closing connection on data socket"; ignore_exn (fun () -> Unix.close data_client) ) in R.debug "Finished reading from data socket"; diff --git a/ocaml/database/redo_log.ml b/ocaml/database/redo_log.ml index fc982864..17d0386a 100644 --- a/ocaml/database/redo_log.ml +++ b/ocaml/database/redo_log.ml @@ -452,7 +452,7 @@ let shutdown () = (* Terminate the child process *) let ipid = Forkhelpers.getpid p in - R.debug "Killing I/O process with pid %d" ipid; + R.info "Killing I/O process with pid %d" ipid; Unix.kill ipid Sys.sigkill; (* Wait for the process to die. This is done in a separate thread in case it does not respond to the signal immediately. *) ignore (Thread.create (fun () -> @@ -512,11 +512,11 @@ let startup () = (* Start the I/O process *) let [ctrlsockpath; datasockpath] = List.map (fun suffix -> Filename.temp_file Xapi_globs.redo_log_comms_socket_stem suffix) ["ctrl"; "data"] in - R.debug "Starting I/O process with block device [%s], control socket [%s] and data socket [%s]" block_dev ctrlsockpath datasockpath; + R.info "Starting I/O process with block device [%s], control socket [%s] and data socket [%s]" block_dev ctrlsockpath datasockpath; let p = start_io_process block_dev ctrlsockpath datasockpath in pid := Some (p, ctrlsockpath, datasockpath); - R.debug "Block device I/O process has PID [%d]" (Forkhelpers.getpid p) + R.info "Block device I/O process has PID [%d]" (Forkhelpers.getpid p) end end end; @@ -576,7 +576,9 @@ let perform_action f desc sock = match !pid with | None -> () | Some (_, _, datasockpath) -> + R.debug "About to perform action %s" desc; f sock datasockpath; + R.debug "Action '%s' completed successfully" desc; healthy () (* no exceptions: we can be confident that the redo log is working healthily *) with | Unixext.Timeout -> -- 2.39.5