Page MenuHomePhabricator

`bin/remove destroy` is dangerous and leaves dangling edges
Closed, ResolvedPublic

Description

Occasionally, there are tasks in Maniphest that we want to remove completely (along with all related comments, etc). destroy doesn't completely remove all edges of a removed object, and is scary to use because it warns db may be in an inconsistent state :(

For context: we have some tasks we want to completely delete from our database (task metadata, comment thread, etc). We want to know if there's a way to safely delete these tasks.

Event Timeline

angie raised the priority of this task from to Needs Triage.
angie updated the task description. (Show Details)
angie added a project: Restricted Project.
angie added subscribers: jhurwitz, angie, ryanseu and 2 others.
jhurwitz renamed this task from bin_destroy is dangerous and leaves dangling edges to /bin/destroy is dangerous and leaves dangling edges.Jul 13 2015, 6:12 PM
jhurwitz renamed this task from /bin/destroy is dangerous and leaves dangling edges to `bin/remove destroy` is dangerous and leaves dangling edges.Jul 13 2015, 6:14 PM
jhurwitz updated the task description. (Show Details)

It would help to know why you are deleting so many Maniphest tasks. We'd rather solve the core problem you are having with the software.

Maybe more fundamentally, we have a design philosophy of audit-ability, which bin/destroy is counter to. It's not something we expect admins to do with any common workflow.

Wouldn't setting the view policy to "nobody" achieve pretty much the same?

@ryanseu, can you explain the use case and why setting the view policy isn't sufficient?

Can you also enumerate exactly what problems you have with bin/remove destroy on tasks at HEAD? The expectation is that all these relationships are destroyed:

  • Edges
  • Transactions
  • Tasks
  • Notifications
  • Herald Transcripts
  • Flags
  • Tokens

Locally, edge destruction works correctly. Here's a complete log:

$ ./bin/remove destroy T5 --trace
>>> [2] <connect> local_maniphest
<<< [2] <connect> 1,891 us
>>> [3] <query> SELECT `task`.*  FROM `maniphest_task` task  WHERE (task.id in (5))   ORDER BY `task`.`id` DESC 
<<< [3] <query> 416 us


                                  uuuuuuu
                               uu###########uu
                            uu#################uu
                           u#####################u
                          u#######################u
                         u#########################u
                         u#########################u
                         u######"   "###"   "######u
                         "####"      u#u       ####"
                          ###u       u#u       u###
                          ###u      u###u      u###
                           "####uu###   ###uu####"
                            "#######"   "#######"
                              u#######u#######u
                               u#"#"#"#"#"#"#u
                    uuu        ##u# # # # #u##       uuu
                   u####        #####u#u#u###       u####
                    #####uu      "#########"     uu######
                  u###########uu    """""    uuuu##########
                  ####"""##########uuu   uu#########"""###"
                   """      ""###########uu ""#"""
                             uuuu ""##########uuu
                    u###uuu#########uu ""###########uuu###
                    ##########""""           ""###########"
                     "#####"                      ""####""
                       ###"                         ####"


 IMPORTANT  DATA WILL BE PERMANENTLY DESTROYED

Objects will be permanently destroyed. There is no way to undo this operation
or ever retrieve this data unless you maintain external backups.

 IMPORTANT  DELETING OBJECTS OFTEN BREAKS THINGS

Destroying objects may cause related objects to stop working, and may leave
scattered references to objects which no longer exist. In most cases, it is
much better to disable or archive objects instead of destroying them. This
risk is greatest when deleting complex or highly connected objects like
repositories, projects and users.

These tattered edges are an expected consquence of destroying objects, and
the Phabricator upstream will not help you fix them. We strongly recomend
disabling or archiving objects instead.

This object will be destroyed forever:

>>> [4] <query> SELECT `task`.*  FROM `maniphest_task` task  WHERE (task.phid in ('PHID-TASK-i2bocsccycxyfznr7nnb'))   ORDER BY `task`.`id` DESC 
<<< [4] <query> 274 us
    - T5 (ManiphestTask) T5: abdsd



    Are you absolutely certain you want to destroy this object? [y/N] y

Destroying objects...
Destroying ManiphestTask T5...
>>> [5] <connect> local_system
<<< [5] <connect> 982 us
>>> [6] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTask', NULL, 'PHID-TASK-i2bocsccycxyfznr7nnb', 'T5', '1436884072')
<<< [6] <query> 2,883 us
>>> [7] <connect> local_maniphest
<<< [7] <connect> 573 us
>>> [8] <query> START TRANSACTION
<<< [8] <query> 126 us
>>> [9] <query> DELETE FROM `maniphest_task` WHERE `id` = 5
<<< [9] <query> 405 us
>>> [10] <query> COMMIT
<<< [10] <query> 303 us
>>> [11] <query> SELECT edge.* FROM `edge` edge WHERE (edge.src IN ('PHID-TASK-i2bocsccycxyfznr7nnb')) ORDER BY edge.dateCreated DESC, edge.seq DESC
<<< [11] <query> 319 us
>>> [12] <connect> local_pholio
<<< [12] <connect> 524 us
>>> [13] <connect> local_user
<<< [13] <connect> 509 us
>>> [14] <query> START TRANSACTION
<<< [14] <query> 138 us
>>> [15] <query> DELETE FROM `edge` WHERE ((src = 'PHID-TASK-i2bocsccycxyfznr7nnb' AND type = 38 AND dst = 'PHID-MOCK-4sxfq4tjz7px3v6gjkcj') OR (src = 'PHID-TASK-i2bocsccycxyfznr7nnb' AND type = 21 AND dst = 'PHID-USER-cvfydnwadpdj7vdon36z'))
<<< [15] <query> 2,169 us
>>> [16] <query> START TRANSACTION
<<< [16] <query> 123 us
>>> [17] <query> DELETE FROM `edge` WHERE ((src = 'PHID-MOCK-4sxfq4tjz7px3v6gjkcj' AND type = 37 AND dst = 'PHID-TASK-i2bocsccycxyfznr7nnb'))
<<< [17] <query> 236 us
>>> [18] <query> START TRANSACTION
<<< [18] <query> 87 us
>>> [19] <query> DELETE FROM `edge` WHERE ((src = 'PHID-USER-cvfydnwadpdj7vdon36z' AND type = 22 AND dst = 'PHID-TASK-i2bocsccycxyfznr7nnb'))
<<< [19] <query> 1,332 us
>>> [20] <query> COMMIT
<<< [20] <query> 351 us
>>> [21] <query> COMMIT
<<< [21] <query> 323 us
>>> [22] <query> COMMIT
<<< [22] <query> 534 us
>>> [23] <query> SELECT * FROM `maniphest_transaction` WHERE objectPHID = 'PHID-TASK-i2bocsccycxyfznr7nnb' 
<<< [23] <query> 329 us
>>> [24] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-b53phsx73ix3itq', NULL, '1436884072')
<<< [24] <query> 468 us
>>> [25] <query> START TRANSACTION
<<< [25] <query> 98 us
>>> [26] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-b53phsx73ix3itq' 
<<< [26] <query> 1,296 us
>>> [27] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 107
<<< [27] <query> 1,194 us
>>> [28] <query> COMMIT
<<< [28] <query> 1,096 us
>>> [29] <connect> local_worker
<<< [29] <connect> 517 us
>>> [30] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-b53phsx73ix3itq' 
<<< [30] <query> 1,301 us
>>> [31] <connect> local_feed
<<< [31] <connect> 429 us
>>> [32] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-b53phsx73ix3itq'
<<< [32] <query> 256 us
>>> [33] <connect> local_herald
<<< [33] <connect> 490 us
>>> [34] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-b53phsx73ix3itq' 
<<< [34] <query> 1,286 us
>>> [35] <connect> local_flag
<<< [35] <connect> 432 us
>>> [36] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-b53phsx73ix3itq' 
<<< [36] <query> 201 us
>>> [37] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-33u7gqlakyiiczl', NULL, '1436884072')
<<< [37] <query> 320 us
>>> [38] <query> START TRANSACTION
<<< [38] <query> 105 us
>>> [39] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-33u7gqlakyiiczl' 
<<< [39] <query> 181 us
>>> [40] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 108
<<< [40] <query> 162 us
>>> [41] <query> COMMIT
<<< [41] <query> 229 us
>>> [42] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-33u7gqlakyiiczl' 
<<< [42] <query> 253 us
>>> [43] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-33u7gqlakyiiczl'
<<< [43] <query> 140 us
>>> [44] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-33u7gqlakyiiczl' 
<<< [44] <query> 180 us
>>> [45] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-33u7gqlakyiiczl' 
<<< [45] <query> 192 us
>>> [46] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-ivxtdz7edth2lnv', NULL, '1436884072')
<<< [46] <query> 1,061 us
>>> [47] <query> START TRANSACTION
<<< [47] <query> 117 us
>>> [48] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-ivxtdz7edth2lnv' 
<<< [48] <query> 224 us
>>> [49] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 109
<<< [49] <query> 202 us
>>> [50] <query> COMMIT
<<< [50] <query> 245 us
>>> [51] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-ivxtdz7edth2lnv' 
<<< [51] <query> 195 us
>>> [52] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-ivxtdz7edth2lnv'
<<< [52] <query> 138 us
>>> [53] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-ivxtdz7edth2lnv' 
<<< [53] <query> 173 us
>>> [54] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-ivxtdz7edth2lnv' 
<<< [54] <query> 155 us
>>> [55] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-dkf6gfyacmjaxph', NULL, '1436884072')
<<< [55] <query> 293 us
>>> [56] <query> START TRANSACTION
<<< [56] <query> 100 us
>>> [57] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-dkf6gfyacmjaxph' 
<<< [57] <query> 213 us
>>> [58] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 110
<<< [58] <query> 182 us
>>> [59] <query> COMMIT
<<< [59] <query> 180 us
>>> [60] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-dkf6gfyacmjaxph' 
<<< [60] <query> 174 us
>>> [61] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-dkf6gfyacmjaxph'
<<< [61] <query> 122 us
>>> [62] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-dkf6gfyacmjaxph' 
<<< [62] <query> 156 us
>>> [63] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-dkf6gfyacmjaxph' 
<<< [63] <query> 154 us
>>> [64] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-5koph2jiggajkjv', NULL, '1436884072')
<<< [64] <query> 241 us
>>> [65] <query> START TRANSACTION
<<< [65] <query> 72 us
>>> [66] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-5koph2jiggajkjv' 
<<< [66] <query> 140 us
>>> [67] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 111
<<< [67] <query> 124 us
>>> [68] <query> COMMIT
<<< [68] <query> 392 us
>>> [69] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-5koph2jiggajkjv' 
<<< [69] <query> 154 us
>>> [70] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-5koph2jiggajkjv'
<<< [70] <query> 116 us
>>> [71] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-5koph2jiggajkjv' 
<<< [71] <query> 154 us
>>> [72] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-5koph2jiggajkjv' 
<<< [72] <query> 179 us
>>> [73] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-ggihquvzjrqaolf', NULL, '1436884072')
<<< [73] <query> 227 us
>>> [74] <query> START TRANSACTION
<<< [74] <query> 67 us
>>> [75] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-ggihquvzjrqaolf' 
<<< [75] <query> 148 us
>>> [76] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 112
<<< [76] <query> 123 us
>>> [77] <query> COMMIT
<<< [77] <query> 164 us
>>> [78] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-ggihquvzjrqaolf' 
<<< [78] <query> 150 us
>>> [79] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-ggihquvzjrqaolf'
<<< [79] <query> 113 us
>>> [80] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-ggihquvzjrqaolf' 
<<< [80] <query> 157 us
>>> [81] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-ggihquvzjrqaolf' 
<<< [81] <query> 151 us
>>> [82] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-2lmb3td3rmrxqcy', NULL, '1436884072')
<<< [82] <query> 220 us
>>> [83] <query> START TRANSACTION
<<< [83] <query> 74 us
>>> [84] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-2lmb3td3rmrxqcy' 
<<< [84] <query> 149 us
>>> [85] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransactionComment', '175', 'PHID-XCMT-d6l5a3yp7eharqypshv6', NULL, '1436884072')
<<< [85] <query> 221 us
>>> [86] <query> SAVEPOINT Aphront_Savepoint_1
<<< [86] <query> 96 us
>>> [87] <query> DELETE FROM `maniphest_transaction_comment` WHERE `id` = 33
<<< [87] <query> 135 us
>>> [88] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XCMT-d6l5a3yp7eharqypshv6' 
<<< [88] <query> 148 us
>>> [89] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XCMT-d6l5a3yp7eharqypshv6'
<<< [89] <query> 113 us
>>> [90] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XCMT-d6l5a3yp7eharqypshv6' 
<<< [90] <query> 148 us
>>> [91] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XCMT-d6l5a3yp7eharqypshv6' 
<<< [91] <query> 144 us
>>> [92] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 113
<<< [92] <query> 123 us
>>> [93] <query> COMMIT
<<< [93] <query> 170 us
>>> [94] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-2lmb3td3rmrxqcy' 
<<< [94] <query> 143 us
>>> [95] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-2lmb3td3rmrxqcy'
<<< [95] <query> 110 us
>>> [96] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-2lmb3td3rmrxqcy' 
<<< [96] <query> 144 us
>>> [97] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-2lmb3td3rmrxqcy' 
<<< [97] <query> 144 us
>>> [98] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-x4hqcz6maam3gdk', NULL, '1436884072')
<<< [98] <query> 227 us
>>> [99] <query> START TRANSACTION
<<< [99] <query> 71 us
>>> [100] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-x4hqcz6maam3gdk' 
<<< [100] <query> 134 us
>>> [101] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 362
<<< [101] <query> 143 us
>>> [102] <query> COMMIT
<<< [102] <query> 169 us
>>> [103] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-x4hqcz6maam3gdk' 
<<< [103] <query> 149 us
>>> [104] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-x4hqcz6maam3gdk'
<<< [104] <query> 113 us
>>> [105] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-x4hqcz6maam3gdk' 
<<< [105] <query> 154 us
>>> [106] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-x4hqcz6maam3gdk' 
<<< [106] <query> 157 us
>>> [107] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-qwjew72mplfvjqf', NULL, '1436884072')
<<< [107] <query> 236 us
>>> [108] <query> START TRANSACTION
<<< [108] <query> 69 us
>>> [109] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-qwjew72mplfvjqf' 
<<< [109] <query> 140 us
>>> [110] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 458
<<< [110] <query> 147 us
>>> [111] <query> COMMIT
<<< [111] <query> 227 us
>>> [112] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-qwjew72mplfvjqf' 
<<< [112] <query> 149 us
>>> [113] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-qwjew72mplfvjqf'
<<< [113] <query> 116 us
>>> [114] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-qwjew72mplfvjqf' 
<<< [114] <query> 154 us
>>> [115] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-qwjew72mplfvjqf' 
<<< [115] <query> 140 us
>>> [116] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-ne2wcjvrpzb7ngf', NULL, '1436884072')
<<< [116] <query> 221 us
>>> [117] <query> START TRANSACTION
<<< [117] <query> 67 us
>>> [118] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-ne2wcjvrpzb7ngf' 
<<< [118] <query> 140 us
>>> [119] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 472
<<< [119] <query> 142 us
>>> [120] <query> COMMIT
<<< [120] <query> 218 us
>>> [121] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-ne2wcjvrpzb7ngf' 
<<< [121] <query> 153 us
>>> [122] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-ne2wcjvrpzb7ngf'
<<< [122] <query> 114 us
>>> [123] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-ne2wcjvrpzb7ngf' 
<<< [123] <query> 151 us
>>> [124] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-ne2wcjvrpzb7ngf' 
<<< [124] <query> 149 us
>>> [125] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-h2gxcsya7wlazft', NULL, '1436884072')
<<< [125] <query> 231 us
>>> [126] <query> START TRANSACTION
<<< [126] <query> 70 us
>>> [127] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-h2gxcsya7wlazft' 
<<< [127] <query> 138 us
>>> [128] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 979
<<< [128] <query> 1,088 us
>>> [129] <query> COMMIT
<<< [129] <query> 402 us
>>> [130] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-h2gxcsya7wlazft' 
<<< [130] <query> 166 us
>>> [131] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-h2gxcsya7wlazft'
<<< [131] <query> 123 us
>>> [132] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-h2gxcsya7wlazft' 
<<< [132] <query> 180 us
>>> [133] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-h2gxcsya7wlazft' 
<<< [133] <query> 145 us
>>> [134] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-u34aqunxgvnjicm', NULL, '1436884072')
<<< [134] <query> 228 us
>>> [135] <query> START TRANSACTION
<<< [135] <query> 75 us
>>> [136] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-u34aqunxgvnjicm' 
<<< [136] <query> 157 us
>>> [137] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransactionComment', '175', 'PHID-XCMT-rx75cyifiyjunqzgbczz', NULL, '1436884072')
<<< [137] <query> 247 us
>>> [138] <query> SAVEPOINT Aphront_Savepoint_1
<<< [138] <query> 65 us
>>> [139] <query> DELETE FROM `maniphest_transaction_comment` WHERE `id` = 134
<<< [139] <query> 127 us
>>> [140] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XCMT-rx75cyifiyjunqzgbczz' 
<<< [140] <query> 151 us
>>> [141] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XCMT-rx75cyifiyjunqzgbczz'
<<< [141] <query> 118 us
>>> [142] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XCMT-rx75cyifiyjunqzgbczz' 
<<< [142] <query> 154 us
>>> [143] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XCMT-rx75cyifiyjunqzgbczz' 
<<< [143] <query> 153 us
>>> [144] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 989
<<< [144] <query> 120 us
>>> [145] <query> COMMIT
<<< [145] <query> 170 us
>>> [146] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-u34aqunxgvnjicm' 
<<< [146] <query> 155 us
>>> [147] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-u34aqunxgvnjicm'
<<< [147] <query> 113 us
>>> [148] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-u34aqunxgvnjicm' 
<<< [148] <query> 165 us
>>> [149] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-u34aqunxgvnjicm' 
<<< [149] <query> 148 us
>>> [150] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-do4qumbteffbtox', NULL, '1436884072')
<<< [150] <query> 223 us
>>> [151] <query> START TRANSACTION
<<< [151] <query> 70 us
>>> [152] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-do4qumbteffbtox' 
<<< [152] <query> 160 us
>>> [153] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransactionComment', '175', 'PHID-XCMT-m6ilk2cfwopumsr5liwn', NULL, '1436884072')
<<< [153] <query> 231 us
>>> [154] <query> SAVEPOINT Aphront_Savepoint_1
<<< [154] <query> 66 us
>>> [155] <query> DELETE FROM `maniphest_transaction_comment` WHERE `id` = 136
<<< [155] <query> 113 us
>>> [156] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XCMT-m6ilk2cfwopumsr5liwn' 
<<< [156] <query> 136 us
>>> [157] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XCMT-m6ilk2cfwopumsr5liwn'
<<< [157] <query> 109 us
>>> [158] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XCMT-m6ilk2cfwopumsr5liwn' 
<<< [158] <query> 155 us
>>> [159] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XCMT-m6ilk2cfwopumsr5liwn' 
<<< [159] <query> 152 us
>>> [160] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 991
<<< [160] <query> 127 us
>>> [161] <query> COMMIT
<<< [161] <query> 167 us
>>> [162] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-do4qumbteffbtox' 
<<< [162] <query> 149 us
>>> [163] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-do4qumbteffbtox'
<<< [163] <query> 108 us
>>> [164] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-do4qumbteffbtox' 
<<< [164] <query> 160 us
>>> [165] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-do4qumbteffbtox' 
<<< [165] <query> 152 us
>>> [166] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-2njzrxl2bhxg473', NULL, '1436884072')
<<< [166] <query> 275 us
>>> [167] <query> START TRANSACTION
<<< [167] <query> 87 us
>>> [168] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-2njzrxl2bhxg473' 
<<< [168] <query> 202 us
>>> [169] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransactionComment', '175', 'PHID-XCMT-buybicnfmzizss2o3vvw', NULL, '1436884072')
<<< [169] <query> 248 us
>>> [170] <query> SAVEPOINT Aphront_Savepoint_1
<<< [170] <query> 75 us
>>> [171] <query> DELETE FROM `maniphest_transaction_comment` WHERE `id` = 138
<<< [171] <query> 133 us
>>> [172] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XCMT-buybicnfmzizss2o3vvw' 
<<< [172] <query> 177 us
>>> [173] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XCMT-buybicnfmzizss2o3vvw'
<<< [173] <query> 121 us
>>> [174] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XCMT-buybicnfmzizss2o3vvw' 
<<< [174] <query> 164 us
>>> [175] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XCMT-buybicnfmzizss2o3vvw' 
<<< [175] <query> 152 us
>>> [176] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 993
<<< [176] <query> 125 us
>>> [177] <query> COMMIT
<<< [177] <query> 171 us
>>> [178] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-2njzrxl2bhxg473' 
<<< [178] <query> 153 us
>>> [179] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-2njzrxl2bhxg473'
<<< [179] <query> 117 us
>>> [180] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-2njzrxl2bhxg473' 
<<< [180] <query> 154 us
>>> [181] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-2njzrxl2bhxg473' 
<<< [181] <query> 147 us
>>> [182] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-jbxjaunykmwso3z', NULL, '1436884072')
<<< [182] <query> 396 us
>>> [183] <query> START TRANSACTION
<<< [183] <query> 66 us
>>> [184] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-jbxjaunykmwso3z' 
<<< [184] <query> 152 us
>>> [185] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransactionComment', '175', 'PHID-XCMT-tiz73fgbaydnmhuo2hr7', NULL, '1436884072')
<<< [185] <query> 203 us
>>> [186] <query> SAVEPOINT Aphront_Savepoint_1
<<< [186] <query> 89 us
>>> [187] <query> DELETE FROM `maniphest_transaction_comment` WHERE `id` = 203
<<< [187] <query> 136 us
>>> [188] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XCMT-tiz73fgbaydnmhuo2hr7' 
<<< [188] <query> 194 us
>>> [189] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XCMT-tiz73fgbaydnmhuo2hr7'
<<< [189] <query> 125 us
>>> [190] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XCMT-tiz73fgbaydnmhuo2hr7' 
<<< [190] <query> 197 us
>>> [191] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XCMT-tiz73fgbaydnmhuo2hr7' 
<<< [191] <query> 190 us
>>> [192] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 1074
<<< [192] <query> 159 us
>>> [193] <query> COMMIT
<<< [193] <query> 169 us
>>> [194] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-jbxjaunykmwso3z' 
<<< [194] <query> 160 us
>>> [195] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-jbxjaunykmwso3z'
<<< [195] <query> 116 us
>>> [196] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-jbxjaunykmwso3z' 
<<< [196] <query> 149 us
>>> [197] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-jbxjaunykmwso3z' 
<<< [197] <query> 152 us
>>> [198] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransaction', '175', 'PHID-XACT-TASK-wcv7wcctfjmid6z', NULL, '1436884072')
<<< [198] <query> 224 us
>>> [199] <query> START TRANSACTION
<<< [199] <query> 71 us
>>> [200] <query> SELECT * FROM `maniphest_transaction_comment` WHERE transactionPHID = 'PHID-XACT-TASK-wcv7wcctfjmid6z' 
<<< [200] <query> 140 us
>>> [201] <query> INSERT INTO `system_destructionlog` (`objectClass`, `rootLogID`, `objectPHID`, `objectMonogram`, `epoch`) VALUES ('ManiphestTransactionComment', '175', 'PHID-XCMT-pqrwqbiedlirq7xu5kj3', NULL, '1436884072')
<<< [201] <query> 221 us
>>> [202] <query> SAVEPOINT Aphront_Savepoint_1
<<< [202] <query> 66 us
>>> [203] <query> DELETE FROM `maniphest_transaction_comment` WHERE `id` = 272
<<< [203] <query> 114 us
>>> [204] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XCMT-pqrwqbiedlirq7xu5kj3' 
<<< [204] <query> 133 us
>>> [205] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XCMT-pqrwqbiedlirq7xu5kj3'
<<< [205] <query> 97 us
>>> [206] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XCMT-pqrwqbiedlirq7xu5kj3' 
<<< [206] <query> 132 us
>>> [207] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XCMT-pqrwqbiedlirq7xu5kj3' 
<<< [207] <query> 144 us
>>> [208] <query> DELETE FROM `maniphest_transaction` WHERE `id` = 1143
<<< [208] <query> 133 us
>>> [209] <query> COMMIT
<<< [209] <query> 196 us
>>> [210] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-XACT-TASK-wcv7wcctfjmid6z' 
<<< [210] <query> 149 us
>>> [211] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-XACT-TASK-wcv7wcctfjmid6z'
<<< [211] <query> 114 us
>>> [212] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-XACT-TASK-wcv7wcctfjmid6z' 
<<< [212] <query> 150 us
>>> [213] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-XACT-TASK-wcv7wcctfjmid6z' 
<<< [213] <query> 146 us
>>> [214] <query> SELECT * FROM `worker_activetask` WHERE objectPHID = 'PHID-TASK-i2bocsccycxyfznr7nnb' 
<<< [214] <query> 146 us
>>> [215] <query> DELETE FROM `feed_storynotification` WHERE primaryObjectPHID = 'PHID-TASK-i2bocsccycxyfznr7nnb'
<<< [215] <query> 1,641 us
>>> [216] <query> SELECT * FROM `herald_transcript` WHERE objectPHID = 'PHID-TASK-i2bocsccycxyfznr7nnb' 
<<< [216] <query> 260 us
>>> [217] <connect> local_herald
<<< [217] <connect> 383 us
>>> [218] <query> START TRANSACTION
<<< [218] <query> 84 us
>>> [219] <query> DELETE FROM `herald_transcript` WHERE `id` = 85
<<< [219] <query> 195 us
>>> [220] <query> COMMIT
<<< [220] <query> 183 us
>>> [221] <query> START TRANSACTION
<<< [221] <query> 64 us
>>> [222] <query> DELETE FROM `herald_transcript` WHERE `id` = 92
<<< [222] <query> 121 us
>>> [223] <query> COMMIT
<<< [223] <query> 386 us
>>> [224] <query> START TRANSACTION
<<< [224] <query> 65 us
>>> [225] <query> DELETE FROM `herald_transcript` WHERE `id` = 94
<<< [225] <query> 129 us
>>> [226] <query> COMMIT
<<< [226] <query> 211 us
>>> [227] <query> START TRANSACTION
<<< [227] <query> 68 us
>>> [228] <query> DELETE FROM `herald_transcript` WHERE `id` = 96
<<< [228] <query> 133 us
>>> [229] <query> COMMIT
<<< [229] <query> 172 us
>>> [230] <query> START TRANSACTION
<<< [230] <query> 72 us
>>> [231] <query> DELETE FROM `herald_transcript` WHERE `id` = 161
<<< [231] <query> 133 us
>>> [232] <query> COMMIT
<<< [232] <query> 172 us
>>> [233] <query> START TRANSACTION
<<< [233] <query> 66 us
>>> [234] <query> DELETE FROM `herald_transcript` WHERE `id` = 230
<<< [234] <query> 128 us
>>> [235] <query> COMMIT
<<< [235] <query> 184 us
>>> [236] <query> SELECT * FROM `flag` WHERE objectPHID = 'PHID-TASK-i2bocsccycxyfznr7nnb' 
<<< [236] <query> 464 us
>>> [237] <query> SELECT * FROM `flag` WHERE ownerPHID = 'PHID-TASK-i2bocsccycxyfznr7nnb' 
<<< [237] <query> 165 us
>>> [238] <connect> local_token
<<< [238] <connect> 367 us
>>> [239] <query> SELECT * FROM `token_given` WHERE objectPHID = 'PHID-TASK-i2bocsccycxyfznr7nnb' 
<<< [239] <query> 164 us
Permanently destroyed 1 object(s).

Notably, edges are destroyed:

>>> [15] <query> DELETE FROM `edge` WHERE ((src = 'PHID-TASK-i2bocsccycxyfznr7nnb' AND type = 38 AND dst = 'PHID-MOCK-4sxfq4tjz7px3v6gjkcj') OR (src = 'PHID-TASK-i2bocsccycxyfznr7nnb' AND type = 21 AND dst = 'PHID-USER-cvfydnwadpdj7vdon36z'))
...
>>> [17] <query> DELETE FROM `edge` WHERE ((src = 'PHID-MOCK-4sxfq4tjz7px3v6gjkcj' AND type = 37 AND dst = 'PHID-TASK-i2bocsccycxyfznr7nnb'))
...
>>> [19] <query> DELETE FROM `edge` WHERE ((src = 'PHID-USER-cvfydnwadpdj7vdon36z' AND type = 22 AND dst = 'PHID-TASK-i2bocsccycxyfznr7nnb'))
epriestley removed a mock: Restricted Pholio Mock.Jul 15 2015, 5:13 PM

Sorry, I spoke without actually knowing for sure what bin/remove destroy does. I was guessing based on the warning text ("Destroying objects may cause related objects to stop working, and may leave scattered references to objects which no longer exist.") that it would leave dangling edges.

What we really meant to ask is:

  • @epriestley: The warning says "and the Phabricator upstream will not help you fix them." Is there a way to permanently delete an object and its edges that is supported by upstream, such that you will help us if things go south?
  • @ryanseu: Can you please comment with your use case, and what guarantees you need from whatever method you use? That will help Evan in telling us what our options are.

Hey @jhurwitz @epriestley: sorry about the late response.

Sometimes engineers accidentally put in sensitive data in phabricator that violates legal compliance (think PII data) or NDA agreement (think security intel data). While view policy can limit who can view the task, we need to do better due diligence around removing it from the DB as administrators may still have access, not to mention that some of the sensitive info may be contained in the title itself or other metadata.

We fully recognize that removing the node from the DB itself does not scrub the data from the disk but that's outside of phabricator's scope.

Thanks for the comment! @epriestley, with that in mind, is bin/remove destroy our best option? Will we be able to receive upstream support if this command causes issues?

This comment was removed by epriestley.

Whoops, that's half a draft. Ignore that, I'll write a proper version...

It is difficult to concisely communicate what bin/remove destroy does.

The message specifically says:

These tattered edges are an expected consquence of destroying objects, and the Phabricator upstream will not help you fix them.

We'll help you fix anything that's actually broken, we just aren't going to help you fix the "tattered edges" that result from destroying objects.

Let me give you a couple of examples:

  • By the time you destroy an object, we've probably already sent mail about it. This mail may include links to the object. Obviously, we can't undo that. This is a "tattered edge".
  • If you have a task which is "Visible To: Members of Project X", and you destroy "Project X", we can't fix the policy (we have no idea what it "should" be, or what your intent or expectation are). We can't safely set it to the default, because it might be more open than the old policy, and leak data. The only thing we can do is lock it down and fail the policy unconditionally. This causes the task to "stop working", since all users will fail the visibility check. This is a "tattered edge".
  • Likewise, if you have a revision which belongs to "Repository R", and you destroy "Repository R", we can't fix the relationship and we can't open the revision up. We have to lock it down and do an unconditional policy failure here, too. This causes the revision to "stop working", leaving a "tattered edge".
  • If you had remarkup which referenced T123 or {T123}, we can't do much about it. This is a "tattered edge".
  • If you had Herald rules which used things, same deal.
  • Etc, etc. Objects are highly interconnected and in many cases there is no reasonable way for us to mutate something which interacted with an object in a way that both removes all traces of the object and isn't dangerous/surprising/unexpected. We try to fail into a safe state, which often means "breaking" objects.

In almost all of these cases, I think the things we do are the only reasonable things we can do, and I think these behaviors are usually the expected ones after careful thought, but users frequently do not think through the consequences of running bin/remove destroy on complex objects before running it. I've gradually increased the severity of the warning over time to try to set expectations better.

bin/remove destroy is as safe as possible, given that it destroys data, but there is no way to safely destroy complex, highly-interconnected objects without causing side effects which may be surprising or unexpected.

Tasks are usually not very complex or interconnected, and destroying them generally does not have surprising side effects. However, this is likely not very effective at scrubbing PII/NDA data: we've probably already sent mail, called feed hooks, published events, invoked Harbormaster, etc., by the time you destroy an object, and are powerless to remove the data from the remote systems.

You can currently write Herald rules to block diffs and pushes before they're committed to disk. As redaction capabilities, these are primary intended to prevent users from committing API keys, but they might be usable in some cases to prevent PII from being accepted and stored or published. It would also be reasonable to an equivalent action to tasks (e.g., block task creation if body matches regexp), although I'm not sure this would be helpful. Maybe there's a way to tag PII in your environment?

Philosophically, I think the correct approach to this problem (at least, the PII side of it) to limit access to PII aggressively. I'm not sure what the nature of the disclosures you've encountered is or if this is practical, but preventing damage is obviously better than trying to put the milk back in the carton.

Put another way, there is no scenario where running bin/remove destroy is desirable:

  • If you're redacting data, you're probably already too late. Your system or process failed somewhere up the chain.
  • If you're removing test data, you should have been testing in a test environment.
  • If you're reissuing usernames, a thousand curses upon your house.

Sometimes running it is less bad than not running it, but this command is not bin/time rewind and that's what essentially everyone who runs it wants. We obviously can't write that command, and you should not expect that bin/remove destroy is equivalent to bin/time rewind.

I plan to try to collect the above into documentation to try to better explain this, but I don't think that has any specific impact on anyone. I don't plan to make any behavioral changes. I'm open to suggestions here, but we can't write a bin/time rewind and can not fully redact data which has been committed to the system and published to email and other external channels.

It's as safe as possible to redact tasks with bin/remove destroy.