Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/internal/Magento/Framework/Mview/View/Changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down