Adrià Vilanova MartÃnez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 1 | -- Copyright 2016 The Chromium Authors |
| 2 | -- Use of this source code is governed by a BSD-style license that can be |
| 3 | -- found in the LICENSE file. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 4 | |
| 5 | |
| 6 | DROP PROCEDURE IF EXISTS CopyCommentToCommentContent; |
| 7 | |
| 8 | delimiter // |
| 9 | |
| 10 | CREATE PROCEDURE CopyCommentToCommentContent( |
| 11 | IN in_start INT, IN in_stop INT, IN in_step INT) |
| 12 | BEGIN |
| 13 | comment_loop: LOOP |
| 14 | IF in_start >= in_stop THEN |
| 15 | LEAVE comment_loop; |
| 16 | END IF; |
| 17 | |
| 18 | SELECT in_start AS StartingAt; |
| 19 | SELECT count(*) |
| 20 | FROM Comment |
| 21 | WHERE Comment.id >= in_start |
| 22 | AND Comment.id < in_start + in_step; |
| 23 | |
| 24 | INSERT INTO CommentContent (comment_id, content, inbound_message) |
| 25 | SELECT id, content, inbound_message |
| 26 | FROM Comment |
| 27 | WHERE Comment.id >= in_start |
| 28 | AND Comment.id < in_start + in_step; |
| 29 | |
| 30 | SET in_start = in_start + in_step; |
| 31 | |
| 32 | END LOOP; |
| 33 | |
| 34 | END; |
| 35 | |
| 36 | |
| 37 | // |
| 38 | |
| 39 | |
| 40 | delimiter ; |
| 41 | |
| 42 | |
| 43 | -- Copy and paste these individually and verify that the site is still responsive. |
| 44 | -- the first one, takes about 30 sec, then 4-7 minutes for each of the rest. |
| 45 | -- CALL CopyCommentToCommentContent( 0, 13 * 1000000, 10000); |
| 46 | -- CALL CopyCommentToCommentContent(13 * 1000000, 16 * 1000000, 10000); |
| 47 | -- CALL CopyCommentToCommentContent(16 * 1000000, 17 * 1000000, 10000); |
| 48 | -- CALL CopyCommentToCommentContent(17 * 1000000, 18 * 1000000, 10000); |
| 49 | -- CALL CopyCommentToCommentContent(18 * 1000000, 19 * 1000000, 10000); |
| 50 | -- CALL CopyCommentToCommentContent(19 * 1000000, 20 * 1000000, 10000); |
| 51 | -- CALL CopyCommentToCommentContent(20 * 1000000, 21 * 1000000, 10000); |
| 52 | -- CALL CopyCommentToCommentContent(21 * 1000000, 22 * 1000000, 10000); |
| 53 | -- CALL CopyCommentToCommentContent(22 * 1000000, 23 * 1000000, 10000); |
| 54 | -- CALL CopyCommentToCommentContent(23 * 1000000, 24 * 1000000, 10000); |
| 55 | -- CALL CopyCommentToCommentContent(24 * 1000000, 25 * 1000000, 10000); |
| 56 | -- CALL CopyCommentToCommentContent(25 * 1000000, 26 * 1000000, 10000); |
| 57 | -- CALL CopyCommentToCommentContent(26 * 1000000, 27 * 1000000, 10000); |
| 58 | -- CALL CopyCommentToCommentContent(27 * 1000000, 28 * 1000000, 10000); |
| 59 | -- CALL CopyCommentToCommentContent(28 * 1000000, 29 * 1000000, 10000); |
| 60 | -- CALL CopyCommentToCommentContent(29 * 1000000, 30 * 1000000, 10000); |
| 61 | -- CALL CopyCommentToCommentContent(30 * 1000000, 40 * 1000000, 10000); |