<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/gitlab/gitlab-ce.git/lib/api/snippets.rb, branch refactor_deployment_cluster</title>
<subtitle>gitlab.com: gitlab-org/gitlab-ce.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/'/>
<entry>
<title>Allow all personal snippets to be accessed by API</title>
<updated>2019-03-06T09:05:03+00:00</updated>
<author>
<name>Nick Thomas</name>
<email>nick@gitlab.com</email>
</author>
<published>2019-03-05T16:12:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=e05a86cecdf52a0ec1f0f4ce4f30287f881b8ea2'/>
<id>e05a86cecdf52a0ec1f0f4ce4f30287f881b8ea2</id>
<content type='text'>
Previously, you could only access personal snippets in the API if you
had authored them. The documentation doesn't state that this is the
case, and it's quite surprising.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, you could only access personal snippets in the API if you
had authored them. The documentation doesn't state that this is the
case, and it's quite surprising.
</pre>
</div>
</content>
</entry>
<entry>
<title>Set content disposition attachment to several endpoints</title>
<updated>2018-11-23T16:44:09+00:00</updated>
<author>
<name>Francisco Javier López</name>
<email>fjlopez@gitlab.com</email>
</author>
<published>2018-11-23T16:44:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=9a5703ec82d394c2549f5afda7280c889d4cc373'/>
<id>9a5703ec82d394c2549f5afda7280c889d4cc373</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Rewrite SnippetsFinder to improve performance</title>
<updated>2018-11-05T13:28:29+00:00</updated>
<author>
<name>Yorick Peterse</name>
<email>yorickpeterse@gmail.com</email>
</author>
<published>2018-10-25T15:35:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=d171ff60168cd55b6d7b9ee920269f44a26e577e'/>
<id>d171ff60168cd55b6d7b9ee920269f44a26e577e</id>
<content type='text'>
This completely rewrites the SnippetsFinder class from the ground up in
order to improve its performance. The old code was beyond salvaging. It
was complex, included various Rails 5 workarounds, comments that
shouldn't be necessary, and most important of all: it produced a really
poorly performing database query.

As a result, I opted for rewriting the finder from scratch, instead of
trying to patch the existing code. Instead of trying to reuse as many
existing methods as possible, I opted for defining new methods
specifically meant for the SnippetsFinder. This requires some extra code
here and there, but allows us to have much more control over the
resulting SQL queries. It is these changes that then allow us to produce
a _much_ more efficient query.

To illustrate how bad the old query was, we will use my own snippets as
an example. Currently I have 52 snippets, most of which are global ones.
To retrieve these, you would run the following Ruby code:

    user = User.find_by(username: 'yorickpeterse')

    SnippetsFinder.new(user, author: user).execute

On GitLab.com the resulting query will take between 10 and 15 seconds to
run, producing the query plan found at
https://explain.depesz.com/s/Y5IX. Apart from the long execution time,
the total number of buffers (the sum of all shared hits) is around 185
GB, though the real number is probably (hopefully) much lower as I doubt
simply summing these numbers produces the true total number of buffers
used.

The new query's plan can be found at https://explain.depesz.com/s/wHdN,
and this query takes between 10 and 100-ish milliseconds to run. The
total number of buffers used is only about 30 MB.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/52639
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This completely rewrites the SnippetsFinder class from the ground up in
order to improve its performance. The old code was beyond salvaging. It
was complex, included various Rails 5 workarounds, comments that
shouldn't be necessary, and most important of all: it produced a really
poorly performing database query.

As a result, I opted for rewriting the finder from scratch, instead of
trying to patch the existing code. Instead of trying to reuse as many
existing methods as possible, I opted for defining new methods
specifically meant for the SnippetsFinder. This requires some extra code
here and there, but allows us to have much more control over the
resulting SQL queries. It is these changes that then allow us to produce
a _much_ more efficient query.

To illustrate how bad the old query was, we will use my own snippets as
an example. Currently I have 52 snippets, most of which are global ones.
To retrieve these, you would run the following Ruby code:

    user = User.find_by(username: 'yorickpeterse')

    SnippetsFinder.new(user, author: user).execute

On GitLab.com the resulting query will take between 10 and 15 seconds to
run, producing the query plan found at
https://explain.depesz.com/s/Y5IX. Apart from the long execution time,
the total number of buffers (the sum of all shared hits) is around 185
GB, though the real number is probably (hopefully) much lower as I doubt
simply summing these numbers produces the true total number of buffers
used.

The new query's plan can be found at https://explain.depesz.com/s/wHdN,
and this query takes between 10 and 100-ish milliseconds to run. The
total number of buffers used is only about 30 MB.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/52639
</pre>
</div>
</content>
</entry>
<entry>
<title>Enable frozen string in lib/api and lib/backup</title>
<updated>2018-09-30T04:04:50+00:00</updated>
<author>
<name>gfyoung</name>
<email>gfyoung17@gmail.com</email>
</author>
<published>2018-09-29T22:34:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=3836d69119fee2a625edae2a564132eff9520bc8'/>
<id>3836d69119fee2a625edae2a564132eff9520bc8</id>
<content type='text'>
Partially addresses #47424.

Had to make changes to spec files because
stubbing methods on frozen objects is a mess
in RSpec and leads to failures:

https://github.com/rspec/rspec-mocks/issues/1190
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Partially addresses #47424.

Had to make changes to spec files because
stubbing methods on frozen objects is a mess
in RSpec and leads to failures:

https://github.com/rspec/rspec-mocks/issues/1190
</pre>
</div>
</content>
</entry>
<entry>
<title>Disable existing offenses for the CodeReuse cops</title>
<updated>2018-09-11T15:32:00+00:00</updated>
<author>
<name>Yorick Peterse</name>
<email>yorickpeterse@gmail.com</email>
</author>
<published>2018-08-27T15:31:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=2039c8280db1646845c33d6c5a74e5f23ca6f4de'/>
<id>2039c8280db1646845c33d6c5a74e5f23ca6f4de</id>
<content type='text'>
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
</pre>
</div>
</content>
</entry>
<entry>
<title>Resolve "Make a Rubocop that forbids returning from a block"</title>
<updated>2018-04-18T09:19:40+00:00</updated>
<author>
<name>🙈  jacopo beschi 🙉</name>
<email>intrip@gmail.com</email>
</author>
<published>2018-04-18T09:19:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=c6b1043e9d1b7fe9912c330b6e7d4342f2a9694e'/>
<id>c6b1043e9d1b7fe9912c330b6e7d4342f2a9694e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Adds Rubocop rule for line break after guard clause</title>
<updated>2017-11-16T16:58:29+00:00</updated>
<author>
<name>Jacopo</name>
<email>beschi.jacopo@gmail.com</email>
</author>
<published>2017-11-14T09:02:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=181cd299f9e06223e8338e93b1c318c671ccb1aa'/>
<id>181cd299f9e06223e8338e93b1c318c671ccb1aa</id>
<content type='text'>
Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
</pre>
</div>
</content>
</entry>
<entry>
<title>Conditionally destroy a ressource</title>
<updated>2017-08-28T14:40:25+00:00</updated>
<author>
<name>Robert Schilling</name>
<email>rschilling@student.tugraz.at</email>
</author>
<published>2017-03-02T12:14:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=e80313f9ee5b3495a8713e6ddae111bc8106155b'/>
<id>e80313f9ee5b3495a8713e6ddae111bc8106155b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>API: Respect the 'If-Unmodified-Since' for delete endpoints</title>
<updated>2017-08-28T14:40:25+00:00</updated>
<author>
<name>Robert Schilling</name>
<email>rschilling@student.tugraz.at</email>
</author>
<published>2017-03-01T13:35:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=998afa5f74558be215a924d95aa131a69831ca43'/>
<id>998afa5f74558be215a924d95aa131a69831ca43</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update grape gem</title>
<updated>2017-07-20T13:33:18+00:00</updated>
<author>
<name>Dmitriy Zaporozhets</name>
<email>dmitriy.zaporozhets@gmail.com</email>
</author>
<published>2017-07-20T13:33:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=6b8ad689da393125bb2d1e548211c9a50039b0a7'/>
<id>6b8ad689da393125bb2d1e548211c9a50039b0a7</id>
<content type='text'>
New version of the gem returns 200 status code on delete with content
instead of 204 so we explicitly set status code to keep existing
behavior

Signed-off-by: Dmitriy Zaporozhets &lt;dmitriy.zaporozhets@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
New version of the gem returns 200 status code on delete with content
instead of 204 so we explicitly set status code to keep existing
behavior

Signed-off-by: Dmitriy Zaporozhets &lt;dmitriy.zaporozhets@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
