Skip to content

Commit 0470797

Browse files
committed
CA-423760: Reset host.latest_synced_updates_applied
When pool.repositories becomes empty, the host.latest_synced_updates_applied is meaningless and it can't be refreshed by calling pool.sync_updates. Signed-off-by: Ming Lu <ming.lu@cloud.com>
1 parent 9280de0 commit 0470797

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

ocaml/xapi/xapi_pool.ml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3708,8 +3708,16 @@ let set_repositories ~__context ~self ~value =
37083708
)
37093709
value ;
37103710
Db.Pool.set_repositories ~__context ~self ~value ;
3711-
if Db.Pool.get_repositories ~__context ~self = [] then
3711+
if Db.Pool.get_repositories ~__context ~self = [] then (
37123712
Db.Pool.set_last_update_sync ~__context ~self ~value:Date.epoch ;
3713+
(* The host.latest_synced_updates_applied can't be refreshed by
3714+
pool.sync_updates. So reset it here. *)
3715+
Db.Host.get_all ~__context
3716+
|> List.iter (fun h ->
3717+
Db.Host.set_latest_synced_updates_applied ~__context ~self:h
3718+
~value:`unknown
3719+
)
3720+
) ;
37133721
disable_unsupported_periodic_sync_updates ~__context ~self ~repos:value
37143722

37153723
let add_repository ~__context ~self ~value =

0 commit comments

Comments
 (0)