Commit graph

20 commits

Author SHA1 Message Date
Stan Hu
9b75279162 Always use internal ID tables in development and production
To avoid quiet failures that cause consistency errors in the database,
we should now assume that the internal_ids table is available since
we've had this table for close to a year.

For tests that have migrations, we make this check thread-safe via
SafeRequestStore.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/60718
2019-04-22 10:48:16 -07:00
Kamil Trzciński
fb07863693 Rewind IID on Ci::Pipelines
If no pipeline is created we currently have IID gap.
This is due to fact that we generate IID not on save,
but rather ahead of time. This results, us,
losing IIDs.
2019-04-16 11:22:23 +02:00
Nick Thomas
013f7cd24c
Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
Andreas Brandl
fede3a0b75
Flush InternalId records after import
After the import has finished, we flush (delete) the InternalId records
related to the project at hand. This means we're starting over with
tracking correct internal id values, a new record will be created
automatically when the next internal id is generated.

The GitHub importer assigns iid values by using supplied values from
GitHub. We skip tracking internal id values during the import in favor
of higher concurrency. Deleting any InternalId records after the import
has finished is an extra measure to guarantee consistency.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54270.
2019-01-29 15:38:40 +01:00
Andreas Brandl
852e68fd95
Revert "Trigger iid logic from GitHub importer for milestones."
This reverts commit 358675d09f.
2019-01-29 15:38:40 +01:00
Andreas Brandl
358675d09f
Trigger iid logic from GitHub importer for milestones. 2018-08-16 10:01:02 +02:00
Rémy Coutable
f20a40f4a1 Merge branch 'frozen-string-enable-app-models' into 'master'
Enable frozen string in app/models/*.rb

See merge request gitlab-org/gitlab-ce!20851
2018-08-02 09:11:52 +00:00
Jamie Schembri
e72388246b Resolve "Allow issue's Internal ID (iid) to be set when creating via the API" 2018-08-01 09:03:14 +00:00
gfyoung
50abbd3e53 Enable frozen string in app/models/*.rb
Partially addresses #47424.
2018-07-26 16:55:41 -07:00
Shinya Maeda
09122f93c3 Merge branch 'master' into per-project-pipeline-iid 2018-05-30 14:50:09 +09:00
Andreas Brandl
f2cc1169e8 Remove double-checked internal id generation.
This was needed for a transition phase only. For details see #45389.

Closes #45389.
2018-05-28 12:46:03 +02:00
Shinya Maeda
3248ca0467 Add per-project pipeline id 2018-05-03 10:48:33 +02:00
Andreas Brandl
9ea2fc85a3 Atomic internal ids for all models 2018-04-20 14:00:15 +00:00
Andreas Brandl
14acbf2455 Double-check next value for internal ids.
This is useful for a transition period to migrate away from
`NoninternalAtomicId`. In a situation where both the old and new code to
generate a iid value is run at the same time (for example, during a
deploy different nodes may serve both versions), this will lead to
problems regarding the correct `last_value`. That is, what we track in
`InternalId` may get out of sync with the maximum iid present for
issues.

With this change, we double-check that and correct the `last_value` with
the maximum iid found in issues if necessary.

This is subject to be removed with the 10.8 release and tracked over
here: https://gitlab.com/gitlab-org/gitlab-ce/issues/45389

Closes #45269.
2018-04-16 13:59:20 +02:00
Andreas Brandl
fb6d6fce5a Address review comments. 2018-03-16 13:35:27 +01:00
Andreas Brandl
539bdf73be Address review comments. 2018-03-16 13:35:27 +01:00
Andreas Brandl
d374d0be1a Backwards-compat for migration specs.
The specs are based on a schema version that doesn't know about
`internal_ids` table. However, the actual code being execute relies on
it.
2018-03-16 13:35:26 +01:00
Andreas Brandl
3fa2eb4e10 Refactor, extract class and improve comments. 2018-03-16 13:35:25 +01:00
Andreas Brandl
0360b0928a More flexible way of internal id generation. 2018-03-16 13:35:25 +01:00
Andreas Brandl
754272e392 Atomic generation of internal ids for issues. 2018-03-16 13:35:25 +01:00