Direct transfer: Interrupted MR imports are double-counted in fetched objects, causing false import failures

Summary

When a merge request import is interrupted during Direct transfer, the MR is counted twice in the count of fetched objects but only once (or not at all) in the count of imported objects. This creates a discrepancy that results in false positive import failures being reported, even when all data was successfully imported.

Relevant internal RFH issue: https://gitlab.com/gitlab-com/request-for-help/-/issues/3839

Customer ticket: https://gitlab.zendesk.com/agent/tickets/649632

Steps to reproduce

  1. Initiate a Direct transfer import from a source instance to a destination instance
  2. During the import process, have a merge request import get interrupted (network issue, timeout, etc.)
  3. The import process retries and successfully imports the merge request
  4. Check the import report

Example Project

N/A

What is the current bug behavior?

When a merge request import is interrupted and retried:

  • The MR is counted twice in the fetched objects count
  • The MR is counted once (or zero times) in the imported objects count
  • This creates a mismatch between fetched and imported counts
  • The import report shows "X MR(s) failed to import" even though all MRs were successfully imported
  • No error messages appear in logs or UI because there was no actual failure
  • API verification shows matching MR counts between source and destination

This causes confusion and lack of confidence in the import process, as users see reported failures without any actual missing data.

What is the expected correct behavior?

  • Each merge request should be counted exactly once in the fetched objects count, regardless of interruptions or retries
  • The imported objects count should accurately reflect successfully imported MRs
  • If an MR is retried after interruption, the counting logic should handle this correctly
  • The import report should only show failures when there are actual import failures with corresponding error messages

Relevant logs and/or screenshots

When this bug occurs:

  • Import report shows "1 MR failed to import"
  • Sidekiq logs show no exceptions
  • Importer logs show no exceptions
  • UI shows no error messages or warnings
  • API comparison confirms all MRs were imported successfully

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
Observed on:
- Source version: 17.8
- Destination version: 18.4
- Import method: Direct transfer

Results of GitLab application Check

N/A - Issue observed on GitLab.com

Possible fixes

  • Review the counting logic in the Direct transfer importer for merge requests
  • Ensure that interrupted/retried imports increment the fetched count only once
  • Add idempotency checks to prevent double-counting when retries occur
  • Consider using a Set or similar data structure to track unique fetched objects
  • Ensure the imported count is incremented correctly after successful retries
Edited Jan 13, 2026 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading