Skip to content

GitLab Next

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 43,053
    • Issues 43,053
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,350
    • Merge requests 1,350
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLabGitLab
  • Issues
  • #32696
Closed
Open
Created Sep 24, 2019 by Gabriel Mazetto@brodock🔴Maintainer

Geo: LFS not being synced

In b89457d9 we refactored some code and lost one important bit from the LFS query: b89457d9

When

def fdw_find_unsynced(except_file_ids:)
      fdw_all.joins("LEFT OUTER JOIN file_registry
                                          ON file_registry.file_id = #{fdw_table}.id
                                         AND file_registry.file_type = 'lfs'")
        .geo_syncable
        .where(file_registry: { id: nil })
        .where.not(id: except_file_ids)

become:

    def lfs_objects_unsynced(except_file_ids:)
      fdw_geo_node
        .lfs_objects
        .syncable
        .missing_file_registry
        .id_not_in(except_file_ids)

The query lost the join condition that matches file_type = 'lfs'. This makes the LFS sync stop adding new items to be synchronized.

I'm flagging this as a regression from %12.1 but there is a chance this affected even previous versions (last 11.x). In %12.1 we removed the legacy queries, which made this affect any customer from that version ahead.


current code from lfs_objects_unsynced results in the following query:

SELECT "gitlab_secondary"."lfs_objects"."id"
FROM "gitlab_secondary"."lfs_objects"
         LEFT OUTER JOIN "file_registry" ON "gitlab_secondary"."lfs_objects"."id" = "file_registry"."file_id"
WHERE ("gitlab_secondary"."lfs_objects"."file_store" = 1 OR "gitlab_secondary"."lfs_objects"."file_store" IS NULL)
  AND "file_registry"."id" IS NULL
LIMIT 25;

what we should be doing instead:

SELECT "gitlab_secondary"."lfs_objects"."id"
FROM "gitlab_secondary"."lfs_objects"
         LEFT OUTER JOIN "file_registry" ON ("gitlab_secondary"."lfs_objects"."id" = "file_registry"."file_id" AND
                                             file_registry.file_type = 'lfs')
WHERE ("gitlab_secondary"."lfs_objects"."file_store" = 1 OR "gitlab_secondary"."lfs_objects"."file_store" IS NULL)
  AND "file_registry"."id" IS NULL
LIMIT 25;
Edited Sep 24, 2019 by Gabriel Mazetto
Assignee
Assign to
Time tracking