Update column 'updated_at' in container after repository storage move

We have several scripts in place that replicate some statistics
information to other databases. Some of them depend on the updated_at
column to identify the models they need to extract.

If we don't update the `updated_at` of the container after a
repository storage move, the scripts won't know that they need to
sync them.

See https://gitlab.com/gitlab-data/analytics/-/issues/7868
parent 4214e1c1
......@@ -68,6 +68,18 @@ module RepositoryStorageMovable
storage_move.update_repository_storage(storage_move.destination_storage_name)
end
after_transition started: :replicated do |storage_move|
# We have several scripts in place that replicate some statistics information
# to other databases. Some of them depend on the updated_at column
# to identify the models they need to extract.
#
# If we don't update the `updated_at` of the container after a repository storage move,
# the scripts won't know that they need to sync them.
#
# See https://gitlab.com/gitlab-data/analytics/-/issues/7868
storage_move.container.touch
end
before_transition started: :failed do |storage_move|
storage_move.container.set_repository_writable!
end
......
---
title: Update column 'updated_at' in container after repository storage move
merge_request: 53821
author:
type: fixed
......@@ -99,6 +99,11 @@ RSpec.shared_examples 'handles repository moves' do
expect(container).not_to be_repository_read_only
end
it 'updates the updated_at column of the container', :aggregate_failures do
expect { storage_move.finish_replication! }.to change { container.updated_at }
expect(storage_move.container.updated_at).to be >= storage_move.updated_at
end
end
context 'and transits to failed' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment