Deleting performance_datum row fails when it's associated to performance_datum_replicate's
Categories
(Tree Management :: Perfherder, defect, P2)
Tracking
(Not tracked)
People
(Reporter: sparky, Unassigned)
References
(Regression)
Details
(Keywords: regression)
I was looking at the performance datum max age for the try branch and found that it was over the 42 days currently being used: https://sql.telemetry.mozilla.org/queries/92654/source
I found bug 1681473 where we hit an issue with deleting data on the multicommitdatum table, and it seems similar to what we might be hitting here. I added the following test and found that deletion was definitely failing (not sure if we can find this in any prod logs?):
def test_deleting_performance_data_cascades_to_perf_datum_replicate(test_perf_data):
perf_datum = test_perf_data[0]
PerformanceDatumReplicate.objects.create(performance_datum=perf_datum, value=0.0)
assert PerformanceDatumReplicate.objects.count() == 1
try:
cursor = connection.cursor()
cursor.execute(
'''
DELETE FROM `performance_datum`
WHERE id = %s
''',
[perf_datum.id],
)
except IntegrityError:
pytest.fail()
finally:
cursor.close()
assert PerformanceDatumReplicate.objects.count() == 0
Error:
E django.db.utils.IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`test_treeherder`.`performance_datum_replicate`, CONSTRAINT `performance_datum_re_performance_datum_id_fe2ed518_fk_performan` FOREIGN KEY (`performance_datum_id`) REFERENCES `performance_datum)')
/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py:259: IntegrityError
I get the same error when I try to delete a performance_datum row from a database viewer/editor.
I've followed the patch in bug 1681473 to make a similar migration for the table so that we can delete the performance_datum rows again. I'll post a PR shortly.
Reporter | ||
Comment 1•2 years ago
|
||
PR for it here: https://github.com/mozilla/treeherder/pull/7744
Reporter | ||
Comment 2•2 years ago
|
||
PR landed, and has been deployed to prod. The data is now being deleted, with June 2nd being the oldest date found for the data on try (previously May 18th): https://sql.telemetry.mozilla.org/queries/92654/source
Reporter | ||
Updated•2 years ago
|
Description
•