Closed Bug 702271 Opened 13 years ago Closed 7 years ago

balrog should raise an error when data will be truncated

Categories

(Release Engineering Graveyard :: Applications: Balrog (backend), defect, P5)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: bhearsum, Unassigned)

References

Details

bug 701865 describes a situation where we had data silently truncated by MySQL. We worked around it by using a larger field, but it's still possible for large enough data to be truncated. Balrog should throw an error when data will be truncated rather than letting it happen silently.

MySQL has a 'show warnings' command that can supposedly tell you when these sort of things happen, but we may be better off using our own method. Doing so would let us test it much better/more easily, and remain DB-agnostic.
10:56 < catlee> so you may be able to configure the warnings module to raise the warning as an exception
10:56 < catlee> but you still need to call cursor.info()
10:57 < catlee> so maybe assert connection.warning_count() == 0 is ok
found in triage.
Component: Release Engineering → Release Engineering: Automation
QA Contact: release → catlee
We hit this again with Releases.version, bug 748399.
Blocks: balrog-frontend
No longer blocks: balrog
Blocks: balrog
No longer blocks: balrog-frontend
Product: mozilla.org → Release Engineering
mass component change
Component: General Automation → Balrog: Backend
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/3403]
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/3403] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/3408]
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/3408] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/3410]
(In reply to Ben Hearsum [:bhearsum] from comment #1)
> 10:56 < catlee> so you may be able to configure the warnings module to raise
> the warning as an exception
> 10:56 < catlee> but you still need to call cursor.info()
> 10:57 < catlee> so maybe assert connection.warning_count() == 0 is ok

Another option might be to enable strict mode, which will cause the queries to fail.
(In reply to Ben Hearsum [:bhearsum] from comment #5)
> (In reply to Ben Hearsum [:bhearsum] from comment #1)
> > 10:56 < catlee> so you may be able to configure the warnings module to raise
> > the warning as an exception
> > 10:56 < catlee> but you still need to call cursor.info()
> > 10:57 < catlee> so maybe assert connection.warning_count() == 0 is ok
> 
> Another option might be to enable strict mode, which will cause the queries
> to fail.

https://github.com/mozilla/balrog/commit/d15f6cdfa23665c91021ff4b27e60a69e6b4b065 did this for the db upgrade script and it seemed to work well. We should try enabling it for the admin app and see how the errors manifest themselves. Eg, do we need to make any additional changes to get useful error messages.
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/3410]
We haven't hit this since switching the releases.data column to LONGTEXT. I doubt this is worth fixing.
Status: NEW → RESOLVED
Closed: 7 years ago
Priority: P3 → P5
Resolution: --- → WONTFIX
Product: Release Engineering → Release Engineering Graveyard
You need to log in before you can comment on or make changes to this bug.