Skip to content

Commit

Permalink
[HOY-418] Reindexing by schedule - never delete all changelog rows
Browse files Browse the repository at this point in the history
  • Loading branch information
unicoder88 committed Feb 12, 2018
1 parent 3b8301a commit 9459eb8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Patch-Magento_Framework-mview-changelog-increment.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- a/Mview/View/Changelog.php
+++ b/Mview/View/Changelog.php
@@ -121,7 +121,15 @@ public function clear($versionId)
throw new ChangelogTableNotExistsException(new Phrase("Table %1 does not exist", [$changelogTableName]));
}

- $this->connection->delete($changelogTableName, ['version_id <= ?' => (int)$versionId]);
+ // It's important we don't clear the latest value in the table.
+ // On restart, common versions of MySQL will reset the increment_id.
+ // This can be removed once the minimum requirements are raised to:
+ // * MySQL/Percona 8.0
+ // * MariaDB 10.2.3
+ $latestVersionId = $this->getVersion();
+ $deleteVersionId = $versionId >= $latestVersionId ? $latestVersionId - 1 : $versionId;
+
+ $this->connection->delete($changelogTableName, ['version_id <= ?' => (int)$deleteVersionId]);

return true;
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Full example:
"amasty/module-improved-layered-navigation-root": {
"Fix: Remove unnecessary configurable block": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Amasty-ImprovedLayeredNavigationRoot-M2.1.4-block-configurable.patch"
},
"magento/framework": {
"Pull request: https://github.com/magento/magento2/pull/13577": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento_Framework-mview-changelog-increment.patch"
},
"magento/magento2-base": {
"Fix MAGE_DIRS for CLI": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento_Base-cli.patch",
"Fix FotoramaJS for single frame": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento-FotoramaJS-M2.1.0-enable-single-frame.patch",
Expand Down

0 comments on commit 9459eb8

Please sign in to comment.