Don't waste too much cache by a single changeset
Summary: We have `max_allowed_packet` 1 GiB but our replication dies if the query is longer than unknown value (it dies with 293 MB long query). Anyway, there's no reason why we should not save the cache if you have small `max_allowed_packet`. Test Plan: Lowered `$size` to 100, deleted cache from DB, displayed changeset, verified issued queries in DarkConsole, verified DB. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3390
This commit is contained in:
@@ -61,6 +61,7 @@ final class DifferentialChangesetParser {
|
||||
private $highlightErrors;
|
||||
|
||||
const CACHE_VERSION = 6;
|
||||
const CACHE_MAX_SIZE = 8e6;
|
||||
|
||||
const ATTR_GENERATED = 'attr:generated';
|
||||
const ATTR_DELETED = 'attr:deleted';
|
||||
@@ -746,6 +747,11 @@ final class DifferentialChangesetParser {
|
||||
}
|
||||
$cache = json_encode($cache);
|
||||
|
||||
// We don't want to waste too much space by a single changeset.
|
||||
if (strlen($cache) > self::CACHE_MAX_SIZE) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$changeset = new DifferentialChangeset();
|
||||
$conn_w = $changeset->establishConnection('w');
|
||||
|
||||
Reference in New Issue
Block a user