Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
GitLab
GitLab
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 35,012
    • Issues 35,012
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 1,264
    • Merge Requests 1,264
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GitLab.org
  • GitLabGitLab
  • Issues
  • #32696

Closed
Open
Opened 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
12.4
Milestone
12.4 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: gitlab-org/gitlab#32696