Commit Graph

68 Commits

Author SHA1 Message Date
Eric Eastwood 4f5588b808 Add basic docs for troubleshooting database problems 2017-11-15 21:19:14 -06:00
Eric Eastwood 617c4fd948 Add basic emoji development docs 2017-11-15 01:55:00 -06:00
Yorick Peterse 4dfe26cd8b
Rewrite the GitHub importer from scratch
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.
2017-11-07 23:24:59 +01:00
Achilleas Pipinellis 69b4c5c011 Exclude comments from specific docs 2017-11-01 15:56:40 +00:00
Rémy Coutable 9e5cb67e9d
Fix a missing link and create a separate "Testing guides" section
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-11 16:33:57 +02:00
Rémy Coutable 676840ff9c Refactor the Development documentation, and divide the Testing documentation into multiple pages 2017-10-11 05:59:34 +00:00
Achilleas Pipinellis 75212feefd
Move i18n/introduction to i18n/index 2017-10-09 11:28:01 +02:00
Achilleas Pipinellis 8a1f29dee9
Merge branch 'master' into jramsay-4012-improve-internationization-docs 2017-10-09 11:23:30 +02:00
James Ramsay 0a7f27e1ad Docs: add translation and proof reading guidelines 2017-10-05 09:56:25 -04:00
Andrew Newdigate 0aef7d27e5 Added some Gitaly docs to `docs/development` 2017-09-27 14:59:51 +00:00
Robert Speicher ac51f44f75 Add developer documentation about working with sent emails and previews 2017-09-12 11:44:31 -04:00
Yorick Peterse 1d4cc24012
Document how to swap database tables. 2017-09-11 14:55:14 +02:00
Yorick Peterse a4a8cae7e1
Document not using database hash indexes 2017-08-16 16:39:37 +02:00
Yorick Peterse 6735e1dc9a
Document how to handle different DB (versions) 2017-08-16 16:39:37 +02:00
Yorick Peterse 862da3cfed
Add more database development related docs 2017-08-16 16:39:33 +02:00
Yorick Peterse ff78af152c
Added EachBatch for iterating tables in batches
This module provides a class method called `each_batch` that can be used
to iterate tables in batches in a more efficient way compared to Rails'
`in_batches` method. This commit also includes a RuboCop cop to
blacklist the use of `in_batches` in favour of this new method.
2017-07-07 16:39:36 +02:00
Yorick Peterse af1f6844c9
Added code for defining SHA attributes
These attributes are stored in binary in the database, but exposed as
strings. This allows one to query/create data using plain SHA1 hashes as
Strings, while storing them more efficiently as binary.
2017-06-29 15:37:37 +02:00
Yorick Peterse d83ee2bbd1
Add the ability to perform background migrations
Background migrations can be used to perform long running data
migrations without these blocking a deployment procedure.

See MR https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11854 for
more information.
2017-06-12 13:24:04 +02:00
Yorick Peterse 4ff1aaedc2
Document not using STI 2017-06-07 17:36:55 +02:00
Yorick Peterse 44d65c36db
Document not using polymorphic associations
Instead of using polymorphic associations a developer should use
separate tables.
2017-06-07 17:36:55 +02:00
Douwe Maan 483d88a9cd Merge branch 'document-not-using-serialize' into 'master'
Document not using ActiveRecord's serialize method

See merge request !11821
2017-06-01 13:06:30 +00:00
Alejandro Rodríguez 671284ba37 Add feature toggles through Flipper 2017-05-31 21:06:01 +00:00
Yorick Peterse 3d160480c0
Document not storing serialized data 2017-05-31 13:59:00 +02:00
Rubén Dávila Santos 1c1cb21e82 Add guide to collaborate with i18n. 2017-05-16 18:26:12 +00:00
Yorick Peterse b879079b1a
Add documentation about adding foreign keys
[ci skip]
2017-05-08 12:37:02 +02:00
Balasankar C b667fba826 Add a manual job to trigger package build in omnibus 2017-05-05 08:41:16 +00:00
Rémy Coutable 3b560dd04b
Remove outdated ci_setup.md doc page and document MySQL and RSpec profiling for specific branches
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-04-25 20:40:44 +02:00
Achilleas Pipinellis 0d2670242a Fix links and do some refactoring 2017-03-29 10:31:39 +02:00
Filipa Lacerda 8c3bdc853a Creates Frontend Style guide 2017-03-22 19:30:54 +00:00
Adam Niedzielski 204020fc33 Document "No gems fetched from git repositories" policy [ci skip] 2017-01-27 12:17:21 +01:00
Victor Wu a2c397a7a1 Link to object state models [ci skip] 2016-11-17 22:28:44 +00:00
Rémy Coutable 95d552b8dd Start to document how to code for CE with EE in mind
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-17 10:30:49 +01:00
Achilleas Pipinellis 8b70a89c57 Fix link to index.md in development README.md
[ci skip]
2016-11-12 20:48:41 +01:00
awhildy 11510bf729 [ci skip] Establish basic structure for ux_guide README.md
Block out pages needed for ux_guide

Add resources stub to ux_guide home

Fill out principles and basics

Add TOC to basics

Move all of UI guide to new UX guide structure

Add first level structure on ux-guide pages

Add more details to buttons

Add button images. Update link on development

Renamed surfaces to templates. Add tooltip details

Update typography and icons on Basics page

Add images for color. First draft of voice and tone

Delete findings page

Refine pages. Fill out Surfaces pages

Clean up layout on basics, surfaces, features. Add anchorlinks and counts to components

Fill out components page

Add item title and system info block

Fill out Features page

Switch tooltip placement image
2016-11-10 14:09:35 -08:00
Rémy Coutable daca93c4b1 Merge branch 'rs-bin-changelog' into 'master'
Add a bin/changelog script and changelog documentation

See merge request !7098
2016-11-02 13:25:47 +00:00
Robert Speicher 23312b484f Add changelog documentation 2016-10-31 14:56:20 +00:00
Yorick Peterse 83c8241160
Support for post deployment migrations
These are regular Rails migrations that are executed by default. A user
can opt-out of these migrations by setting an environment variable
during the deployment process.

Fixes gitlab-org/gitlab-ce#22133
2016-10-31 12:54:48 +01:00
Robert Speicher 65d86e0d11 Merge branch 'improve-grape-dsl-rules' into 'master'
Add an API styleguide

This adds a styleguide for API development. Spinned-of from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6860#note_16922017.

[ci skip]

See merge request !6864
2016-10-25 15:12:43 +00:00
Yorick Peterse 97731760d7
Re-organize queues to use for Sidekiq
Dumping too many jobs in the same queue (e.g. the "default" queue) is a
dangerous setup. Jobs that take a long time to process can effectively
block any other work from being performed given there are enough of
these jobs.

Furthermore it becomes harder to monitor the jobs as a single queue
could contain jobs for different workers. In such a setup the only
reliable way of getting counts per job is to iterate over all jobs in a
queue, which is a rather time consuming process.

By using separate queues for various workers we have better control over
throughput, we can add weight to queues, and we can monitor queues
better. Some workers still use the same queue whenever their work is
related. For example, the various CI pipeline workers use the same
"pipeline" queue.

This commit includes a Rails migration that moves Sidekiq jobs from the
old queues to the new ones. This migration also takes care of doing the
inverse if ever needed. This does require downtime as otherwise new jobs
could be scheduled in the old queues after this migration completes.

This commit also includes an RSpec test that blacklists the use of the
"default" queue and ensures cron workers use the "cronjob" queue.

Fixes gitlab-org/gitlab-ce#23370
2016-10-21 18:17:07 +02:00
Rémy Coutable b2c771f452
Add an API styleguide
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-13 18:44:52 +02:00
Connor Shea 182bcc977a Initial incomplete draft of the Frontend Development Guidelines.
[ci skip]
2016-09-21 19:02:18 -06:00
Yorick Peterse e4e03d946e
Added performance guidelines for new MRs
These guidelines cover the performance requirement for newly submitted
merge requests. These guidelines are put in to place to prevent merge
requests from negatively impacting GitLab performance as much as
possible.
2016-08-22 14:32:25 +02:00
Yorick Peterse 5f7394070f
Added documentation on adding database indexes 2016-08-11 14:22:50 +02:00
Achilleas Pipinellis 01c0039c55 Small refactor of doc/development/README.md
- Fix wrong doc_styleguide URL
- Clarify migrations refer to SQL
- Capitalize CSS
2016-08-10 14:28:56 +03:00
Jacob Vosmaer 23ddd5eca2 Link to doc root, not readme of GDK 2016-08-08 17:14:36 +02:00
Yorick Peterse c462dcec4d
Added guide about migrations and downtime
This guide describes various commonly used operations and the impact
they have on the availability of a GitLab instance.
2016-08-04 17:25:31 +02:00
Sid Sijbrandij 1de019f5c8 Structure the development documentation 2016-08-04 10:45:59 +00:00
Connor Shea b2e85b7968
Add relevant commands to the licensing document, resolve some feedback. 2016-06-06 13:39:36 -06:00
Connor Shea 3c32341215
Add Licensing information and guidelines to the Documentation. 2016-06-06 13:39:36 -06:00
Yorick Peterse b47a84b4be
Added performance guidelines
Fixes gitlab-org/gitlab-ce#15254 gitlab-org/gitlab-ce#14277

[ci skip]
2016-04-30 02:10:25 +02:00