1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

Fix binary/utf8 issues with Differential changeset parse cache

Summary:
Fixes T4898. After we increased the strictness of the `%s` conversion, most `serialize()` output is rejected from the cache.

Drop the cache, change the column type to latin1_bin, and then use `%B` to mark the data as binary during query construction.

Test Plan: Viewed Differential, saw cache fills.

Reviewers: btrahan, spicyj

Reviewed By: spicyj

Subscribers: epriestley

Maniphest Tasks: T4898

Differential Revision: https://secure.phabricator.com/D9171
This commit is contained in:
epriestley 2014-05-17 16:34:13 -07:00
parent a74545c9da
commit d744d5d859
2 changed files with 9 additions and 8 deletions

View file

@ -0,0 +1,4 @@
TRUNCATE {$NAMESPACE}_differential.differential_changeset_parse_cache;
ALTER TABLE {$NAMESPACE}_differential.differential_changeset_parse_cache
CHANGE cache cache LONGTEXT COLLATE latin1_bin NOT NULL;

View file

@ -352,22 +352,19 @@ final class DifferentialChangesetParser {
return;
}
try {
$changeset = new DifferentialChangeset();
$conn_w = $changeset->establishConnection('w');
$changeset = new DifferentialChangeset();
$conn_w = $changeset->establishConnection('w');
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
queryfx(
$conn_w,
'INSERT INTO %T (id, cache, dateCreated) VALUES (%d, %s, %d)
'INSERT INTO %T (id, cache, dateCreated) VALUES (%d, %B, %d)
ON DUPLICATE KEY UPDATE cache = VALUES(cache)',
DifferentialChangeset::TABLE_CACHE,
$render_cache_key,
$cache,
time());
} catch (AphrontQueryException $ex) {
// TODO: uhoh
}
unset($unguarded);
}
private function markGenerated($new_corpus_block = '') {