1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00

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:
vrana 2012-08-27 13:08:58 -07:00
parent 5f3dc3b7ae
commit 8b715a64b5

View file

@ -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');