Skip to content

Commit

Permalink
Merge pull request #4781 from xapi-project/private/linl/dev
Browse files Browse the repository at this point in the history
CP-40669: Restore database should not require ref as the first
  • Loading branch information
robhoes committed Aug 30, 2022
2 parents 9524421 + c730c12 commit 896add0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ocaml/database/db_xml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,24 @@ module From = struct
f acc
| (_, "table"), [((_, "name"), tblname)] ->
f (tableset, Table.empty, tblname, manifest)
| (_, "row"), ((_, "ref"), rf) :: rest ->
(* Remove any other duplicate "ref"s which might have sneaked in there *)
let rest = List.filter (fun ((_, k), _) -> k <> "ref") rest in
| (_, "row"), rest ->
let ref_l, rest =
List.partition (fun ((_, k), _) -> k = "ref") rest
in

let ctime_l, rest =
List.partition (fun ((_, k), _) -> k = "__ctime") rest
in
let mtime_l, rest =
List.partition (fun ((_, k), _) -> k = "__mtime") rest
in
let rf =
match ref_l with
| (_, ref) :: _ ->
ref (* Pick up the first ref and ignore others *)
| [] ->
raise (Unmarshall_error "Row does not have ref atrribute")
in
let ctime =
match ctime_l with
| [(_, ctime_s)] ->
Expand Down

0 comments on commit 896add0

Please sign in to comment.