Skip to content

Commit

Permalink
Report errors when gc failed in one_commit_store
Browse files Browse the repository at this point in the history
  • Loading branch information
icristescu committed Dec 14, 2022
1 parent 5a3ac3f commit 3448ddd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/irmin-pack/unix/gc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,9 @@ module Make (Args : Gc_args.S) = struct

let finalise_without_swap t =
let* status = Async.await t.task in
match status with
| `Success ->
let gc_output = read_gc_output ~root:t.root ~generation:t.generation in
match (status, gc_output) with
| `Success, Ok _ ->
Lwt.return (t.latest_gc_target_offset, t.new_suffix_start_offset)
| _ ->
let gc_output = read_gc_output ~root:t.root ~generation:t.generation in
Expand Down
1 change: 1 addition & 0 deletions src/irmin-pack/unix/gc_worker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ module Make (Args : Gc_args.S) = struct
run ~generation ~new_files_path root commit_key
new_suffix_start_offset)
in
Errs.log_if_error "gc run" result;
let write_result = write_gc_output ~root ~generation result in
write_result |> Errs.log_if_error "writing gc output"
(* No need to raise or log if [result] is [Error _], we've written it in
Expand Down
2 changes: 1 addition & 1 deletion src/irmin-pack/unix/io_errors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module type S = sig
val log_error : string -> [< t ] -> unit
val catch : (unit -> 'a) -> ('a, t) result
val raise_if_error : ('a, [< t ]) result -> 'a
val log_if_error : string -> (unit, [< t ]) result -> unit
val log_if_error : string -> ('a, [< t ]) result -> unit
end

module Make (Io : Io.S) : S with module Io = Io = struct
Expand Down

0 comments on commit 3448ddd

Please sign in to comment.