Skip to content

Cleanup composer cache pages

What does this MR do?

Creates a worker to cleanup composer cache pages.

Migrations

== 20210203222620 AddExpiredIndexToComposerCacheFiles: reverting ==============
-- transaction_open?()
   -> 0.0000s
-- indexes(:packages_composer_cache_files)
   -> 0.0034s
-- execute("SET statement_timeout TO 0")
   -> 0.0001s
-- remove_index(:packages_composer_cache_files, {:algorithm=>:concurrently, :name=>"composer_cache_files_index_on_deleted_at"})
   -> 0.0113s
-- execute("RESET ALL")
   -> 0.0002s
== 20210203222620 AddExpiredIndexToComposerCacheFiles: reverted (0.0156s) =====
== 20210203223551 AddOrphanIndexToComposerCacheFiles: reverting ===============
-- transaction_open?()
   -> 0.0000s
-- indexes(:packages_composer_cache_files)
   -> 0.0027s
-- execute("SET statement_timeout TO 0")
   -> 0.0002s
-- remove_index(:packages_composer_cache_files, {:algorithm=>:concurrently, :name=>"index_composer_cache_files_where_namespace_id_is_null"})
   -> 0.0161s
-- execute("RESET ALL")
   -> 0.0003s
== 20210203223551 AddOrphanIndexToComposerCacheFiles: reverted (0.0200s) ======
== 20210203223551 AddOrphanIndexToComposerCacheFiles: migrating ===============
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:packages_composer_cache_files, :id, {:name=>"index_composer_cache_files_where_namespace_id_is_null", :where=>"namespace_id IS NULL", :algorithm=>:concurrently})
   -> 0.0023s
-- execute("SET statement_timeout TO 0")
   -> 0.0002s
-- add_index(:packages_composer_cache_files, :id, {:name=>"index_composer_cache_files_where_namespace_id_is_null", :where=>"namespace_id IS NULL", :algorithm=>:concurrently})
   -> 0.0249s
-- execute("RESET ALL")
   -> 0.0002s
== 20210203223551 AddOrphanIndexToComposerCacheFiles: migrated (0.0281s) ======
== 20210203222620 AddExpiredIndexToComposerCacheFiles: migrating ==============
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:packages_composer_cache_files, [:delete_at, :id], {:name=>"composer_cache_files_index_on_deleted_at", :algorithm=>:concurrently})
   -> 0.0032s
-- execute("SET statement_timeout TO 0")
   -> 0.0002s
-- add_index(:packages_composer_cache_files, [:delete_at, :id], {:name=>"composer_cache_files_index_on_deleted_at", :algorithm=>:concurrently})
   -> 0.0325s
-- execute("RESET ALL")
   -> 0.0004s
== 20210203222620 AddExpiredIndexToComposerCacheFiles: migrated (0.0370s) =====

New queries

SELECT "packages_composer_cache_files".* FROM "packages_composer_cache_files" WHERE "packages_composer_cache_files"."namespace_id" IS NULL ORDER BY "packages_composer_cache_files"."id" ASC LIMIT 1000

Query plan: https://postgres.ai/console/gitlab/gitlab-production-tunnel/sessions/2278/commands/7084

SELECT "packages_composer_cache_files".* FROM "packages_composer_cache_files" WHERE (delete_at <= '2021-02-16 10:16:56.921502') ORDER BY "packages_composer_cache_files"."id" ASC LIMIT 1000

Query plan: https://postgres.ai/console/gitlab/gitlab-production-tunnel/sessions/2278/commands/7085

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #300524 (closed)

Edited by Giorgenes Gelatti

Merge request reports