Verified Solution[gitlab-org/gitlab] Merge requests do not update after upgrading to CE-18.9.1
Sponsored Content
### ROOT CAUSE
The issue is caused by a regression in the `UpdateMergeRequestsWorker` job introduced in GitLab CE 18.9.1. The worker attempts to update the `merge_request_diff_commits` table with a `null` value for the `committed_date` column, violating its `NOT NULL` constraint. This behavior is triggered by merge request diff commits during the upgrade process.
### CODE FIX
1. **Revert the Worker's Behavior**: Modify the `UpdateMergeRequestsWorker` to handle cases where `diff_commits` might not have a `committed_date`. Specifically, avoid setting `null` for this column.
```ruby:app/workers/update_merge_requests_worker.rb
# In the method that updates the diff_commits
if diff_commits
# Only update the committed_date if it exists, else skip
next unless diff_commits.committed_date
# Your existing code to update the date
end
```
2. **Ensure Proper Data Migration**: If the `UpdateMergeRequestsWorker` is part of a larger upgrade process, ensure any associated data migrations (e.g., `20230101000000`) properly handle the `merge_request_diff_commits` table.
**Steps to Apply the Fix**:
1. Replace the existing code in `UpdateMergeRequestsWorker` with the above conditional check.
2. Run the Sidekiq jobs again to process pending merge requests.
3. Verify that the `merge_request_diff_commits` table no longer contains `null` values for `committed_date`.
This fix ensures the database constraint is respected and allows merge requests to update properly post-upgrade.
Deploy on DigitalOcean ($200 Credit)
Related Fixes
[docker/cli] Wrong ANSI font representation
[pytorch/pytorch] torch.compile crashes on user-defined Triton kernel referencing triton.language.dtype globals
[StackOverflow/python] Developer python environments including DLLs