blob: 9f5a65a377db43da6836aac32b0a37b947eb0c75 [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 CopyCommentToCommentContent;
9
10delimiter //
11
12CREATE PROCEDURE CopyCommentToCommentContent(
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 INSERT INTO CommentContent (comment_id, content, inbound_message)
27 SELECT id, content, inbound_message
28 FROM Comment
29 WHERE Comment.id >= in_start
30 AND Comment.id < in_start + in_step;
31
32 SET in_start = in_start + in_step;
33
34 END LOOP;
35
36END;
37
38
39//
40
41
42delimiter ;
43
44
45-- Copy and paste these individually and verify that the site is still responsive.
46-- the first one, takes about 30 sec, then 4-7 minutes for each of the rest.
47-- CALL CopyCommentToCommentContent( 0, 13 * 1000000, 10000);
48-- CALL CopyCommentToCommentContent(13 * 1000000, 16 * 1000000, 10000);
49-- CALL CopyCommentToCommentContent(16 * 1000000, 17 * 1000000, 10000);
50-- CALL CopyCommentToCommentContent(17 * 1000000, 18 * 1000000, 10000);
51-- CALL CopyCommentToCommentContent(18 * 1000000, 19 * 1000000, 10000);
52-- CALL CopyCommentToCommentContent(19 * 1000000, 20 * 1000000, 10000);
53-- CALL CopyCommentToCommentContent(20 * 1000000, 21 * 1000000, 10000);
54-- CALL CopyCommentToCommentContent(21 * 1000000, 22 * 1000000, 10000);
55-- CALL CopyCommentToCommentContent(22 * 1000000, 23 * 1000000, 10000);
56-- CALL CopyCommentToCommentContent(23 * 1000000, 24 * 1000000, 10000);
57-- CALL CopyCommentToCommentContent(24 * 1000000, 25 * 1000000, 10000);
58-- CALL CopyCommentToCommentContent(25 * 1000000, 26 * 1000000, 10000);
59-- CALL CopyCommentToCommentContent(26 * 1000000, 27 * 1000000, 10000);
60-- CALL CopyCommentToCommentContent(27 * 1000000, 28 * 1000000, 10000);
61-- CALL CopyCommentToCommentContent(28 * 1000000, 29 * 1000000, 10000);
62-- CALL CopyCommentToCommentContent(29 * 1000000, 30 * 1000000, 10000);
63-- CALL CopyCommentToCommentContent(30 * 1000000, 40 * 1000000, 10000);