diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2019-08-27 15:29:53 +0200 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2019-08-30 07:58:33 +0200 |
commit | 739d6a5ad3ac3756d89d6d07fec5fb876aa333d6 (patch) | |
tree | 0e0fe953b5adcc7df1f57ea6dc7dc80e9b4f8392 /danger | |
parent | 770a15b0217a7449da381b6adb5b1dd378903e79 (diff) | |
download | gitlab-ce-739d6a5ad3ac3756d89d6d07fec5fb876aa333d6.tar.gz |
Perform two-step Routable lookup by path
In order to lookup a Project or Namespace by path, we prefer an exact
match (case-sensitive) but in absence of that, we'd also take a
case-insensitive match.
The case-insensitive matching with preference for the exact match is a
bit more involved in SQL as the exact lookup. Yet, the majority of cases
will be an exact match. The thinking here is that we can optimize the
lookup by performing an exact match first and only if there is no
result, we perform the case-insensitive lookup.
Data for GitLab.com:
* We have about 15M records in routes table
* About 2,500 routes exist where there's more than one record
with the same `lower(path)`
It is possible for a user to craft requests that would always trigger
the 2-step search (e.g. we have a route for `/foo/bar`, the request is
always for `/FOO/bar`). In this case, the change at hand is not
beneficial as it would run an additional query.
However, based on the data, it is highly likely that the vast majority
of requests can be satisfied with an exact match only.
The context for this change is
https://gitlab.com/gitlab-org/gitlab-ce/issues/64590#note_208156463.
Diffstat (limited to 'danger')
0 files changed, 0 insertions, 0 deletions