Save filediffs in batches when creating a diffset.

Review Request #8882 - Created April 6, 2017 and submitted

Christian Hammond
Review Board
release-2.5.x
b31e35d...
reviewboard
When creating a diffset, we parse out each file and store a FileDiff for
each one. These were being saved to the database one-at-a-time, which
isn't efficient. Instead, we now create all the instances and then
bulk-save them into the database, turning many SQL statements into one.

We also no longer set the diff or parent diff immediately, since that
triggers saving a RawFileDiffData. Instead, we set those only if we know
we're saving. This will further speed up validation and prevent
potentially unnecessary data from being stord in the database.

A unit test has been added to ensure the SQL count is as expected. Other
related tests have been updated to match the modern naming/docstring
standards.

Unit tests pass.

Barret Rennie
David Trowbridge
Christian Hammond
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.5.x (533a60e)
Loading...