From c42f767e37859f0f46bde5599e6436aef2563c39 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 22 Jun 2012 16:16:44 -0700 Subject: [PATCH] Destroy changeset parse cache when destroying a revision Summary: When we delete a DifferentialChangeset, also delete the cache if it exists. Test Plan: Destroyed a revision, verified cache was destroyed. See marked line below. $ ./scripts/differential/destroy_revision.php D1 --trace >>> [0] <<< [0] 1,324 us >>> [1] SELECT * FROM `differential_revision` WHERE `id` = 1 <<< [1] 517 us Really destroy 'D1: asdb' forever? [y/N] y >>> [2] <<< [2] 633 us >>> [3] START TRANSACTION <<< [3] 183 us >>> [4] SELECT * FROM `differential_diff` WHERE revisionID = 1 <<< [4] 560 us >>> [5] SAVEPOINT Aphront_Savepoint_1 <<< [5] 197 us >>> [6] SELECT * FROM `differential_changeset` WHERE diffID = 3 <<< [6] 672 us >>> [7] SAVEPOINT Aphront_Savepoint_2 <<< [7] 188 us >>> [8] SELECT * FROM `differential_hunk` WHERE changesetID = 6 <<< [8] 946 us >>> [9] DELETE FROM `differential_hunk` WHERE `id` = 6 <<< [9] 335 us **** >>> [10] DELETE FROM `differential_changeset_parse_cache` WHERE id = 6 <<< [10] 1,464 us >>> [11] DELETE FROM `differential_changeset` WHERE `id` = 6 <<< [11] 313 us >>> [12] SAVEPOINT Aphront_Savepoint_2 <<< [12] 151 us >>> [13] SELECT * FROM `differential_hunk` WHERE changesetID = 7 <<< [13] 226 us >>> [14] DELETE FROM `differential_hunk` WHERE `id` = 7 <<< [14] 164 us >>> [15] DELETE FROM `differential_changeset_parse_cache` WHERE id = 7 <<< [15] 318 us >>> [16] DELETE FROM `differential_changeset` WHERE `id` = 7 <<< [16] 189 us >>> [17] SELECT * FROM `differential_diffproperty` WHERE diffID = 3 <<< [17] 500 us >>> [18] DELETE FROM `differential_diffproperty` WHERE `id` = 1 <<< [18] 179 us >>> [19] DELETE FROM `differential_diff` WHERE `id` = 3 <<< [19] 211 us >>> [20] DELETE FROM `differential_relationship` WHERE revisionID = 1 <<< [20] 391 us >>> [21] DELETE FROM `differential_commit` WHERE revisionID = 1 <<< [21] 397 us >>> [22] SELECT * FROM `differential_comment` WHERE revisionID = 1 <<< [22] 448 us >>> [23] DELETE FROM `differential_comment` WHERE `id` = 1 <<< [23] 212 us >>> [24] DELETE FROM `differential_comment` WHERE `id` = 2 <<< [24] 160 us >>> [25] SELECT * FROM `differential_inlinecomment` WHERE revisionID = 1 <<< [25] 549 us >>> [26] SELECT * FROM `differential_auxiliaryfield` WHERE revisionPHID = 'PHID-DREV-orsh7alzcj764ubv2f34' <<< [26] 531 us >>> [27] SELECT * FROM `differential_affectedpath` WHERE revisionID = 1 <<< [27] 5,676 us >>> [28] DELETE FROM `differential_revision` WHERE `id` = 1 <<< [28] 442 us >>> [29] COMMIT <<< [29] 324 us OK, destroyed revision. Reviewers: csilvers, btrahan Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2835 --- .../differential/storage/DifferentialChangeset.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php index dfde4612ca..72b6912b9d 100644 --- a/src/applications/differential/storage/DifferentialChangeset.php +++ b/src/applications/differential/storage/DifferentialChangeset.php @@ -105,7 +105,14 @@ final class DifferentialChangeset extends DifferentialDAO { $hunk->delete(); } $this->_hunks = array(); - $ret = parent::delete(); + + queryfx( + $this->establishConnection('w'), + 'DELETE FROM %T WHERE id = %d', + self::TABLE_CACHE, + $this->getID()); + + $ret = parent::delete(); $this->saveTransaction(); return $ret; }