<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/gitlab/gitlab-ce.git, branch github-importer-refactor</title>
<subtitle>gitlab.com: gitlab-org/gitlab-ce.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/'/>
<entry>
<title>Replace old GH importer with the parallel importer</title>
<updated>2017-11-07T22:25:03+00:00</updated>
<author>
<name>Yorick Peterse</name>
<email>yorickpeterse@gmail.com</email>
</author>
<published>2017-10-18T19:46:05+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=6e242e82237ad2cf362098f3f42f4a9dd1a4ad27'/>
<id>6e242e82237ad2cf362098f3f42f4a9dd1a4ad27</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Rewrite the GitHub importer from scratch</title>
<updated>2017-11-07T22:24:59+00:00</updated>
<author>
<name>Yorick Peterse</name>
<email>yorickpeterse@gmail.com</email>
</author>
<published>2017-10-13T16:50:36+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=4dfe26cd8b6863b7e6c81f5c280cdafe9b6e17b6'/>
<id>4dfe26cd8b6863b7e6c81f5c280cdafe9b6e17b6</id>
<content type='text'>
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 &amp; 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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &amp; 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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Cache feature names in RequestStore</title>
<updated>2017-11-07T21:28:57+00:00</updated>
<author>
<name>Yorick Peterse</name>
<email>yorickpeterse@gmail.com</email>
</author>
<published>2017-10-30T15:10:31+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=90be53c5d39bff5e371cf8a6e11a39bf5dad7bcc'/>
<id>90be53c5d39bff5e371cf8a6e11a39bf5dad7bcc</id>
<content type='text'>
The GitHub importer (and probably other parts of our code) ends up
calling Feature.persisted? many times (via Gitaly). By storing this data
in RequestStore we can save ourselves _a lot_ of database queries.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/39361
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The GitHub importer (and probably other parts of our code) ends up
calling Feature.persisted? many times (via Gitaly). By storing this data
in RequestStore we can save ourselves _a lot_ of database queries.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/39361
</pre>
</div>
</content>
</entry>
<entry>
<title>Add returning IDs to Gitlab::Database.bulk_insert</title>
<updated>2017-11-07T21:28:57+00:00</updated>
<author>
<name>Yorick Peterse</name>
<email>yorickpeterse@gmail.com</email>
</author>
<published>2017-10-21T22:55:59+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=bda30182e0d6c0be9f89e2e9a4e8b8325ad7ccb7'/>
<id>bda30182e0d6c0be9f89e2e9a4e8b8325ad7ccb7</id>
<content type='text'>
This adds the keyword argument "return_ids" to
Gitlab::Database.bulk_insert. When set to `true` (and PostgreSQL is
used) this method will return an Array of the IDs of the inserted rows,
otherwise it will return an empty Array.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds the keyword argument "return_ids" to
Gitlab::Database.bulk_insert. When set to `true` (and PostgreSQL is
used) this method will return an Array of the IDs of the inserted rows,
otherwise it will return an empty Array.
</pre>
</div>
</content>
</entry>
<entry>
<title>Refactor User.find_by_any_email</title>
<updated>2017-11-07T21:28:52+00:00</updated>
<author>
<name>Yorick Peterse</name>
<email>yorickpeterse@gmail.com</email>
</author>
<published>2017-10-06T14:50:54+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=44be82dd18c372862c2421a1934ff816f7cccd97'/>
<id>44be82dd18c372862c2421a1934ff816f7cccd97</id>
<content type='text'>
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).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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).
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'add-ingress-to-cluster-applications' into 'master'</title>
<updated>2017-11-07T20:23:21+00:00</updated>
<author>
<name>Kamil Trzciński</name>
<email>ayufan@ayufan.eu</email>
</author>
<published>2017-11-07T20:23:21+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=673b6be1fecedd3a4e7126134f3a764694fcf327'/>
<id>673b6be1fecedd3a4e7126134f3a764694fcf327</id>
<content type='text'>
Add Ingress to cluster applications section

See merge request gitlab-org/gitlab-ce!15185</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add Ingress to cluster applications section

See merge request gitlab-org/gitlab-ce!15185</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch '10.2-templates-vendoring' into 'master'</title>
<updated>2017-11-07T19:56:08+00:00</updated>
<author>
<name>Kamil Trzciński</name>
<email>ayufan@ayufan.eu</email>
</author>
<published>2017-11-07T19:56:08+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=244ced4856c8ea335d36edac950265efa4ba55e7'/>
<id>244ced4856c8ea335d36edac950265efa4ba55e7</id>
<content type='text'>
Upgrade vendored templates for 10.2

See merge request gitlab-org/gitlab-ce!15259</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Upgrade vendored templates for 10.2

See merge request gitlab-org/gitlab-ce!15259</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'feature/hashed-storage-repo-import' into 'master'</title>
<updated>2017-11-07T19:11:43+00:00</updated>
<author>
<name>Nick Thomas</name>
<email>nick@gitlab.com</email>
</author>
<published>2017-11-07T19:11:43+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=ed000b5f3c214cb7e65aa60e6180224be413d54b'/>
<id>ed000b5f3c214cb7e65aa60e6180224be413d54b</id>
<content type='text'>
Improve GitLab Import rake task to work with Hashed Storage and Subgroups

Closes #36509

See merge request gitlab-org/gitlab-ce!15157</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Improve GitLab Import rake task to work with Hashed Storage and Subgroups

Closes #36509

See merge request gitlab-org/gitlab-ce!15157</pre>
</div>
</content>
</entry>
<entry>
<title>Improve GitLab Import rake task to work with Hashed Storage and Subgroups</title>
<updated>2017-11-07T19:11:42+00:00</updated>
<author>
<name>James Lopez</name>
<email>james@gitlab.com</email>
</author>
<published>2017-11-07T19:11:42+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=1c8af321ddd0f4c768caf54cfe8119c325b689e2'/>
<id>1c8af321ddd0f4c768caf54cfe8119c325b689e2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Upgrade vendored templates</title>
<updated>2017-11-07T19:07:28+00:00</updated>
<author>
<name>Alessio Caiazza</name>
<email>acaiazza@gitlab.com</email>
</author>
<published>2017-11-07T19:07:28+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/gitlab/gitlab-ce.git/commit/?id=761a403d8edfe292ad2f804371a5b4f5d6690ffd'/>
<id>761a403d8edfe292ad2f804371a5b4f5d6690ffd</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
