Skip to content
Snippets Groups Projects

Fix import/export database errors

Merged James Lopez requested to merge fix/import-export-db-errors into master
3 unresolved threads

Fixes protected branches errors when importing a project including them

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/21295

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/21799

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
170 unless events.blank?
171 existing_object.assign_attributes(events: events)
172 end
173
166 174 existing_object
167 175 else
168 176 relation_class.new(parsed_relation_hash)
169 177 end
170 178 end
171 179 end
180
181 def existing_object
182 @existing_object ||=
183 begin
184 finder_hash = parsed_relation_hash.slice(*FINDER_ATTRIBUTES)
185 existing_object = relation_class.find_or_create_by(finder_hash)
  • 24 24 end
    25 25
    26 26 def verify_version!(version)
    27 if Gem::Version.new(version) > Gem::Version.new(Gitlab::ImportExport.version)
    28 raise Gitlab::ImportExport::Error.new("Import version mismatch: Required <= #{Gitlab::ImportExport.version} but was #{version}")
    27 if Gem::Version.new(version) != Gem::Version.new(Gitlab::ImportExport.version)
    • Do we need to update the docs to say which versions are compatible with each other? https://gitlab.com/help/user/project/settings/import_export.md

    • Actually, could we make an attempt at semver here? Otherwise I don't really get why the version is anything other than integer.

      (Having said that, semver says you can do whatever you want pre-1.0.0 anyway :grinning: )

    • Author Maintainer

      This has changed so no version is compatible with each other, as this could lead to issues (at least, right now). I think is still useful to have this versioning and not just an integer, as it will indicate if we do a major refactor in the future, etc... At the moment we've been just fixing bugs so only the patch Z version of X.Y.Z has been increased... More useful development-wise than for compatibility, at least for now...

    • OK, so it sounds like we should update the docs to say that the export must have a compatible version with the server. As this doesn't track GitLab versions, should there be a table there somewhere?

    • Author Maintainer

      yeah, makes sense. I guess we could add the table to the docs... :thumbsup:

    • Author Maintainer

      Actually, not sure how I haven't added that time ago. Thanks!

    • Please register or sign in to reply
  • @jameslopez looks good, I just really have a question about versioning :thumbsup:

  • Reassigned to @jameslopez

  • James Lopez Added 28 commits:

    Added 28 commits:

  • James Lopez Added 1 commit:

    Added 1 commit:

    • 8b69cd48 - Fixed label color issue and added Import/Export versioning table
  • James Lopez Unmarked this merge request as a Work In Progress

    Unmarked this merge request as a Work In Progress

  • Reassigned to @smcgivern

  • Author Maintainer

    @smcgivern feel free to check this again :)

  • Sean McGivern
  • @jameslopez I'm happy, pick an endboss :slight_smile:

  • Reassigned to @jameslopez

  • Reassigned to @axil

  • Author Maintainer

    Thanks Sean! Assigning to @axil now, to double check the change in the docs :) Thanks!

    Then please assign to @rymai for a final review :)

    Edited by James Lopez
  • James Lopez Added 200 commits:

    Added 200 commits:

    • 8b69cd48...4bdcbc85 - 198 commits from branch master
    • 65a4c832 - squashed - Fix DB exceptions raised importing some specific projects.
    • eed59d0a - Fixed label color issue and added Import/Export versioning table
  • 172 end
    173
    166 174 existing_object
    167 175 else
    168 176 relation_class.new(parsed_relation_hash)
    169 177 end
    170 178 end
    171 179 end
    180
    181 def existing_object
    182 @existing_object ||=
    183 begin
    184 finder_hash = parsed_relation_hash.slice(*FINDER_ATTRIBUTES)
    185 existing_object = relation_class.find_or_create_by(finder_hash)
    186 # Done in two steps, as MySQL behaves differently than PostgreSQL using
    187 # the +find_or_create_by+ method and does not return the ID the second time.
  • James Lopez Added 10 commits:

    Added 10 commits:

    • eed59d0a...06438c74 - 8 commits from branch master
    • 80c7d944 - squashed - Fix DB exceptions raised importing some specific projects.
    • 15d7526e - Fixed label color issue and added Import/Export versioning table
  • Mentioned in issue #21295 (closed)

  • James Lopez Added 266 commits:

    Added 266 commits:

    • 15d7526e...1d51bc7d - 264 commits from branch master
    • e74b7d66 - squashed - Fix DB exceptions raised importing some specific projects.
    • 3c7feaf3 - Fixed label color issue and added Import/Export versioning table
  • James Lopez Added 1 commit:

    Added 1 commit:

  • James Lopez Added ~149423 label

    Added ~149423 label

  • Author Maintainer

    @rymai assigning this back to you - failing spec seems unrelated as it's failing in master as well...

  • Reassigned to @rymai

  • Rémy Coutable Status changed to merged

    Status changed to merged

  • Rémy Coutable Mentioned in commit 1e72de66

    Mentioned in commit 1e72de66

  • it was shipped with RC5

  • Rubén Dávila Removed ~149423 label

    Removed ~149423 label

  • Mentioned in issue #23730 (closed)

  • Please register or sign in to reply
    Loading