Fix counting of groups in admin dashboard

1. Ignore tables that use STI in reltuples count strategy.

   Models that use Rails' single-type inheritance, such as `Group` and
   `CiService`, need an additional WHERE clause to count the total
   properly, which isn't supported by the reltuples strategy.  For now,
   we just omit these from the statistics sampling and rely on the other
   strategies to get this data.

2. Fix tablesample count strategy not counting groups properly.

   Models such as `Group` needs a WHERE clause to distinguish it from
   namespaces. We now add in the WHERE clause if STI is in use.

Closes gitlab-ee#7435
149 jobs for sh-skip-sti-tables-reltuples in 61 minutes and 5 seconds (queued for 18 seconds)
Status Job ID Name Coverage
  Build
manual #175792100
gitlab-org allowed to fail manual
review-docs-deploy-manual
 
  Prepare
passed #175792104
gitlab-org docker
build-qa-image

00:04:33

passed #175792102
gitlab-org
compile-assets

00:06:55

passed #175792101
gitlab-org
retrieve-tests-metadata

00:00:33

passed #175792103
gitlab-org
setup-test-env

00:07:14

 
  Test
passed #175792246
allowed to fail
code_quality

00:09:31

passed #175792107
danger-review

00:03:01

passed #175792235
gitlab-org
db:check-schema-pg

00:05:18

passed #175792234
gitlab-org
db:migrate:reset-mysql

00:06:45

passed #175792233
gitlab-org
db:migrate:reset-pg

00:05:49

passed #175792240
gitlab-org
db:rollback-mysql

00:05:33

passed #175792238
gitlab-org
db:rollback-pg

00:05:57

passed #175792248
allowed to fail
dependency_scanning

00:02:14

passed #175792230
gitlab-org
docs lint

00:02:07

passed #175792231
gitlab-org
downtime_check

00:03:11

passed #175792232
gitlab-org
ee_compat_check

00:04:04

passed #175792243
docker gitlab-org
gitlab:assets:compile

00:13:09

passed #175792242
gitlab-org
gitlab:setup-mysql

00:09:14

passed #175792241
gitlab-org
gitlab:setup-pg

00:08:25

passed #175792254
gitlab-org
gitlab_git_test

00:01:56

passed #175792245
gitlab-org
jest

00:11:50

passed #175792244
gitlab-org
karma

00:13:10

58.71%
passed #175792237
gitlab-org
migration:path-mysql

00:15:04

passed #175792236
gitlab-org
migration:path-pg

00:13:24

passed #175792255
gitlab-org
no_ee_check

00:01:59

manual #175792106
allowed to fail manual
package-and-qa
passed #175792252
gitlab-org
qa-frontend-node:10

00:07:55

passed #175792251
gitlab-org
qa-frontend-node:8

00:07:13

passed #175792253
gitlab-org allowed to fail
qa-frontend-node:latest

00:07:27

passed #175792249
gitlab-org
qa:internal

00:06:09

passed #175792250
gitlab-org
qa:selectors

00:05:47

passed #175792256
review-build-cng

00:31:17

passed #175792257
gitlab-org allowed to fail
review-deploy

00:35:41

passed #175792260
gitlab-org docker allowed to fail
review-performance

00:38:27

manual #175792259
gitlab-org docker allowed to fail manual
review-qa-all
failed #175810633
docker gitlab-org allowed to fail
review-qa-smoke

00:06:05

manual #175792261
gitlab-org allowed to fail manual
review-stop
passed #175792172
gitlab-org
rspec-mysql 1/50

00:18:23

passed #175792184
gitlab-org
rspec-mysql 10/50

00:21:20

passed #175792185
gitlab-org
rspec-mysql 11/50

00:14:47

passed #175792186
gitlab-org
rspec-mysql 12/50

00:17:44

passed #175792187
gitlab-org
rspec-mysql 13/50

00:17:32

passed #175792188
gitlab-org
rspec-mysql 14/50

00:17:34

passed #175792189
gitlab-org
rspec-mysql 15/50

00:17:58

passed #175792190
gitlab-org
rspec-mysql 16/50

00:14:00

passed #175792192
gitlab-org
rspec-mysql 17/50

00:20:02

passed #175792194
gitlab-org
rspec-mysql 18/50

00:13:54

passed #175792195
gitlab-org
rspec-mysql 19/50

00:17:59

passed #175792173
gitlab-org
rspec-mysql 2/50

00:16:06

passed #175792196
gitlab-org
rspec-mysql 20/50

00:16:40

passed #175792197
gitlab-org
rspec-mysql 21/50

00:19:43

passed #175792198
gitlab-org
rspec-mysql 22/50

00:22:23

passed #175792199
gitlab-org
rspec-mysql 23/50

00:21:11

passed #175792200
gitlab-org
rspec-mysql 24/50

00:19:48

passed #175799240
gitlab-org
rspec-mysql 25/50

00:20:35

passed #175792202
gitlab-org
rspec-mysql 26/50

00:18:36

passed #175792203
gitlab-org
rspec-mysql 27/50

00:21:59

passed #175792204
gitlab-org
rspec-mysql 28/50

00:19:24

passed #175792205
gitlab-org
rspec-mysql 29/50

00:15:35

passed #175792174
gitlab-org
rspec-mysql 3/50

00:19:21

passed #175792206
gitlab-org
rspec-mysql 30/50

00:17:29

passed #175792207
gitlab-org
rspec-mysql 31/50

00:20:57

passed #175792208
gitlab-org
rspec-mysql 32/50

00:17:20

passed #175792209
gitlab-org
rspec-mysql 33/50

00:17:56

passed #175792210
gitlab-org
rspec-mysql 34/50

00:13:48

passed #175792211
gitlab-org
rspec-mysql 35/50

00:22:09

passed #175792212
gitlab-org
rspec-mysql 36/50

00:19:59

passed #175792213
gitlab-org
rspec-mysql 37/50

00:17:56

passed #175792214
gitlab-org
rspec-mysql 38/50

00:23:04

passed #175792215
gitlab-org
rspec-mysql 39/50

00:20:52

passed #175792175
gitlab-org
rspec-mysql 4/50

00:24:54

passed #175792216
gitlab-org
rspec-mysql 40/50

00:17:16

passed #175792217
gitlab-org
rspec-mysql 41/50

00:20:02

passed #175792218
gitlab-org
rspec-mysql 42/50

00:16:15

passed #175792219
gitlab-org
rspec-mysql 43/50

00:24:50

passed #175792220
gitlab-org
rspec-mysql 44/50

00:20:08

passed #175792221
gitlab-org
rspec-mysql 45/50

00:17:22

passed #175792222
gitlab-org
rspec-mysql 46/50

00:21:23

passed #175792223
gitlab-org
rspec-mysql 47/50

00:18:03

passed #175792224
gitlab-org
rspec-mysql 48/50

00:22:16

passed #175792225
gitlab-org
rspec-mysql 49/50

00:18:36

passed #175792177
gitlab-org
rspec-mysql 5/50

00:17:17

passed #175792226
gitlab-org
rspec-mysql 50/50

00:17:18

passed #175792179
gitlab-org
rspec-mysql 6/50

00:21:10

passed #175792181
gitlab-org
rspec-mysql 7/50

00:13:31

passed #175792182
gitlab-org
rspec-mysql 8/50

00:15:04

passed #175792183
gitlab-org
rspec-mysql 9/50

00:20:21

failed #175792228
gitlab-org allowed to fail
rspec-mysql-quarantine

00:24:07

passed #175792109
gitlab-org
rspec-pg 1/50

00:21:48

passed #175792122
gitlab-org
rspec-pg 10/50

00:19:33

passed #175792124
gitlab-org
rspec-pg 11/50

00:16:23

passed #175792128
gitlab-org
rspec-pg 12/50

00:20:00

passed #175792129
gitlab-org
rspec-pg 13/50

00:15:20

passed #175792131
gitlab-org
rspec-pg 14/50

00:13:30

passed #175792132
gitlab-org
rspec-pg 15/50

00:15:07

passed #175792133
gitlab-org
rspec-pg 16/50

00:14:23

passed #175792134
gitlab-org
rspec-pg 17/50

00:17:41

passed #175792136
gitlab-org
rspec-pg 18/50

00:18:59

passed #175792137
gitlab-org
rspec-pg 19/50

00:18:08

passed #175792110
gitlab-org
rspec-pg 2/50

00:14:59

passed #175792138
gitlab-org
rspec-pg 20/50

00:14:54

passed #175792140
gitlab-org
rspec-pg 21/50

00:14:48

passed #175792141
gitlab-org
rspec-pg 22/50

00:17:58

passed #175792142
gitlab-org
rspec-pg 23/50

00:17:46

passed #175792143
gitlab-org
rspec-pg 24/50

00:17:57

passed #175792144
gitlab-org
rspec-pg 25/50

00:23:03

passed #175792145
gitlab-org
rspec-pg 26/50

00:17:56

passed #175792146
gitlab-org
rspec-pg 27/50

00:19:02

passed #175792147
gitlab-org
rspec-pg 28/50

00:20:31

passed #175792148
gitlab-org
rspec-pg 29/50

00:19:48

passed #175792111
gitlab-org
rspec-pg 3/50

00:13:07

passed #175792149
gitlab-org
rspec-pg 30/50

00:16:26

passed #175792150
gitlab-org
rspec-pg 31/50

00:20:04

passed #175792151
gitlab-org
rspec-pg 32/50

00:21:58

passed #175792152
gitlab-org
rspec-pg 33/50

00:22:23

passed #175792153
gitlab-org
rspec-pg 34/50

00:16:35

passed #175792154
gitlab-org
rspec-pg 35/50

00:19:25

passed #175792155
gitlab-org
rspec-pg 36/50

00:19:54

passed #175792156
gitlab-org
rspec-pg 37/50

00:18:15

passed #175792157
gitlab-org
rspec-pg 38/50

00:23:32

passed #175792158
gitlab-org
rspec-pg 39/50

00:15:09

passed #175792112
gitlab-org
rspec-pg 4/50

00:21:19

passed #175792159
gitlab-org
rspec-pg 40/50

00:16:23

passed #175792160
gitlab-org
rspec-pg 41/50

00:20:21

passed #175792161
gitlab-org
rspec-pg 42/50

00:18:26

passed #175792162
gitlab-org
rspec-pg 43/50

00:20:12

passed #175792163
gitlab-org
rspec-pg 44/50

00:16:13

passed #175792164
gitlab-org
rspec-pg 45/50

00:12:52

passed #175792165
gitlab-org
rspec-pg 46/50

00:15:51

passed #175792167
gitlab-org
rspec-pg 47/50

00:18:15

passed #175792169
gitlab-org
rspec-pg 48/50

00:20:53

passed #175792170
gitlab-org
rspec-pg 49/50

00:16:01

passed #175792113
gitlab-org
rspec-pg 5/50

00:13:22

passed #175792171
gitlab-org
rspec-pg 50/50

00:18:43

passed #175792115
gitlab-org
rspec-pg 6/50

00:14:49

passed #175792118
gitlab-org
rspec-pg 7/50

00:14:30

passed #175792119
gitlab-org
rspec-pg 8/50

00:20:31

passed #175792120
gitlab-org
rspec-pg 9/50

00:21:28

failed #175792227
gitlab-org allowed to fail
rspec-pg-quarantine

00:17:33

failed #175804251
allowed to fail
sast

00:24:08

passed #175792229
gitlab-org
static-analysis

00:13:18

failed #175792258
gitlab-org docker allowed to fail
review-qa-smoke

00:41:20

failed #175792201
gitlab-org
rspec-mysql 25/50

00:10:36

failed #175792247
allowed to fail
sast

00:24:56

 
  Post Test
passed #175792263
gitlab-org
coverage

00:04:42

95.19%
passed #175792262
gitlab-org allowed to fail
flaky-examples-check

00:01:53

passed #175792265
gitlab-org
jsdoc

00:04:36

passed #175792264
gitlab-org
lint:javascript:report

00:02:12

 
  Post Cleanup
manual #175792266
gitlab-org allowed to fail manual
review-docs-cleanup
 
Name Stage Failure
failed
rspec-pg-quarantine Test
coverage/: found 5 matching files                  
knapsack/: found 3 matching files

rspec_flaky/: found 2 matching files

tmp/capybara/: found 15 matching files

Uploading artifacts to coordinator... ok
id=175792227 responseStatus=201 Created token=sJ5JaM6j
Uploading artifacts...
WARNING: junit_rspec.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1
failed
rspec-mysql-quarantine Test
coverage/: found 5 matching files                  
knapsack/: found 3 matching files

rspec_flaky/: found 2 matching files

tmp/capybara/: found 25 matching files

Uploading artifacts to coordinator... ok
id=175792228 responseStatus=201 Created token=nDsQsfF_
Uploading artifacts...
WARNING: junit_rspec.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1
failed
sast Test
2019/03/12 07:47:38 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
2019/03/12 07:47:38 Timeout when running the analyzer
Running after script...
$ date
Tue Mar 12 07:47:39 UTC 2019
Uploading artifacts...
WARNING: gl-sast-report.json: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1
failed
review-qa-smoke Test
Randomized with seed 22899

Running after script...
$ date
Tue Mar 12 07:46:05 UTC 2019
Uploading artifacts...
./qa/gitlab-qa-run-*: found 42 matching files
Uploading artifacts to coordinator... ok id=175810633 responseStatus=201 Created token=vHKbhAdh
ERROR: Job failed: exit code 1