An error occurred fetching the project authors.
  1. 26 Feb, 2018 1 commit
    • Andreas Brandl's avatar
      Simplify filtering of non-human users (like ghosts). · df55efda
      Andreas Brandl authored
      Note that `ghost IS NOT TRUE` is equivalent to `ghost = 'f' OR ghost is
      null`:
      
      (true), (false), (NULL)) AS t (flag);
       flag | ?column? | ?column?
      ------+----------+----------
       t    | f        | f
       f    | t        | t
            | t        | t
      (3 rows)
      
      This makes it a little easier to create partial indexes for this (as only
      one condition is needed).
      
      Closes #43304.
      df55efda
  2. 22 Feb, 2018 1 commit
    • Yorick Peterse's avatar
      Optimise searching for users using short queries · 41bfe82b
      Yorick Peterse authored
      This optimises searching for users when using queries consisting out of
      one or two characters such as "ab". We optimise such cases by searching
      for `LOWER(name)` and `LOWER(username)` instead of using `ILIKE`. Using
      `LOWER` produces a _much_ better performing query.
      
      For example, when searching for all users matching the term "a" we'd
      produce the following plan:
      
           Limit  (cost=637.69..637.74 rows=20 width=805) (actual time=41.983..41.995 rows=20 loops=1)
             Buffers: shared hit=8330
             ->  Sort  (cost=637.69..638.61 rows=368 width=805) (actual time=41.982..41.990 rows=20 loops=1)
                   Sort Key: (CASE WHEN ((name)::text = 'a'::text) THEN 0 WHEN ((username)::text = 'a'::text) THEN 1 WHEN ((email)::text = 'a'::text) THEN 2 ELSE 3 END), name
                   Sort Method: top-N heapsort  Memory: 35kB
                   Buffers: shared hit=8330
                   ->  Bitmap Heap Scan on users  (cost=75.47..627.89 rows=368 width=805) (actual time=9.452..41.305 rows=277 loops=1)
                         Recheck Cond: (((name)::text ~~* 'a'::text) OR ((username)::text ~~* 'a'::text) OR ((email)::text = 'a'::text))
                         Rows Removed by Index Recheck: 7601
                         Heap Blocks: exact=7636
                         Buffers: shared hit=8327
                         ->  BitmapOr  (cost=75.47..75.47 rows=368 width=0) (actual time=8.290..8.290 rows=0 loops=1)
                               Buffers: shared hit=691
                               ->  Bitmap Index Scan on index_users_on_name_trigram  (cost=0.00..38.85 rows=180 width=0) (actual time=4.369..4.369 rows=4071 loops=1)
                                     Index Cond: ((name)::text ~~* 'a'::text)
                                     Buffers: shared hit=360
                               ->  Bitmap Index Scan on index_users_on_username_trigram  (cost=0.00..34.41 rows=188 width=0) (actual time=3.896..3.896 rows=4140 loops=1)
                                     Index Cond: ((username)::text ~~* 'a'::text)
                                     Buffers: shared hit=328
                               ->  Bitmap Index Scan on users_email_key  (cost=0.00..1.94 rows=1 width=0) (actual time=0.022..0.022 rows=0 loops=1)
                                     Index Cond: ((email)::text = 'a'::text)
                                     Buffers: shared hit=3
           Planning time: 3.912 ms
           Execution time: 42.171 ms
      
      With the changes in this commit we now produce the following plan
      instead:
      
           Limit  (cost=13257.48..13257.53 rows=20 width=805) (actual time=1.567..1.579 rows=20 loops=1)
             Buffers: shared hit=287
             ->  Sort  (cost=13257.48..13280.93 rows=9379 width=805) (actual time=1.567..1.572 rows=20 loops=1)
                   Sort Key: (CASE WHEN ((name)::text = 'a'::text) THEN 0 WHEN ((username)::text = 'a'::text) THEN 1 WHEN ((email)::text = 'a'::text) THEN 2 ELSE 3 END), name
                   Sort Method: top-N heapsort  Memory: 35kB
                   Buffers: shared hit=287
                   ->  Bitmap Heap Scan on users  (cost=135.66..13007.91 rows=9379 width=805) (actual time=0.194..1.107 rows=277 loops=1)
                         Recheck Cond: ((lower((name)::text) = 'a'::text) OR (lower((username)::text) = 'a'::text) OR ((email)::text = 'a'::text))
                         Heap Blocks: exact=277
                         Buffers: shared hit=287
                         ->  BitmapOr  (cost=135.66..135.66 rows=9379 width=0) (actual time=0.152..0.152 rows=0 loops=1)
                               Buffers: shared hit=10
                               ->  Bitmap Index Scan on yorick_test_users  (cost=0.00..124.75 rows=9377 width=0) (actual time=0.101..0.101 rows=277 loops=1)
                                     Index Cond: (lower((name)::text) = 'a'::text)
                                     Buffers: shared hit=4
                               ->  Bitmap Index Scan on index_on_users_lower_username  (cost=0.00..1.94 rows=1 width=0) (actual time=0.035..0.035 rows=1 loops=1)
                                     Index Cond: (lower((username)::text) = 'a'::text)
                                     Buffers: shared hit=3
                               ->  Bitmap Index Scan on users_email_key  (cost=0.00..1.94 rows=1 width=0) (actual time=0.014..0.014 rows=0 loops=1)
                                     Index Cond: ((email)::text = 'a'::text)
                                     Buffers: shared hit=3
           Planning time: 0.303 ms
           Execution time: 1.687 ms
      
      Here we can see the new query is 25 times faster compared to the old
      query.
      41bfe82b
  3. 18 Feb, 2018 1 commit
  4. 13 Feb, 2018 1 commit
    • Peter Lauck's avatar
      Strip whitespace from username/login value for user lookup · eddf4c0f
      Peter Lauck authored
      As per the discussion with @psimyn, this change does not affect the frontend, so user input will not be validated on the signin screen.
      
      Instead, the value sent to the backend has leading and trailing whitespace stripped before looking up the user with find_by.
      
      Closes #42637
      eddf4c0f
  5. 08 Feb, 2018 1 commit
  6. 06 Feb, 2018 3 commits
  7. 05 Feb, 2018 2 commits
  8. 02 Feb, 2018 2 commits
  9. 01 Feb, 2018 1 commit
  10. 31 Jan, 2018 1 commit
  11. 26 Jan, 2018 1 commit
  12. 21 Jan, 2018 1 commit
  13. 15 Jan, 2018 1 commit
  14. 02 Jan, 2018 1 commit
  15. 30 Dec, 2017 1 commit
    • Mario de la Ossa's avatar
      User#projects_limit remove DB default and added NOT NULL constraint · 75cf5f5b
      Mario de la Ossa authored
      This change is required because otherwise if a user is created with a
      value for `projects_limit` that matches the DB default, it gets
      overwritten by `current_application_settings.default_projects_limit`. By
      removing the default we once again can allow a user to be created with a
      limit of 10 projects without the risk that it'll change to 10000
      75cf5f5b
  16. 19 Dec, 2017 1 commit
  17. 15 Dec, 2017 1 commit
  18. 11 Dec, 2017 1 commit
  19. 08 Dec, 2017 2 commits
    • Douwe Maan's avatar
      Merge branch 'bvl-10-2-email-disclosure' into 'security-10-2' · 8c0aa7d4
      Douwe Maan authored
      (10.2) Avoid partial partial email adresses for matching
      
      See merge request gitlab/gitlabhq!2232
      
      (cherry picked from commit 081aa1e91a777c9acb31be4a1e76b3dd7032fa9a)
      
      There are unresolved conflicts in app/models/user.rb.
      
      fa85a3fd Don't allow searching for partial user emails
      8c0aa7d4
    • Brett Walker's avatar
      expire todo count calculations to be consistent with · b2a1919c
      Brett Walker authored
      assigned_open_merge_requests_count and assigned_open_issues_count, which are used in the top header stats.  Also important for a Geo secondary, so that the pending todo stat gets updated on the same frequency as the users open issues/merge requests.
      b2a1919c
  20. 07 Dec, 2017 1 commit
  21. 05 Dec, 2017 1 commit
  22. 04 Dec, 2017 1 commit
  23. 01 Dec, 2017 1 commit
  24. 27 Nov, 2017 1 commit
  25. 24 Nov, 2017 1 commit
  26. 23 Nov, 2017 2 commits
  27. 21 Nov, 2017 1 commit
  28. 17 Nov, 2017 1 commit
  29. 16 Nov, 2017 2 commits
    • Jacopo's avatar
      Adds Rubocop rule for line break after guard clause · 181cd299
      Jacopo authored
      Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
      181cd299
    • Yorick Peterse's avatar
      Cache the number of user SSH keys · 3e561736
      Yorick Peterse authored
      By caching the number of personal SSH keys we reduce the number of
      queries necessary on pages such as ProjectsController#show (which can
      end up querying this data multiple times).
      
      The cache is refreshed/flushed whenever an SSH key is added, removed, or
      when a user is removed.
      3e561736
  30. 14 Nov, 2017 1 commit
  31. 07 Nov, 2017 2 commits
    • Yorick Peterse's avatar
      Rewrite the GitHub importer from scratch · 4dfe26cd
      Yorick Peterse authored
      Prior to this MR there were two GitHub related importers:
      
      * Github::Import: the main importer used for GitHub projects
      * Gitlab::GithubImport: importer that's somewhat confusingly used for
        importing Gitea projects (apparently they have a compatible API)
      
      This MR renames the Gitea importer to Gitlab::LegacyGithubImport and
      introduces a new GitHub importer in the Gitlab::GithubImport namespace.
      This new GitHub importer uses Sidekiq for importing multiple resources
      in parallel, though it also has the ability to import data sequentially
      should this be necessary.
      
      The new code is spread across the following directories:
      
      * lib/gitlab/github_import: this directory contains most of the importer
        code such as the classes used for importing resources.
      * app/workers/gitlab/github_import: this directory contains the Sidekiq
        workers, most of which simply use the code from the directory above.
      * app/workers/concerns/gitlab/github_import: this directory provides a
        few modules that are included in every GitHub importer worker.
      
      == Stages
      
      The import work is divided into separate stages, with each stage
      importing a specific set of data. Stages will schedule the work that
      needs to be performed, followed by scheduling a job for the
      "AdvanceStageWorker" worker. This worker will periodically check if all
      work is completed and schedule the next stage if this is the case. If
      work is not yet completed this worker will reschedule itself.
      
      Using this approach we don't have to block threads by calling `sleep()`,
      as doing so for large projects could block the thread from doing any
      work for many hours.
      
      == Retrying Work
      
      Workers will reschedule themselves whenever necessary. For example,
      hitting the GitHub API's rate limit will result in jobs rescheduling
      themselves. These jobs are not processed until the rate limit has been
      reset.
      
      == User Lookups
      
      Part of the importing process involves looking up user details in the
      GitHub API so we can map them to GitLab users. The old importer used
      an in-memory cache, but this obviously doesn't work when the work is
      spread across different threads.
      
      The new importer uses a Redis cache and makes sure we only perform
      API/database calls if absolutely necessary.  Frequently used keys are
      refreshed, and lookup misses are also cached; removing the need for
      performing API/database calls if we know we don't have the data we're
      looking for.
      
      == Performance & Models
      
      The new importer in various places uses raw INSERT statements (as
      generated by `Gitlab::Database.bulk_insert`) instead of using Rails
      models. This allows us to bypass any validations and callbacks,
      drastically reducing the number of SQL queries and Gitaly RPC calls
      necessary to import projects.
      
      To ensure the code produces valid data the corresponding tests check if
      the produced rows are valid according to the model validation rules.
      4dfe26cd
    • Yorick Peterse's avatar
      Refactor User.find_by_any_email · 44be82dd
      Yorick Peterse authored
      By using SQL::Union we can return a proper ActiveRecord::Relation,
      making it possible to select the columns we're interested in (instead of
      all of them).
      44be82dd
  32. 06 Nov, 2017 1 commit