Skip to content

Commit

Permalink
optimized log modification recording
Browse files Browse the repository at this point in the history
  • Loading branch information
following5 committed Feb 2, 2016
1 parent d63c4f8 commit 31139ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions bin/dbsv-update.php
Expand Up @@ -717,6 +717,16 @@ function dbv_144() // add log versioning to allow log vandalism restore
}
}

function dbv_145() // optimize log change recording
{
sql("ALTER TABLE `cache_logs_modified` DROP INDEX `id`,
ADD UNIQUE INDEX `id` (`id`, `modify_date`)");
sql("ALTER TABLE `cache_logs_modified` MODIFY `modify_date` date default NULL");
// This may produce an error for duplicate dates.
// You may just delete the old `cache_logs_modified` contents
// (the feature was started just a few days befor this change).
}


// When adding new mutations, take care that they behave well if run multiple
// times. This improves robustness of database versioning.
Expand Down
2 changes: 1 addition & 1 deletion htdocs/doc/sql/stored-proc/maintain-current.inc.php
Expand Up @@ -1124,7 +1124,7 @@
* optimize storage space by ignoring quick-corrections of logs
*/
IF DATEDIFF(NOW(), OLD.`date_created`) > 1 THEN
INSERT INTO `cache_logs_modified`
INSERT IGNORE INTO `cache_logs_modified`
(`id`, `uuid`, `node`, `date_created`, `last_modified`, `log_last_modified`,
`cache_id`, `user_id`, `type`, `oc_team_comment`, `date`,
`text`, `text_html`, `modify_date`)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/doc/sql/tables/cache_logs_modified.sql
Expand Up @@ -15,5 +15,5 @@ CREATE TABLE `cache_logs_modified` (
`text` mediumtext NOT NULL,
`text_html` tinyint(1) NOT NULL,
`modify_date` datetime default NULL,
KEY `id` (`id`, `modify_date`)
UNIQUE `id` (`id`, `modify_date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

0 comments on commit 31139ec

Please sign in to comment.