Skip to content

Create LfsObjectsProject record for forks as well

Patrick Bajao requested to merge 20042-create-lfs-objects-project into master

What does this MR do?

Previous behavior was LfsObjectsProject are created on the source project.

To fix the issue whenever the source project gets deleted or fork was selectively synced, we need to create the records for forks.

This way, they'll also have access to the LfsObject and no longer dependent on the source project.

Migrations

  • db/migrate/20200123040535_add_multi_column_index_on_lfs_objects_projects.rb - For adding the index on project_id and lfs_object_id

    Migration output:

    == 20200123040535 AddMultiColumnIndexOnLfsObjectsProjects: migrating ==========
    -- transaction_open?()
       -> 0.0000s
    -- index_exists?(:lfs_objects_projects, [:project_id, :lfs_object_id], {:algorithm=>:concurrently})
       -> 0.0060s
    == 20200123040535 AddMultiColumnIndexOnLfsObjectsProjects: migrated (0.0061s) =
  • db/migrate/20200123045415_remove_project_id_index_on_lfs_objects_projects.rb - For removing the redundant project_id index

    Migration output:

    == 20200123045415 RemoveProjectIdIndexOnLfsObjectsProjects: migrating =========
    -- transaction_open?()
       -> 0.0000s
    -- index_exists?(:lfs_objects_projects, :project_id, {:algorithm=>:concurrently})
       -> 0.0049s
    -- execute("SET statement_timeout TO 0")
       -> 0.0003s
    -- remove_index(:lfs_objects_projects, {:algorithm=>:concurrently, :column=>:project_id})
       -> 0.0176s
    -- execute("RESET ALL")
       -> 0.0003s
    == 20200123045415 RemoveProjectIdIndexOnLfsObjectsProjects: migrated (0.0234s) 

Project#all_lfs_objects query plan

https://explain.depesz.com/s/VMVNG

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

#20042 (closed)

Edited by Sean Carroll

Merge request reports