Closed Bug 1303102 Opened 8 years ago Closed 8 years ago

Use autocommit for the run_sql command

Categories

(Tree Management :: Treeherder, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Attachments

(1 file)

Currently if there is a timeout during run_sql, any changes made to the current database will be thrown away, since COMMIT is triggered manually by run_sql (`conn.commit()`) after the (`cursor.execute(sql_code)`).

This means that re-running run_sql repeatedly for an intensive change results in lots of busy-work but no changes saved (which has happened in bug 1303069).

Instead if we just enabled autocommit, changes would be kept.

People can always disable auto-commit within the provided SQL itself, using:
SET AUTOCOMMIT=0
  or
START TRANSACTION ... COMMIT
Attachment #8791699 - Flags: review?(james)
Attachment #8791699 - Flags: review?(james) → review+
Commit pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/c8802ef7ef6f0f3b91c66db9f5fe0edf0ed8498f
Bug 1303102 - Use autocommit for the run_sql command

This prevents changes from being discarded if the DB connection timed
out between the `.execute()` call being made, and it completing.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: