Page MenuHomePhabricator

Limit the damage that degenerate project name typeahead queries can cause
ClosedPublic

Authored by epriestley on Aug 30 2017, 6:22 PM.
Tags
None
Referenced Files
F14083350: D18506.id44441.diff
Sat, Nov 23, 3:58 AM
F14080072: D18506.diff
Fri, Nov 22, 11:24 AM
Unknown Object (File)
Mon, Nov 18, 10:21 AM
Unknown Object (File)
Thu, Nov 14, 9:31 AM
Unknown Object (File)
Sat, Nov 9, 11:24 PM
Unknown Object (File)
Wed, Nov 6, 4:50 AM
Unknown Object (File)
Oct 19 2024, 3:37 PM
Unknown Object (File)
Oct 19 2024, 4:07 AM
Subscribers
None

Details

Summary

See PHI47. When users copy/paste a wall of text into a project tokenizer, we can end up performing a very large number of JOINs.

These JOINs seem okay locally and on secure, but the install in PHI47 reports hitting issues.

Since these queries are almost certainly illegitimate (I think no one uses 5+ words to find a project), just limit the search to the 5 longest tokens.

Note that typing 6 tokens will still almost always work, since the UI does additional filtering. However, if you have 100+ projects named "a b c d e ..." and search for "a b c d e z", you may not hit it. This is so degenerate that it's hard to imagine any users encountering it.

This is a stopgap fix, I'll file something longer-term as a followup.

Test Plan

Used /typeahead/class/PhabricatorProjectDatasource/ to run queries. Saw the same results with shorter query plans for all reasonable queries.

Diff Detail

Repository
rP Phabricator
Branch
token1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 18225
Build 24512: Run Core Tests
Build 24511: arc lint + arc unit