blob: ae97db3eae8bcbe1cab7733194fd56661e0f68fa [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001-- Copyright 2016 The Chromium Authors. All Rights Reserved.
2--
3-- Use of this source code is governed by a BSD-style
4-- license that can be found in the LICENSE file or at
5-- https://developers.google.com/open-source/licenses/bsd
6
7
8DROP PROCEDURE IF EXISTS NullCommentTableStrings;
9
10delimiter //
11
12CREATE PROCEDURE NullCommentTableStrings(
13 IN in_start INT, IN in_stop INT, IN in_step INT)
14BEGIN
15 comment_loop: LOOP
16 IF in_start >= in_stop THEN
17 LEAVE comment_loop;
18 END IF;
19
20 SELECT in_start AS StartingAt;
21 SELECT count(*)
22 FROM Comment
23 WHERE Comment.id >= in_start
24 AND Comment.id < in_start + in_step;
25
26 UPDATE Comment
27 SET content = NULL, inbound_message = NULL
28 WHERE Comment.id >= in_start
29 AND Comment.id < in_start + in_step;
30
31 SET in_start = in_start + in_step;
32
33 END LOOP;
34
35END;
36
37
38//
39
40
41delimiter ;
42
43
44-- Copy and paste these individually and verify that the site is still responsive.
45-- the first one, takes about 30 sec, then 4-7 minutes for each of the rest.
46-- CALL NullCommentTableStrings( 0, 13 * 1000000, 10000);
47-- CALL NullCommentTableStrings(13 * 1000000, 16 * 1000000, 10000);
48-- CALL NullCommentTableStrings(16 * 1000000, 17 * 1000000, 10000);
49-- CALL NullCommentTableStrings(17 * 1000000, 18 * 1000000, 10000);
50-- CALL NullCommentTableStrings(18 * 1000000, 19 * 1000000, 10000);
51-- CALL NullCommentTableStrings(19 * 1000000, 20 * 1000000, 10000);
52-- CALL NullCommentTableStrings(20 * 1000000, 21 * 1000000, 10000);
53-- CALL NullCommentTableStrings(21 * 1000000, 22 * 1000000, 10000);
54-- CALL NullCommentTableStrings(22 * 1000000, 23 * 1000000, 10000);
55-- CALL NullCommentTableStrings(23 * 1000000, 24 * 1000000, 10000);
56-- CALL NullCommentTableStrings(24 * 1000000, 25 * 1000000, 10000);
57-- CALL NullCommentTableStrings(25 * 1000000, 26 * 1000000, 10000);
58-- CALL NullCommentTableStrings(26 * 1000000, 27 * 1000000, 10000);
59-- CALL NullCommentTableStrings(27 * 1000000, 28 * 1000000, 10000);
60-- CALL NullCommentTableStrings(28 * 1000000, 29 * 1000000, 10000);
61-- CALL NullCommentTableStrings(29 * 1000000, 30 * 1000000, 10000);
62-- CALL NullCommentTableStrings(30 * 1000000, 40 * 1000000, 10000);