Skip to content

Fix arithmetic overflow for MSSQL result backend - #9904

Merged
auvipy merged 4 commits into
celery:mainfrom
vladborovtsov:fix-mssql-crash
Sep 21, 2025
Merged

auvipy merged 4 commits into
celery:mainfrom
vladborovtsov:fix-mssql-crash

Conversation

@vladborovtsov

Copy link
Copy Markdown
Contributor

Description

Apparently, not too many people are using celery with MSSQL. This change must fix #8634.

Perhaps there is no other way neither place to do this better:
SQLAlchemy seems to behave correctly: it uses Integer when specified, and it’s not SQLAlchemy's business that Integer cannot fit a sequence. As a consequence, the application should use proper field types.

@Nusnus
Nusnus requested a review from Copilot September 20, 2025 22:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an arithmetic overflow issue when using the MSSQL database backend with Celery by replacing Integer columns with BigInteger for MSSQL dialect while maintaining Integer for other databases.

  • Introduces a dialect-specific column type that uses BigInteger for MSSQL and Integer for other databases
  • Updates the primary key columns in Task and TaskSet models to use the new dialect-specific type
  • Addresses issue #8634 where MSSQL's Integer type cannot accommodate large sequence values

@codecov

codecov Bot commented Sep 20, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.67%. Comparing base (989aac0) to head (1b3d523).
⚠️ Report is 70 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9904   +/-   ##
=======================================
  Coverage   78.67%   78.67%           
=======================================
  Files         153      153           
  Lines       19290    19291    +1     
  Branches     2568     2568           
=======================================
+ Hits        15176    15177    +1     
+ Misses       3816     3814    -2     
- Partials      298      300    +2     
Flag Coverage Δ
unittests 78.65% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@auvipy
auvipy self-requested a review September 21, 2025 04:55
Comment thread celery/backends/database/models.py Resolved

@Nusnus Nusnus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@auvipy auvipy added this to the 5.6.0 milestone Sep 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arithmetic Overflow Error with MSSQL Backend due to Integer 'id' Field Limitation

4 participants