Commit Graph

188 Commits

Author SHA1 Message Date
Zeger-Jan van de Weg 89a407dc3b
Restore Object Pools when restoring an object pool
Pool repositories are persisted in the database, and when the DB is
restored, the data need to be restored on disk. This is done by
resetting the state machine and rescheduling the object pool creation.

This is not an exact replica of the state like at the time of the
creation of the backup. However, the data is consistent again.

Dumping isn't required as internally GitLab uses git bundles which
bundle all refs and include all objects in the bundle that they require,
reduplicating as more repositories get backed up. This does require more
data to be stored.

Fixes https://gitlab.com/gitlab-org/gitaly/issues/1355
2018-12-13 09:00:03 +01:00
Nick Thomas 7329480412
Fix gitlab:web_hook tasks 2018-12-06 18:37:05 +00:00
Michael Kozono 6855e6b586 Extract system check rake task logic
These changes make the code more reusable, testable, and most
importantly, overrideable.
2018-12-03 13:51:46 -08:00
Gabriel Mazetto fe2e6c6dc0 Remove Site Statistic
This approach caused many different problems as we tightened
the query execution timeout.
2018-11-26 23:39:05 +01:00
Toon Claes 1c481b7aac Enhance performance of counting local Uploads
Add an index to the `store` column on `uploads`. This makes counting
local uploads faster.

Also, there is no longer need to check for objects with `store = NULL`.
See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18557

---

### Query plans

Query:

```sql
SELECT COUNT(*)
FROM "uploads"
WHERE ("uploads"."store" = ? OR "uploads"."store" IS NULL)
```

#### Without index

```
gitlabhq_production=# EXPLAIN ANALYZE SELECT uploads.* FROM uploads WHERE (uploads.store = 1 OR uploads.store IS NULL);
                                                  QUERY PLAN
---------------------------------------------------------------------------------------------------------------
 Seq Scan on uploads  (cost=0.00..601729.54 rows=578 width=272) (actual time=6.170..2308.256 rows=545 loops=1)
   Filter: ((store = 1) OR (store IS NULL))
   Rows Removed by Filter: 4411957
 Planning time: 38.652 ms
 Execution time: 2308.454 ms
(5 rows)
```

#### Add index

```
gitlabhq_production=# create index uploads_tmp1 on uploads (store);
CREATE INDEX
```

#### With index

```
gitlabhq_production=# EXPLAIN ANALYZE SELECT uploads.* FROM uploads WHERE (uploads.store = 1 OR uploads.store IS NULL);
                                                          QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
 Bitmap Heap Scan on uploads  (cost=11.46..1238.88 rows=574 width=272) (actual time=0.155..0.577 rows=545 loops=1)
   Recheck Cond: ((store = 1) OR (store IS NULL))
   Heap Blocks: exact=217
   ->  BitmapOr  (cost=11.46..11.46 rows=574 width=0) (actual time=0.116..0.116 rows=0 loops=1)
         ->  Bitmap Index Scan on uploads_tmp1  (cost=0.00..8.74 rows=574 width=0) (actual time=0.095..0.095 rows=545 loops=1)
               Index Cond: (store = 1)
         ->  Bitmap Index Scan on uploads_tmp1  (cost=0.00..2.44 rows=1 width=0) (actual time=0.020..0.020 rows=0 loops=1)
               Index Cond: (store IS NULL)
 Planning time: 0.274 ms
 Execution time: 0.637 ms
(10 rows)
```

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/6070
2018-11-07 11:29:31 +01:00
George Tsiolis 733ae94921 Fix typos in comments and specs 2018-11-01 08:59:20 +02:00
Valery Sizov 15d011d64d Geo: sync disabled wikis. Stage 2
We started syncing all the wiki regardless of the fact it's disabled or
not. We couldn't do that in one stage because of needing of smoth update
and deprecating things. This is the second stage that finally removes
unused columns in the geo_node_status table.
2018-09-25 17:49:39 +03:00
Yorick Peterse ec33016bcd Include post migrations when loading the schema
See merge request gitlab-org/gitlab-ce!21689
2018-09-19 12:29:25 +00:00
DJ Mountney 60747672bb Fix the schema load test
And added changelog
2018-09-12 15:55:26 -07:00
DJ Mountney 76cfe4f1fd Ensure the schema is loaded with post_migrations included
If doing a schema load, the post_migrations should also be marked as up,
even if SKIP_POST_DEPLOYMENT_MIGRATIONS was set, otherwise future
migration runs will be broken.
2018-09-11 18:41:14 -07:00
Zeger-Jan van de Weg 3aedccb17a
Port cleanup tasks to use Gitaly
Rake tasks cleaning up the Git storage were still using direct disk
access, which won't work if these aren't attached. To mitigate a
migration issue was created.

To port gitlab:cleanup:dirs, and gitlab:cleanup:repos, a new RPC was
required, ListDirectories. This was implemented in Gitaly, through
https://gitlab.com/gitlab-org/gitaly/merge_requests/868.

To be able to use the new RPC the Gitaly server was bumped to v0.120.

This is an RPC that will not use feature gates, as this doesn't scale on
.com so there is no way to test it at scale. Futhermore, we _know_ it
doesn't scale, but this might be a useful task for smaller instances.

Lastly, the tests are slightly updated to also work when the disk isn't
attached. Eventhough this is not planned, it was very little effort and
thus I applied the boy scout rule.

Closes https://gitlab.com/gitlab-org/gitaly/issues/954
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/40529
2018-09-07 13:58:31 +02:00
Gabriel Mazetto 1a54986c16 Refactor SiteStatistics to extract refresh logic into a rake task 2018-08-16 21:31:19 +02:00
Shinya Maeda 63091cfe64 Add rake command to migrate archived traces from local storage to object storage 2018-08-16 14:28:47 +00:00
Douwe Maan d9614e701a Merge branch 'gitaly-install-path' into 'master'
Remove storage path dependency of gitaly install task

See merge request gitlab-org/gitlab-ce!21101
2018-08-14 08:59:10 +00:00
Alejandro Rodríguez eb1a3798ad Remove storage path dependency of gitaly install task 2018-08-12 18:52:44 -03:00
Michael Kozono a4351ac077 Add object storage related tests for `gitlab:cleanup:project_uploads` task 2018-08-03 04:36:43 +00:00
Sean McGivern 056025f78e Merge branch 'zj-backup-migration-done' into 'master'
Remove feature flags from lib/backup

Closes gitaly#749, gitaly#1212, and gitaly#1195

See merge request gitlab-org/gitlab-ce!20854
2018-08-02 12:35:35 +00:00
Michael Kozono 3cbd8b1343 Add local project uploads cleanup task 2018-07-31 11:09:42 -07:00
Zeger-Jan van de Weg d7afed34c4
Remove feature flags from lib/backup
Moved to OPT_OUT in 7d14b725a0, Now, by
removing the feature gates, this is an mandatory feature.

Related issues:
- https://gitlab.com/gitlab-org/gitaly/issues/526
- https://gitlab.com/gitlab-org/gitaly/issues/1194

Closes https://gitlab.com/gitlab-org/gitaly/issues/749
Closes https://gitlab.com/gitlab-org/gitaly/issues/1212
Closes https://gitlab.com/gitlab-org/gitaly/issues/1195
2018-07-31 15:24:19 +02:00
Zeger-Jan van de Weg f1f7bfc06f
Remove git rake tasks
These tasks are happening through housekeeping right now, by default
ever 10th push. This removes the need for these tasks.

Side note, this removes one of my first contributions to GitLab, as back
than I introduced these tasks through: 54e6c0045b

Closes https://gitlab.com/gitlab-org/gitaly/issues/768
2018-07-31 14:31:50 +02:00
Robert Speicher f5da4815a5
Speed up spec/tasks/gitlab/git_rake_spec.rb
Because no Git repository was actually created at the temporary path we
were using, `git fsck` would traverse up until it found a repository,
which in our case was the CE or EE repository.
2018-07-03 17:20:51 -05:00
DJ Mountney 2efe4a13b6 Fix static analysis failure 2018-06-27 14:09:06 -07:00
DJ Mountney 1ef3b3efbd Update tests for gitlab:db:configure 2018-06-27 13:42:22 -07:00
Jacob Vosmaer f376347f24 Find and mark more Git disk access locations, part 2 2018-06-12 14:33:37 +02:00
Gabriel Mazetto 36c3376475 Resolve "Hashed Storage: Make possible to migrate single project" 2018-06-07 15:40:44 +00:00
Jacob Vosmaer (GitLab) a0808df0b6 Find and mark more Git disk access locations 2018-06-05 15:51:14 +00:00
Gabriel Mazetto 8c5ce1b07c Specs covering listing all gitlab:storage:* types 2018-05-29 02:53:21 +02:00
Stan Hu e6fca03bbd Fix backup creation and restore for specific Rake tasks 2018-05-24 14:58:25 +00:00
Zeger-Jan van de Weg ec4423665c
Gitlab::Shell works on shard name, not path
Direct disk access is done through Gitaly now, so the legacy path was
deprecated. This path was used in Gitlab::Shell however. This required
the refactoring in this commit.

Added is the removal of direct path access on the project model, as that
lookup wasn't needed anymore is most cases.

Closes https://gitlab.com/gitlab-org/gitaly/issues/1111
2018-04-25 13:36:22 +02:00
Micaël Bergeron 4f24a65e45 fix the rake task from being to strict about Group 2018-04-02 08:19:34 -04:00
Micaël Bergeron 316eb6ef60 apply feedback 2018-03-30 08:39:12 -04:00
Micaël Bergeron da4fc5b899 fix a future conflict 2018-03-29 12:26:55 -04:00
Micaël Bergeron ef10679418 fix rake migration task from ignoring Upload(store: nil) 2018-03-29 11:05:05 -04:00
Sean McGivern 835fe4d324 Merge branch '40781-os-to-ce' into 'master'
Bring Object Storage to CE

Closes #4171, #4163, #3370, #2841, and #29203

See merge request gitlab-org/gitlab-ce!17358
2018-03-27 08:20:03 +00:00
Micaël Bergeron b08a1cd2c4 fix the failing specs 2018-03-22 14:37:47 -04:00
Micaël Bergeron 764b5fdd16 Backport EE changes 2018-03-22 13:35:42 -04:00
Micaël Bergeron 9c6663ea07 Merge remote-tracking branch 'origin/master' into 40781-os-to-ce 2018-03-22 09:06:10 -04:00
Jacob Vosmaer 008a6a6ce6 Route path lookups through legacy_disk_path 2018-03-21 18:18:32 +01:00
Micaël Bergeron 6466739e2e Merge remote-tracking branch 'origin/master' into 40781-os-to-ce 2018-03-08 10:55:47 -05:00
Sean McGivern edbcde8877 [cherry-pick] '4862-verify-file-checksums'
See merge request gitlab-org/gitlab-ee!4753
2018-03-08 10:20:40 -05:00
Nick Thomas 4419d7ea1f
Implement foreground verification of CI artifacts 2018-03-07 17:28:15 +00:00
Shinya Maeda 0ac1322045 Fix tests by latest proposal changes 2018-03-06 21:44:15 +09:00
Shinya Maeda 824af79d64 Fix rake task to use corrrect SQL 2018-03-06 21:43:19 +09:00
Nick Thomas 6f945f20b4
Foreground verification of uploads and LFS objects 2018-03-02 14:16:17 +00:00
Micaël Bergeron a8df653fae another round of fixes 2018-03-01 10:36:24 -05:00
Kamil Trzciński a2f375e8f7 Merge remote-tracking branch 'origin/master' into object-storage-ee-to-ce-backport 2018-02-28 21:28:43 +01:00
Kamil Trzciński 729391fbfc Merge commit '8af23def1d6' into object-storage-ee-to-ce-backport 2018-02-28 21:11:53 +01:00
Sean McGivern a7dae52e9d Merge branch '4163-move-uploads-to-object-storage' into 'master'
Move uploads to object storage

Closes #4163

See merge request gitlab-org/gitlab-ee!3867
2018-02-28 20:58:15 +01:00
Kamil Trzciński 45d2c31643 Merge commit '4b92efd90cedaa0aff218d11fdce279701128bea' into object-storage-ee-to-ce-backport 2018-02-28 20:46:53 +01:00
Grzegorz Bizon 6ca02a4150 Merge branch 'zj-multiple-artifacts-ee' into 'master'
Multiple artifacts ee

See merge request gitlab-org/gitlab-ee!3276
2018-02-28 20:44:09 +01:00