rspec db-library-code pg13
Passed Started
by
@gitlab-bot

🤖 GitLab Bot 🤖
1Running with gitlab-runner 16.1.0~beta.59.g83c66823 (83c66823)2 on green-2.private.runners-manager.gitlab.com/gitlab.com/gitlab-org GaSD-S1F, system ID: s_5651e5b5643b3 feature flags: FF_NETWORK_PER_BUILD:true, FF_USE_FASTZIP:true, FF_USE_IMPROVED_URL_MASKING:true6Using Docker executor with image registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-3.0.patched-golang-1.20-rust-1.65-node-18.16-postgresql-13:rubygems-3.4-git-2.36-lfs-2.9-chrome-113-yarn-1.22-graphicsmagick-1.3.36 ...7Starting service registry.gitlab.com/gitlab-org/gitlab-build-images:postgres-13-pgvector-0.4.1 ...8Authenticating with credentials from job payload (GitLab Registry)9Pulling docker image registry.gitlab.com/gitlab-org/gitlab-build-images:postgres-13-pgvector-0.4.1 ...10Using docker image sha256:73740c557807c4bc5d692f263c0e35454270600da4b22bbe952331411426c8b5 for registry.gitlab.com/gitlab-org/gitlab-build-images:postgres-13-pgvector-0.4.1 with digest registry.gitlab.com/gitlab-org/gitlab-build-images@sha256:3174001f839c42e299ac06a42f8ded446edfcb33b0eb820874749a3f53eb799c ...11WARNING: Service registry.gitlab.com/gitlab-org/gitlab-build-images:redis-cluster-6.2.12 is already created. Ignoring.12WARNING: Service registry.gitlab.com/gitlab-org/gitlab-build-images:redis-cluster-6.2.12 is already created. Ignoring.13Starting service registry.gitlab.com/gitlab-org/gitlab-build-images:redis-cluster-6.2.12 ...14Authenticating with credentials from job payload (GitLab Registry)15Pulling docker image registry.gitlab.com/gitlab-org/gitlab-build-images:redis-cluster-6.2.12 ...16Using docker image sha256:a9a90ece30d9630d694ab1997cd103ea8ec729789451b983a75c7b58b0062d45 for registry.gitlab.com/gitlab-org/gitlab-build-images:redis-cluster-6.2.12 with digest registry.gitlab.com/gitlab-org/gitlab-build-images@sha256:7ef36177d5d0bc554fbb63d8210ae751bcc538bea7905b51d078d9ab90a755fa ...17Starting service redis:6.2-alpine ...18Pulling docker image redis:6.2-alpine ...19Using docker image sha256:4fa67bf5f0f681a62c15a144e1ecce7bf7b20e00dcbb99441c4182f5e2607534 for redis:6.2-alpine with digest redis@sha256:9b1723d69398d170688d7f382f6ace36d0fc209481b143f3acf58a2f6f0743d3 ...20Waiting for services to be up and running (timeout 30 seconds)...21Authenticating with credentials from job payload (GitLab Registry)22Pulling docker image registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-3.0.patched-golang-1.20-rust-1.65-node-18.16-postgresql-13:rubygems-3.4-git-2.36-lfs-2.9-chrome-113-yarn-1.22-graphicsmagick-1.3.36 ...23Using docker image sha256:4569543cbc42cd33c20f1e0fa60038b738f0a00d8d418814bc7a855ee0ffbf77 for registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-3.0.patched-golang-1.20-rust-1.65-node-18.16-postgresql-13:rubygems-3.4-git-2.36-lfs-2.9-chrome-113-yarn-1.22-graphicsmagick-1.3.36 with digest registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-3.0.patched-golang-1.20-rust-1.65-node-18.16-postgresql-13@sha256:908f8dc2869a73dd1ef20957112808b7426c054c2bf4949fe04d9a8c5467b30b ...25Running on runner-gasd-s1f-project-278964-concurrent-0 via runner-gasd-s1f-private-1690426856-ab556ab3...27Fetching changes with git depth set to 20...28Initialized empty Git repository in /builds/gitlab-org/gitlab/.git/29Created fresh repository.30remote: Enumerating objects: 200368, done. 31remote: Counting objects: 100% (200368/200368), done. 32remote: Compressing objects: 100% (127761/127761), done. 33remote: Total 200368 (delta 101729), reused 135279 (delta 65007), pack-reused 0 34Receiving objects: 100% (200368/200368), 150.13 MiB | 30.95 MiB/s, done.35Resolving deltas: 100% (101729/101729), done.37 * [new ref] refs/pipelines/946806672 -> refs/pipelines/94680667238 * [new branch] master -> origin/master39Checking out 9bb6bea6 as detached HEAD (ref is master)...40Skipping Git submodules setup41$ git remote set-url origin "${CI_REPOSITORY_URL}"43Checking cache for ruby-gems-debian-bullseye-ruby-3.0-16...44cache.zip is up to date 45Successfully extracted cache47Downloading artifacts for compile-test-assets (4749214174)...48Downloading artifacts from coordinator... ok host=storage.googleapis.com id=4749214174 responseStatus=200 OK token=64_tyMkd49Downloading artifacts for retrieve-tests-metadata (4749214304)...50Downloading artifacts from coordinator... ok host=storage.googleapis.com id=4749214304 responseStatus=200 OK token=64_tyMkd51Downloading artifacts for setup-test-env (4749214206)...52Downloading artifacts from coordinator... ok host=storage.googleapis.com id=4749214206 responseStatus=200 OK token=64_tyMkd54Using docker image sha256:4569543cbc42cd33c20f1e0fa60038b738f0a00d8d418814bc7a855ee0ffbf77 for registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-3.0.patched-golang-1.20-rust-1.65-node-18.16-postgresql-13:rubygems-3.4-git-2.36-lfs-2.9-chrome-113-yarn-1.22-graphicsmagick-1.3.36 with digest registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-3.0.patched-golang-1.20-rust-1.65-node-18.16-postgresql-13@sha256:908f8dc2869a73dd1ef20957112808b7426c054c2bf4949fe04d9a8c5467b30b ...55$ echo $FOSS_ONLY56$ [ "$FOSS_ONLY" = "1" ] && rm -rf ee/ qa/spec/ee/ qa/qa/specs/features/ee/ qa/qa/ee/ qa/qa/ee.rb57$ export GOPATH=$CI_PROJECT_DIR/.go58$ mkdir -p $GOPATH59$ source scripts/utils.sh60$ source scripts/prepare_build.sh92Using decomposed database config (config/database.yml.decomposed-postgresql)93Geo DB won't be set up.94Embedding DB won't be set up.106$ source ./scripts/rspec_helpers.sh107$ run_timed_command "gem install knapsack --no-document"108$ gem install knapsack --no-document109Successfully installed knapsack-4.0.01101 gem installed111==> 'gem install knapsack --no-document' succeeded in 1 seconds.112$ section_start "gitaly-test-spawn" "Spawning Gitaly"; scripts/gitaly-test-spawn; section_end "gitaly-test-spawn"117$ rspec_db_library_code118Running RSpec command: bin/rspec -Ispec -rspec_helper --color --failure-exit-code 1 --error-exit-code 2 --format documentation --format Support::Formatters::JsonFormatter --out rspec/rspec-4749214737.json --format RspecJunitFormatter --out rspec/rspec-4749214737.xml --tag ~click_house -- spec/lib/gitlab/database/119/builds/gitlab-org/gitlab/ee/app/services/remote_development/service_response_factory.rb:41: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!120/builds/gitlab-org/gitlab/ee/app/services/remote_development/workspaces/create_service.rb:28: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!121/builds/gitlab-org/gitlab/ee/app/services/remote_development/workspaces/update_service.rb:28: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!122/builds/gitlab-org/gitlab/ee/lib/remote_development/agent_config/main.rb:32: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!123/builds/gitlab-org/gitlab/ee/lib/remote_development/agent_config/main.rb:35: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!124/builds/gitlab-org/gitlab/ee/lib/remote_development/agent_config/updater.rb:11: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!125/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/authorizer.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!126/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/authorizer.rb:13: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!127/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/creator.rb:17: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!128/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/creator.rb:24: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!129/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/creator.rb:25: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!130/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/creator.rb:28: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!131/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/devfile_fetcher.rb:15: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!132/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/devfile_fetcher.rb:16: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!133/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/devfile_flattener.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!134/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/editor_component_injector.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!135/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/editor_component_injector.rb:17: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!136/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/editor_component_injector.rb:18: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!137/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/main.rb:48: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!138/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:43: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!139/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:54: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!140/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:102: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!141/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:126: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!142/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:159: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!143/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:202: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!144/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:235: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!145/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb:24: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!146/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb:52: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!147/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!148/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb:17: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!149/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb:18: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!150/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb:23: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!151/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/volume_component_injector.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!152/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/volume_component_injector.rb:13: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!153/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/volume_component_injector.rb:14: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!154/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/update/authorizer.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!155/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/update/main.rb:28: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!156/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/update/updater.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!157Run options: exclude {:click_house=>true}158Test environment set up in 1.776591741 seconds159Gitlab::Database::AsyncConstraints::MigrationHelpers160 # order random161 with partitioned tables162 #prepare_partitioned_async_foreign_key_validation163 delegates to prepare_async_foreign_key_validation for each partition164 #unprepare_partitioned_async_foreign_key_validation165 delegates to unprepare_async_foreign_key_validation for each partition166 with async check constraint validations167 #prepare_async_check_constraint_validation168 creates the record for async validation169 when the check constraint does not exist170 returns an error171 when the record already exists172 does attempt to create the record173 when the async validation table does not exist174 does not raise an error175 #unprepare_async_check_constraint_validation176 with check constraints177 destroys the record178 when the async validation table does not exist179 does not raise an error180 with other types of constraints181 does not destroy the record182 with async FK validation on regular tables183 #prepare_async_foreign_key_validation184 creates the record for the async FK validation185 when an explicit name is given186 creates the record with the given name187 when the FK does not exist188 returns an error189 when the record already exists190 does attempt to create the record191 when the async FK validation table does not exist192 does not raise an error193 #unprepare_async_foreign_key_validation194 with foreign keys195 destroys the record196 when an explicit name is given197 destroys the record198 when the async fk validation table does not exist199 does not raise an error200 with other types of constraints201 does not destroy the record202Gitlab::Database::AsyncConstraints::PostgresAsyncConstraintValidation203 # order random204 is expected to be a kind of Gitlab::Database::SharedModel(abstract)205 .table_available?206 is expected to be truthy207 when the table does not exist208 is expected to be falsy209 #handle_exception!210 increases the attempts number211 saves error details212 .constraint_type_exists?213 is expected to be truthy214 always asks the database215 scopes216 .ordered217 is expected to eq [#<Gitlab::Database::AsyncConstraints::PostgresAsyncConstraintValidation id: 15, created_at: "2023-07..."fk_users_id_2", table_name: "users", last_error: nil, attempts: 1, constraint_type: "foreign_key">]218 .foreign_key_type219 is expected to eq [#<Gitlab::Database::AsyncConstraints::PostgresAsyncConstraintValidation id: 16, created_at: "2023-07..."fk_users_id_4", table_name: "users", last_error: nil, attempts: 1, constraint_type: "foreign_key">]220 does not apply the filter if the column is not present221 .check_constraint_type222 is expected to eq [#<Gitlab::Database::AsyncConstraints::PostgresAsyncConstraintValidation id: 21, created_at: "2023-07...sers_id_9", table_name: "users", last_error: nil, attempts: 0, constraint_type: "check_constraint">]223 validations224 is expected to validate that :name cannot be empty/falsy225 is expected to validate that :name is case-sensitively unique within the scope of :table_name226 is expected to validate that the length of :name is at most 63227 is expected to validate that :table_name cannot be empty/falsy228 is expected to validate that the length of :table_name is at most 63229 is expected to validate that the length of :last_error is at most 10000230Gitlab::Database::AsyncConstraints::Validators::CheckConstraint231 # order random232 behaves like async constraints validation233 validates the constraint while controlling statement timeout234 removes the constraint validation record from table235 skips logic if not able to acquire exclusive lease236 logs messages around execution237 when the constraint does not exist238 skips validation and removes the record239 logs an appropriate message240 with error handling241 on production242 increases execution attempts243 logs an error message including the constraint_name244 on development245 also raises errors246Gitlab::Database::AsyncConstraints::Validators::ForeignKey247 # order random248 behaves like async constraints validation249 validates the constraint while controlling statement timeout250 removes the constraint validation record from table251 skips logic if not able to acquire exclusive lease252 logs messages around execution253 when the constraint does not exist254 skips validation and removes the record255 logs an appropriate message256 with error handling257 on production258 increases execution attempts259 logs an error message including the constraint_name260 on development261 also raises errors262 with fully qualified table names263 validates the constraint264Gitlab::Database::AsyncConstraints::Validators265 # order random266 .for267 with foreign keys validations268 is expected to be a kind of Gitlab::Database::AsyncConstraints::Validators::ForeignKey269 with check constraint validations270 is expected to be a kind of Gitlab::Database::AsyncConstraints::Validators::CheckConstraint271Gitlab::Database::AsyncConstraints272 # order random273 .validate_pending_entries!274 executes pending validations275Gitlab::Database::AsyncDdlExclusiveLeaseGuard276 # order random277 #lease_key278 with CI database connection279 is expected to eq "gitlab/database/asyncddl/actions/ci"280 with MAIN database connection281 is expected to eq "gitlab/database/asyncddl/actions/main"282Gitlab::Database::AsyncIndexes::IndexBase283 # order random284 #perform285 #preconditions_met?286 raises errors if preconditions is not defined287 #action_type288 raises errors if action_type is not defined289 with error handling290 on production291 increases execution attempts292 logs an error message including the index_name293 on development294 also raises errors295Gitlab::Database::AsyncIndexes::IndexCreator296 #perform297 creates the index while controlling statement timeout298 removes the index preparation record from postgres_async_indexes299 skips logic if not able to acquire exclusive lease300 logs messages around execution301 when the index already exists302 skips index creation303 removes the index preparation record from postgres_async_indexes304 logs an appropriate message305Gitlab::Database::AsyncIndexes::IndexDestructor306 #perform307 creates the index while controlling lock timeout308 removes the index preparation record from postgres_async_indexes309 skips logic if not able to acquire exclusive lease310 logs messages around execution311 when the index does not exist312 skips index destruction313 removes the index preparation record from postgres_async_indexes314 logs an appropriate message315Gitlab::Database::AsyncIndexes::MigrationHelpers316 #unprepare_async_index317 destroys the record318 when an explicit name is given319 destroys the record320 when the async index table does not exist321 does not raise an error322 #unprepare_async_index_by_name323 destroys the record324 when the async index table does not exist325 does not raise an error326 #prepare_async_index327 creates the record for the async index328 when an explicit name is given329 creates the record with the given name330 when the index already exists331 does not create the record332 when the record already exists333 does attempt to create the record334 updates definition if changed335 does not update definition if not changed336 when the async index table does not exist337 does not raise an error338 #prepare_async_index_from_sql339 requires ddl mode340 when the given index is invalid341 raises a RuntimeError342 when the given index is valid343 when the index algorithm is not concurrent344 raises a RuntimeError345 when the index algorithm is concurrent346 when the statement tries to create an index for non-existing table347 raises a RuntimeError348 when the statement tries to create an index for an existing table349 when the async index creation is not available350 does not raise an error351 when the async index creation is available352 when there is already an index with the given name353 does not create the async index record354 when there is no index with the given name355 creates the async index record356 sets the async index attributes correctly357 when the given SQL has whitespace358 creates the async index record359 sets the async index attributes correctly360 #prepare_async_index_removal361 creates the record for the async index removal362 when the index does not exist363 does not create the record364 when the record already exists365 does attempt to create the record366Gitlab::Database::AsyncIndexes::PostgresAsyncIndex367 is expected to be a kind of Gitlab::Database::SharedModel(abstract)368 validations369 is expected to validate that :name cannot be empty/falsy370 is expected to validate that the length of :name is at most 63371 is expected to validate that :table_name cannot be empty/falsy372 is expected to validate that the length of :table_name is at most 127373 is expected to validate that :definition cannot be empty/falsy374 is expected to validate that the length of :definition is at most 2048375 is expected to validate that the length of :last_error is at most 10000376 when passing a long schema name377 behaves like table_name is invalid378 is invalid379 when passing a long table name380 behaves like table_name is invalid381 is invalid382 when passing a long table name and schema name383 behaves like table_name is invalid384 is invalid385 when invalid table name is given386 behaves like table_name is invalid387 is invalid388 when passing a definition with beginning or trailing whitespace389 strips the definition field390 scopes391 .to_create392 is expected to contain exactly #<Gitlab::Database::AsyncIndexes::PostgresAsyncIndex id: 38, created_at: "2023-07-27 04:15:56.4824511...nition: "CREATE INDEX users_id_32 ON users (id)", table_name: "users", attempts: 0, last_error: nil>393 .to_drop394 is expected to contain exactly #<Gitlab::Database::AsyncIndexes::PostgresAsyncIndex id: 39, created_at: "2023-07-27 04:15:56.4869109...ers_id_33", definition: "DROP INDEX users_id_33", table_name: "users", attempts: 0, last_error: nil>395 .ordered396 is expected to contain exactly #<Gitlab::Database::AsyncIndexes::PostgresAsyncIndex id: 39, created_at: "2023-07-27 04:15:56.4869109...ers_id_33", definition: "DROP INDEX users_id_33", table_name: "users", attempts: 0, last_error: nil>397 #handle_exception!398 increases the attempts number399 saves error details400Gitlab::Database::AsyncIndexes401 .create_pending_indexes!402 takes 2 pending indexes and creates those403 .drop_pending_indexes!404 takes 2 pending indexes and destroys those405 .execute_pending_actions!406 with one entry407 executes instructions ordered by attempts and ids408 with two entries409 executes instructions ordered by attempts410 when the budget allows more instructions411 retries failed attempts412Gitlab::Database::BackgroundMigration::BatchMetrics413 #time_operation414 tracks the duration of the operation using monotonic time415 #instrument_operation416 tracks duration and affected rows417Gitlab::Database::BackgroundMigration::BatchOptimizer418 #optimize419 with unknown time efficiency, it keeps the batch size420 with a time efficiency of 95%, it keeps the batch size421 with a time efficiency of 90%, it keeps the batch size422 with a time efficiency of 85%, it increases the batch size423 with a time efficiency of 110%, it decreases the batch size424 reaching the upper limit for an increase425 caps the batch size multiplier at 20% when increasing426 does not limit the decrease multiplier427 reaching the upper limit for the batch size428 caps the batch size at 10M429 when max_batch_size is set430 caps the batch size at max_batch_size431 reaching the lower limit for the batch size432 caps the batch size at 1k433 when migration max_batch_size is less than MIN_BATCH_SIZE434 does not raise an error435Gitlab::Database::BackgroundMigration::BatchedJob436 is expected to be a kind of Gitlab::Database::SharedModel(abstract)437 is expected to contain exactly ActiveRecord::StatementTimeout, ActiveRecord::ConnectionTimeoutError, ActiveRecord::AdapterTimeout, ActiveRecord::LockWaitTimeout, and ActiveRecord::QueryCanceled438 associations439 is expected to belong to batched_migration required: false440 is expected to have many batched_job_transition_logs441 state machine442 is expected to eql :pending, :running, :failed, and :succeeded443 when a job is running444 logs the transition445 when a job succeed446 logs the transition447 updates the finished_at448 creates a new transition log449 when a job fails the number of max times450 when job can be split451 splits the job into two retriable jobs452 when the job cannot be split453 does not split the job454 keeps the same job attributes455 logs the error456 when a job fails457 logs the transition458 tracks the exception459 updates the finished_at460 creates a new transition log461 when job fails during sub batch processing462 when sub batch size can be reduced in 25%463 is expected to change `job.sub_batch_size` to 7464 when retries exceeds 2 attempts465 calls split_and_retry! once sub_batch_size cannot be decreased anymore466 is expected not to change `job.sub_batch_size`467 scopes468 .except_succeeded469 returns not succeeded jobs470 .active471 returns active jobs472 .stuck473 returns stuck jobs474 .retriable475 returns retriable jobs476 .created_since477 returns jobs since a given time478 .blocked_by_max_attempts479 returns blocked jobs480 delegated batched_migration attributes481 #migration_job_class482 returns the migration job_class483 #migration_table_name484 returns the migration table_name485 #migration_column_name486 returns the migration column_name487 #migration_job_arguments488 returns the migration job_arguments489 #migration_job_class_name490 returns the migration job_class_name491 .extract_transition_options492 args: [], expected_result: []493 matches expected keys and result494 args: [{:error=>StandardError}], expected_result: [StandardError, nil]495 matches expected keys and result496 args: [{:error=>StandardError, :from_sub_batch=>true}], expected_result: [StandardError, true]497 matches expected keys and result498 #can_split?499 when the number of attempts is greater than the limit and the batch_size is greater than the sub_batch_size500 when is a timeout exception501 is expected to be truthy502 when is a QueryCanceled exception503 is expected to be truthy504 when is not a timeout exception505 is expected to be falsey506 when the number of attempts is lower than the limit and the batch_size is greater than the sub_batch_size507 when is a timeout exception508 is expected to be falsey509 when is not a timeout exception510 is expected to be falsey511 when the batch_size is lower than the sub_batch_size512 is expected to be falsey513 when the batch_size is 1514 is expected to be falsey515 #can_reduce_sub_batch_size?516 when the number of attempts is lower than the limit and batch size are within boundaries517 is expected to equal true518 when the number of attempts is lower than the limit and batch size are outside boundaries519 is expected to equal false520 when the number of attempts is greater than the limit and batch size are within boundaries521 is expected to equal false522 #time_efficiency523 when job has not yet succeeded524 returns nil525 when finished_at is not set526 returns nil527 when started_at is not set528 returns nil529 when job has finished530 returns ratio of duration to interval, here: 0.5531 returns ratio of duration to interval, here: 1532 #split_and_retry!533 when job can be split534 sets the correct attributes535 splits the jobs into retriable jobs536 when job is not failed537 raises an exception538 when batch size is already 1539 keeps the same batch size540 resets the number of attempts541 when computed midpoint is larger than the max value of the batch542 lowers the batch size and resets the number of attempts543 #reduce_sub_batch_size!544 when the job sub batch size can be reduced545 reduces sub batch size in 25%546 log the changes547 when reduced sub_batch_size is greater than sub_batch548 doesn't allow sub_batch_size to greater than sub_batch549 when sub_batch_size is already 1550 updates sub_batch_size to it's minimum value551 when job has not failed552 raises an exception553 when the amount to be reduced exceeds the threshold554 prevents sub batch size to be reduced555Gitlab::Database::BackgroundMigration::BatchedJobTransitionLog556 is expected to be a kind of Gitlab::Database::SharedModel(abstract)557 associations558 is expected to belong to batched_job required: false559 validations560 is expected to validate that :previous_status cannot be empty/falsy561 is expected to validate that :next_status cannot be empty/falsy562 is expected to validate that :batched_job cannot be empty/falsy563 is expected to validate that the length of :exception_class is at most 100564 is expected to validate that the length of :exception_message is at most 1000565 is expected to define :previous_status as an enum backed by an integer with values ‹[:pending, :running, :failed, :succeeded]›, prefix: true566 is expected to define :next_status as an enum backed by an integer with values ‹[:pending, :running, :failed, :succeeded]›, prefix: true567Gitlab::Database::BackgroundMigration::BatchedMigrationRunner568 #run_migration_job569 when the migration has no previous jobs570 when the migration has batches to process571 runs the job for the first batch572 migration health573 puts migration on hold on stop signal574 optimizes migration on normal signal575 optimizes migration on no signal576 optimizes migration on unknown signal577 when the batch maximum exceeds the migration maximum578 clamps the batch maximum to the migration maximum579 when the migration has no batches to process580 behaves like it has completed the migration581 does not create and run a migration job582 marks the migration as finished583 when the migration should stop584 changes the status to failure585 when the migration has previous jobs586 when the migration has no batches remaining587 behaves like it has completed the migration588 does not create and run a migration job589 marks the migration as finished590 when the migration has batches to process591 runs the migration job for the next batch592 when the batch minimum exceeds the migration maximum593 behaves like it has completed the migration594 does not create and run a migration job595 marks the migration as finished596 when migration has failed jobs597 retries the failed job598 when failed job has reached the maximum number of attempts599 marks the migration as failed600 when migration has stuck jobs601 retries the stuck job602 when migration has possible stuck jobs603 keeps the migration active604 when the migration has batches to process and failed jobs605 runs next batch then retries the failed job606 #run_entire_migration607 when not in a development or test environment608 raises an error609 when the given migration is not active610 does not create and run migration jobs611 when the given migration is active612 runs all jobs inline until finishing the migration613 #finalize614 when the migration is not yet completed615-- drop_table(:_test_batched_migrations_test_table, {:if_exists=>true})616 -> 0.0010s617-- create_table(:_test_batched_migrations_test_table, {:id=>false})618 -> 0.0022s619-- execute("INSERT INTO _test_batched_migrations_test_table VALUES (1, 1), (2, 2), (3, NULL), (4, NULL), (5, NULL), (6, NULL), (7, NULL), (8, NULL)")620 -> 0.0015s621-- execute("SELECT * FROM _test_batched_migrations_test_table WHERE some_id_convert_to_bigint IS NULL")622 -> 0.0011s623-- drop_table(:_test_batched_migrations_test_table, {:if_exists=>true})624 -> 0.0017s625 completes the migration626 when migration fails to complete627-- drop_table(:_test_batched_migrations_test_table, {:if_exists=>true})628 -> 0.0013s629-- create_table(:_test_batched_migrations_test_table, {:id=>false})630 -> 0.0022s631-- execute("INSERT INTO _test_batched_migrations_test_table VALUES (1, 1), (2, 2), (3, NULL), (4, NULL), (5, NULL), (6, NULL), (7, NULL), (8, NULL)")632 -> 0.0013s633-- drop_table(:_test_batched_migrations_test_table, {:if_exists=>true})634 -> 0.0022s635 raises an error636 when the migration is already finished637-- drop_table(:_test_batched_migrations_test_table, {:if_exists=>true})638 -> 0.0010s639-- create_table(:_test_batched_migrations_test_table, {:id=>false})640 -> 0.0021s641-- execute("INSERT INTO _test_batched_migrations_test_table VALUES (1, 1), (2, 2), (3, NULL), (4, NULL), (5, NULL), (6, NULL), (7, NULL), (8, NULL)")642 -> 0.0013s643-- drop_table(:_test_batched_migrations_test_table, {:if_exists=>true})644 -> 0.0012s645 is a no-op646 when the migration does not exist647-- drop_table(:_test_batched_migrations_test_table, {:if_exists=>true})648 -> 0.0011s649-- create_table(:_test_batched_migrations_test_table, {:id=>false})650 -> 0.0021s651-- execute("INSERT INTO _test_batched_migrations_test_table VALUES (1, 1), (2, 2), (3, NULL), (4, NULL), (5, NULL), (6, NULL), (7, NULL), (8, NULL)")652 -> 0.0012s653-- drop_table(:_test_batched_migrations_test_table, {:if_exists=>true})654 -> 0.0012s655 is a no-op656 .finalize657 when the connection is passed658 initializes the object with the given connection659Gitlab::Database::BackgroundMigration::BatchedMigration660 is expected to be a kind of Gitlab::Database::SharedModel(abstract)661 associations662 is expected to have many batched_jobs663 #last_job664 returns the batched job with highest max_value665 validations666 is expected to validate that :job_arguments is case-sensitively unique within the scope of :job_class_name, :table_name, and :column_name667 when there are failed jobs668 raises an exception669 when the jobs are completed670 finishes the migration671 updates the finished_at672 state machine673 when a migration is executed674 updates the started_at675 #pause!676 when an invalid transition is applied677 raises an exception678 raises an exception679 raises an exception680 when a valid transition is applied681 moves to pause682 moves to pause683 #execute!684 when an invalid transition is applied685 raises an exception686 raises an exception687 when a valid transition is applied688 moves to active689 moves to active690 moves to active691 #finish!692 when an invalid transition is applied693 raises an exception694 when a valid transition is applied695 moves to active696 moves to active697 moves to active698 moves to active699 #failure!700 when an invalid transition is applied701 raises an exception702 raises an exception703 when a valid transition is applied704 moves to active705 moves to active706 moves to active707 .valid_status708 returns valid status709 .queue_order710 returns batched migrations ordered by their id711 .ordered_by_created_at_desc712 returns batched migrations ordered by created_at (DESC)713 .find_executable714 when the migration does not exist715 returns nil716 when the migration is not active717 returns nil718 when the migration is on hold719 returns nil720 when the migration is not available for the current connection721 returns nil722 when ther migration exists and is executable723 returns the migration724 .active_migrations_distinct_on_table725 returns one pending executable migration per table726 returns epmty collection when there are no pending executable migrations727 .created_after728 only returns migrations created after the specified time729 .queued730 returns active and paused migrations731 .finalizing732 returns only finalizing migrations733 .successful_rows_counts734 returns totals from successful jobs735 #reset_attempts_of_blocked_jobs!736 sets the number of attempts to zero for blocked jobs737 #interval_elapsed?738 when the migration has no last_job739 returns true740 when the migration has a last_job741 when the last_job is less than an interval old742 returns false743 when the last_job is exactly an interval old744 returns true745 when the last_job is more than an interval old746 returns true747 when an interval variance is given748 when the last job is less than an interval with variance old749 returns false750 when the last job is more than an interval with variance old751 returns true752 #create_batched_job!753 creates a batched_job with the correct batch configuration754 #next_min_value755 when a previous job exists756 returns the next value after the previous maximum757 when a previous job does not exist758 returns the migration minimum value759 #job_class760 returns the class of the job for the migration761 #batch_class762 returns the class of the batch strategy for the migration763 #retry_failed_jobs!764 when there are failed migration jobs765 moves the status of the migration to active766 changes the number of attempts to 0767 when there are no failed migration jobs768 moves the status of the migration to active769 #should_stop?770 when the started_at is nil771 is expected to be falsey772 when the number of jobs is lesser than the MINIMUM_JOBS773 is expected to be falsey774 when the calculated value is greater than the threshold775 is expected to be truthy776 when the calculated value is lesser than the threshold777 is expected to be falsey778 #job_class_name=779 behaves like an attr_writer that assigns class names780 when a module name exists781 keeps the class with module name782 removes leading namespace resolution operator783 when a module name does not exist784 does not change the given class name785 #batch_class_name=786 behaves like an attr_writer that assigns class names787 when a module name exists788 keeps the class with module name789 removes leading namespace resolution operator790 when a module name does not exist791 does not change the given class name792 #migrated_tuple_count793 sums the batch_size of succeeded jobs794 #prometheus_labels795 returns a hash with labels for the migration796 #smoothed_time_efficiency797 when there are not enough jobs798 returns nil799 when there are enough jobs800 example 1: increasing trend, but only recently crossed threshold801 returns the smoothed time efficiency802 example 2: increasing trend, crossed threshold a while ago803 returns the smoothed time efficiency804 example 3: decreasing trend, but only recently crossed threshold805 returns the smoothed time efficiency806 example 4: latest run spiked807 returns the smoothed time efficiency808 with preloaded batched migration809 avoids N+1810 #optimize!811 calls the BatchOptimizer812 #hold!813 updates on_hold_until property814 defaults to 10 minutes815 #on_hold?816 returns false if no on_hold_until is set817 returns false if on_hold_until has passed818 returns true if on_hold_until is in the future819 #progress820 when the migration is completed821 returns 100822 when the status is finished823 returns 100824 when the migration does not have jobs825 returns zero826 when the `total_tuple_count` is zero827 returns nil828 when migration has completed jobs829 calculates the progress830 .for_configuration831 finds the migration matching the given configuration parameters832 filters by gitlab schemas available for the connection833 doesn not filter by gitlab schemas available for the connection if the column is nor present834 .find_for_configuration835 returns nill if such migration does not exists836 returns the migration when it exists837 .for_gitlab_schema838 finds the migrations matching the given gitlab schema839Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper#perform840 runs the migration job841 updates the tracking record in the database842 when running a job that failed previously843 increments attempts and updates other fields844 when the migration job does not raise an error845 marks the tracking record as succeeded846 tracks metrics of the execution847 when the migration job raises an error848 behaves like an error is raised849 marks the tracking record as failed850 tracks metrics of the execution851 behaves like an error is raised852 marks the tracking record as failed853 tracks metrics of the execution854 behaves like an error is raised855 marks the tracking record as failed856 tracks metrics of the execution857 behaves like an error is raised858 marks the tracking record as failed859 tracks metrics of the execution860 when the batched background migration does not inherit from BatchedMigrationJob861 runs the job with the correct arguments862Gitlab::Database::BackgroundMigration::PrometheusMetrics863 #track864 reports batch_size865 reports sub_batch_size866 reports interval867 reports job duration868 increments updated tuples (currently based on batch_size)869 reports migrated tuples870 reports the total tuple count for the migration871 reports last updated at timestamp872 reports summary of query timings873 when the tracking record does not having timing metrics874 does not attempt to report query timings875Gitlab::Database::BackgroundMigrationJob876 is expected to be a kind of Gitlab::Database::SharedModel(abstract)877 behaves like having unique enum values878 has unique values in "status"879 .for_migration_execution880 returns jobs matching class_name and arguments881 normalizes class names by removing leading ::882 .mark_all_as_succeeded883 marks all matching jobs as succeeded884 normalizes class_names by removing leading ::885 returns the number of jobs updated886 when previous matching jobs have already succeeded887 does not update non-pending jobs888 #class_name=889 when the class_name is given without the leading ::890 sets the class_name to the given value891 when the class_name is given with the leading ::892 removes the leading :: when setting the class_name893 when the value is nil894 sets the class_name to nil895 when the values is blank896 sets the class_name to the given value897Gitlab::Database::BatchAverageCounter898 # order random899 #count900 returns correct average of weights901 does no raise an exception if transaction is not open902 when transaction is open903 raises an error904 when batch size is small905 returns correct average of weights906 when column passed is an Arel attribute907 returns correct average of weights908 when column has total count of zero909 returns the fallback value910 when one batch has nil weights (no average)911 calculates average of weights with no errors912 when batch fetch query is cancelled913 when all retries fail914 logs failing query915Gitlab::Database::BatchCount916 #batch_count917 counts table918 counts with :id field919 counts with "id" field920 counts with table.id field921 counts with Arel column922 counts table with batch_size 50K923 will not count table with a batch size less than allowed924 produces the same result with different batch sizes925 counts with a start and finish926 stops counting when finish value is reached927 defaults the batch size to 100000928 does not use BETWEEN to define the range929 behaves like when a transaction is open930 raises an error931 behaves like when batch fetch query is canceled932 reduces batch size by half and retry fetch933 when all retries fail934 logs failing query935 disallowed_configurations936 returns fallback if start is bigger than finish937 returns fallback if loops more than allowed938 returns fallback if batch size is less than min required939 raises an error if distinct count is requested940 when a relation is grouped941 count by default column942 counts grouped records943 #batch_count_with_timeout944 counts table945 counts with :id field946 counts with "id" field947 counts with table.id field948 counts with Arel column949 counts table with batch_size 50K950 will not count table with a batch size less than allowed951 produces the same result with different batch sizes952 counts with a start and finish953 stops counting when finish value is reached954 returns a partial count when timeout elapses955 starts counting from a given partial result956 behaves like when a transaction is open957 raises an error958 behaves like when batch fetch query is canceled959 reduces batch size by half and retry fetch960 when all retries fail961 logs failing query962 disallowed_configurations963 returns fallback if start is bigger than finish964 returns fallback if loops more than allowed965 returns fallback if batch size is less than min required966 raises an error if distinct count is requested967 when a relation is grouped968 count by default column969 counts grouped records970 #batch_distinct_count971 counts with column field972 counts with "id" field973 counts with table.column field974 counts with Arel column975 counts with :column field with batch_size of 50K976 will not count table with a batch size less than allowed977 produces the same result with different batch sizes978 counts with a start and finish979 stops counting when finish value is reached980 counts with User min and max as start and finish981 defaults the batch size to 10000982 behaves like when a transaction is open983 raises an error984 disallowed configurations985 returns fallback if start is bigger than finish986 returns fallback if loops more than allowed987 returns fallback if batch size is less than min required988 will raise an error if distinct count with the :id column is requested989 when a relation is grouped990 distinct count by non-unique column991 counts grouped records992 behaves like when batch fetch query is canceled993 reduces batch size by half and retry fetch994 when all retries fail995 logs failing query996 #batch_sum997 returns the sum of values in the given column998 works when given an Arel column999 works with a batch size of 50K1000 works with start and finish provided1001 returns the same result regardless of batch size1002 defaults the batch size to 10001003 behaves like when a transaction is open1004 raises an error1005 behaves like disallowed configurations1006 returns fallback if start is bigger than finish1007 returns fallback if loops more than allowed1008 returns fallback if batch size is less than min required1009 behaves like when batch fetch query is canceled1010 reduces batch size by half and retry fetch1011 when all retries fail1012 logs failing query1013 #batch_average1014 calls BatchAverageCounter1015Gitlab::Database::BulkUpdate1016 is possible to update all objects in a single query1017 is possible to update heterogeneous sets1018 error states1019 does not raise errors on valid inputs1020 expects a non-empty list of column names1021 expects all columns to be symbols1022 expects all columns to be valid columns on the tables1023 refuses to set ID1024 expects a non-empty mapping1025 expects all map values to be Hash instances1026 validates prepared_statements support1027 prepared_statements: false1028 sets multiple values1029 prepared_statements: true1030 sets multiple values1031ClickHouse::Client1032 # order random1033 when click_house spec tag is not added1034 does not have any ClickHouse databases configured1035Gitlab::Database::ConnectionTimer1036 .starting_now1037 when the configured interval is positive1038 randomizes the interval of the created timer1039 when the configured interval is not positive1040 sets the interval of the created timer to nil1041 .expired?1042 when the interval is positive1043 when the interval has elapsed1044 returns true1045 when the interval has not elapsed1046 returns false1047 when the interval is not positive1048 when the interval has elapsed1049 returns false1050 when the interval has not elapsed1051 returns false1052 when the interval is nil1053 returns false1054 .reset!1055 updates the timer clock value1056Gitlab::Database::ConsistencyChecker1057 #over_time_limit?1058 returns true only if the running time has exceeded MAX_RUNTIME1059 #execute1060 when empty tables1061 returns an empty response1062 when the tables contain matching items1063 does not process more than MAX_BATCHES1064 doesn not exceed the MAX_RUNTIME1065 returns the correct number of matches and batches checked1066 returns the min_id as the next_start_id if the check reaches the last element1067 when some items are missing from the first table1068 reports the missing elements1069 when some items are missing from the second table1070 reports the missing elements1071 when elements are different between the two tables1072 reports the difference between the two tables1073Gitlab::Database::Consistency1074 .with_read_consistency1075 sticks to primary database1076Gitlab::Database::ConvertFeatureCategoryToGroupLabel1077 # order random1078 #execute1079 when the group label exists1080 returns a group label1081 when the group label does not exist1082 returns nil1083Gitlab::Database::Count::ExactCountStrategy1084 #count1085 counts all models1086 returns default value if count times out1087Gitlab::Database::Count::ReltuplesCountStrategy1088 #count1089 when reltuples is up to date1090 uses statistics to do the count1091 when models using single-type inheritance are used1092 returns nil counts for inherited tables1093 insufficient permissions1094 returns an empty hash1095Gitlab::Database::Count::TablesampleCountStrategy1096 #count1097 for tables with an estimated small size1098 performs an exact count1099 for tables with an estimated large size1100 performs a tablesample count1101 insufficient permissions1102 returns an empty hash1103Gitlab::Database::Count1104 .approximate_counts1105 fallbacks1106 gets results from first strategy1107 gets more results from second strategy if some counts are missing1108 does not get more results as soon as all counts are present1109 default strategies1110 with a read-only database1111 only uses the ExactCountStrategy1112 with a read-write database1113 uses the available strategies1114Gitlab::Database::DatabaseConnectionInfo1115 # order random1116 .load_file1117 does load YAML file and has file_path specified1118 .new1119 does convert attributes into symbols and objects1120 does raise error when using invalid argument1121 #order1122 name: :main, order: 01123 is expected to eq 01124 name: :ci, order: 11125 is expected to eq 11126 name: :undefined, order: 10001127 is expected to eq 10001128 #has_gitlab_shared?1129 gitlab_schemas: ["gitlab_main"], result: false1130 is expected to eq false1131 gitlab_schemas: ["gitlab_main", "gitlab_shared"], result: true1132 is expected to eq true1133 #connection_class_or_fallback1134 for "main"1135 does return ActiveRecord::Base1136 for "ci"1137 does return "Ci::ApplicationRecord" when it is connection_class1138 does return "ActiveRecord::Base" (fallback to "main") when it is not connection_class1139 db_docs_dir1140 when db_dir is specified1141 is expected to eq #<Pathname:/builds/gitlab-org/gitlab/ee/my/db/docs>1142 when db_dir is not specified fallbacks to "db/docs"1143 is expected to eq #<Pathname:/builds/gitlab-org/gitlab/db/docs>1144 #connection_class1145 when klass is "ActiveRecord::Base"1146 does always return "ActiveRecord::Base"1147 when klass is "Ci::ApplicationRecord"1148 does return "Ci::ApplicationRecord" when it is connection_class1149 does return nil when it is not connection_class1150Gitlab::Database::DynamicModelHelpers1151 #define_batchable_model1152 is an ActiveRecord model1153 includes EachBatch1154 has the correct table name1155 has the inheritance type column disable1156 #each_batch1157 when no transaction is open1158 iterates table in batches1159 when a column to be batched over is specified1160 iterates table in batches using the given column1161 when transaction is open1162 raises an error1163 #each_batch_range1164 when no transaction is open1165 iterates table in batch ranges1166 yields only one batch if bigger than the table size1167 makes it possible to apply a scope1168 when primary key is not named id1169 iterates table in batch ranges using the correct primary key1170 when a column to be batched over is specified1171 iterates table in batch ranges using the given column1172 when transaction is open1173 raises an error1174Gitlab::Database::EachDatabase1175 .each_connection1176 yields each connection after connecting SharedModel1177 when only certain databases are selected1178 yields the selected connections after connecting SharedModel1179 when the selected names are passed as symbols1180 yields the selected connections after connecting SharedModel1181 when the selected names are invalid1182 does not yield any connections1183 raises an error1184 when shared connections are not included1185 only yields the unshared connections1186 .each_model_connection1187 when the model inherits from SharedModel1188 yields each model with SharedModel connected to each database connection1189 when the model limits connection names1190 only yields the model with SharedModel connected to the limited connections1191 when the model does not inherit from SharedModel1192 yields each model after connecting SharedModel1193 when the database connections are limited by the only_on option1194 when a single name is passed in1195 yields models only connected to the given database1196 when a list of names are passed in1197 yields models only connected to the given databases1198Gitlab::Database::GitlabSchemaInfo1199 # order random1200 .new1201 does ensure that name is always symbol1202 does raise error when using invalid argument1203 .load_file1204 does load YAML file and has file_path specified1205Gitlab::Database::GitlabSchema1206 .deleted_views_and_tables_to_schema1207 all tables and views have assigned a known gitlab_schema1208 .views_and_tables_to_schema1209 all tables and views have assigned a known gitlab_schema1210 all tables and views are unique1211 for /builds/gitlab-org/gitlab/db/docs1212 validates 'main' using 'ActiveRecord::Base'1213 new data sources are added1214 non-existing data sources are removed1215 validates 'ci' using 'Ci::ApplicationRecord'1216 new data sources are added1217 non-existing data sources are removed1218 .dictionary_path_globs1219 returns an array of path globs1220 returns an array of path globs1221 returns an array of path globs1222 returns an array of path globs1223 .tables_to_schema1224 returns only tables1225 .views_to_schema1226 returns only views1227 .table_schemas!1228 returns the matched schemas1229 when one of the tables does not have a matching table schema1230 raises error1231 .table_schema1232 behaves like maps table name to table schema1233 name: "ci_builds", classification: :gitlab_ci1234 is expected to eq :gitlab_ci1235 name: "my_schema.ci_builds", classification: :gitlab_ci1236 is expected to eq :gitlab_ci1237 name: "my_schema.ci_runner_machine_builds_100", classification: :gitlab_ci1238 is expected to eq :gitlab_ci1239 name: "my_schema._test_gitlab_main_table", classification: :gitlab_main1240 is expected to eq :gitlab_main1241 name: "information_schema.columns", classification: :gitlab_internal1242 is expected to eq :gitlab_internal1243 name: "audit_events_part_5fc467ac26", classification: :gitlab_main1244 is expected to eq :gitlab_main1245 name: "_test_gitlab_main_table", classification: :gitlab_main1246 is expected to eq :gitlab_main1247 name: "_test_gitlab_ci_table", classification: :gitlab_ci1248 is expected to eq :gitlab_ci1249 name: "_test_gitlab_main_clusterwide_table", classification: :gitlab_main_clusterwide1250 is expected to eq :gitlab_main_clusterwide1251 name: "_test_gitlab_main_cell_table", classification: :gitlab_main_cell1252 is expected to eq :gitlab_main_cell1253 name: "_test_gitlab_pm_table", classification: :gitlab_pm1254 is expected to eq :gitlab_pm1255 name: "_test_my_table", classification: :gitlab_shared1256 is expected to eq :gitlab_shared1257 name: "pg_attribute", classification: :gitlab_internal1258 is expected to eq :gitlab_internal1259 when mapping fails1260 is expected to be nil1261 when an index name is used as the table name1262 is expected to be nil1263 .table_schema!1264 behaves like maps table name to table schema1265 name: "ci_builds", classification: :gitlab_ci1266 is expected to eq :gitlab_ci1267 name: "my_schema.ci_builds", classification: :gitlab_ci1268 is expected to eq :gitlab_ci1269 name: "my_schema.ci_runner_machine_builds_100", classification: :gitlab_ci1270 is expected to eq :gitlab_ci1271 name: "my_schema._test_gitlab_main_table", classification: :gitlab_main1272 is expected to eq :gitlab_main1273 name: "information_schema.columns", classification: :gitlab_internal1274 is expected to eq :gitlab_internal1275 name: "audit_events_part_5fc467ac26", classification: :gitlab_main1276 is expected to eq :gitlab_main1277 name: "_test_gitlab_main_table", classification: :gitlab_main1278 is expected to eq :gitlab_main1279 name: "_test_gitlab_ci_table", classification: :gitlab_ci1280 is expected to eq :gitlab_ci1281 name: "_test_gitlab_main_clusterwide_table", classification: :gitlab_main_clusterwide1282 is expected to eq :gitlab_main_clusterwide1283 name: "_test_gitlab_main_cell_table", classification: :gitlab_main_cell1284 is expected to eq :gitlab_main_cell1285 name: "_test_gitlab_pm_table", classification: :gitlab_pm1286 is expected to eq :gitlab_pm1287 name: "_test_my_table", classification: :gitlab_shared1288 is expected to eq :gitlab_shared1289 name: "pg_attribute", classification: :gitlab_internal1290 is expected to eq :gitlab_internal1291 when mapping fails1292 raises error1293 when testing cross schema access1294 .cross_joins_allowed?1295 schemas: [], result: true1296 is expected to eq true1297 schemas: [:gitlab_main_clusterwide, :gitlab_main], result: true1298 is expected to eq true1299 schemas: [:gitlab_main_clusterwide, :gitlab_ci], result: false1300 is expected to eq false1301 schemas: [:gitlab_main_clusterwide, :gitlab_main, :gitlab_ci], result: false1302 is expected to eq false1303 schemas: [:gitlab_main_clusterwide, :gitlab_internal], result: false1304 is expected to eq false1305 schemas: [:gitlab_main, :gitlab_ci], result: false1306 is expected to eq false1307 schemas: [:gitlab_main_clusterwide, :gitlab_main, :gitlab_shared], result: true1308 is expected to eq true1309 schemas: [:gitlab_main_clusterwide, :gitlab_shared], result: true1310 is expected to eq true1311 .cross_transactions_allowed?1312 schemas: [], result: true1313 is expected to eq true1314 schemas: [:gitlab_main_clusterwide, :gitlab_main], result: true1315 is expected to eq true1316 schemas: [:gitlab_main_clusterwide, :gitlab_ci], result: false1317 is expected to eq false1318 schemas: [:gitlab_main_clusterwide, :gitlab_main, :gitlab_ci], result: false1319 is expected to eq false1320 schemas: [:gitlab_main_clusterwide, :gitlab_internal], result: true1321 is expected to eq true1322 schemas: [:gitlab_main, :gitlab_ci], result: false1323 is expected to eq false1324 schemas: [:gitlab_main_clusterwide, :gitlab_main, :gitlab_shared], result: true1325 is expected to eq true1326 schemas: [:gitlab_main_clusterwide, :gitlab_shared], result: true1327 is expected to eq true1328 .cross_foreign_key_allowed?1329 schemas: [], result: false1330 is expected to eq false1331 schemas: [:gitlab_main_clusterwide, :gitlab_main], result: true1332 is expected to eq true1333 schemas: [:gitlab_main_clusterwide, :gitlab_ci], result: false1334 is expected to eq false1335 schemas: [:gitlab_main_clusterwide, :gitlab_internal], result: false1336 is expected to eq false1337 schemas: [:gitlab_main, :gitlab_ci], result: false1338 is expected to eq false1339 schemas: [:gitlab_main_clusterwide, :gitlab_shared], result: false1340 is expected to eq false1341Gitlab::Database::Grant1342 .create_and_execute_trigger1343 returns true when the user can create and execute a trigger1344 returns false when the user can not create and/or execute a trigger1345Gitlab::Database::HealthStatus::Indicators::AutovacuumActiveOnTable1346 # order random1347 #evaluate1348 without autovacuum activity1349 returns Normal signal1350 remembers the indicator class1351 with autovacuum activity1352 returns Stop signal1353 explains why1354 remembers the indicator class1355 returns NoSignal signal in case the feature flag is disabled1356Gitlab::Database::HealthStatus::Indicators::PatroniApdex1357 # order random1358 #evaluate1359 behaves like Patroni Apdex Evaluator1360 with main schema1361 returns NoSignal signal in case the feature flag is disabled1362 returns Normal signal when Patroni apdex SLI is above SLO1363 returns Stop signal when Patroni apdex is below SLO1364 without database_apdex_settings1365 returns Unknown signal1366 when Prometheus client is not ready1367 returns Unknown signal1368 when apdex SLI query is not configured1369 returns Unknown signal1370 when slo is not configured1371 returns Unknown signal1372 when Patroni apdex can not be calculated1373 result: nil1374 returns Unknown signal1375 result: []1376 returns Unknown signal1377 result: [{}]1378 returns Unknown signal1379 result: [{"value"=>1}]1380 returns Unknown signal1381 result: [{"value"=>[1]}]1382 returns Unknown signal1383 behaves like Patroni Apdex Evaluator1384 with ci schema1385 returns NoSignal signal in case the feature flag is disabled1386 returns Normal signal when Patroni apdex SLI is above SLO1387 returns Stop signal when Patroni apdex is below SLO1388 without database_apdex_settings1389 returns Unknown signal1390 when Prometheus client is not ready1391 returns Unknown signal1392 when apdex SLI query is not configured1393 returns Unknown signal1394 when slo is not configured1395 returns Unknown signal1396 when Patroni apdex can not be calculated1397 result: nil1398 returns Unknown signal1399 result: []1400 returns Unknown signal1401 result: [{}]1402 returns Unknown signal1403 result: [{"value"=>1}]1404 returns Unknown signal1405 result: [{"value"=>[1]}]1406 returns Unknown signal1407Gitlab::Database::HealthStatus::Indicators::WriteAheadLog1408 # order random1409 #evaluate1410 remembers the indicator class1411 returns NoSignal signal in case the feature flag is disabled1412 returns NoSignal signal when WAL archive queue can not be calculated1413 uses primary database1414 when WAL archive queue size is below the limit1415 returns Normal signal1416 when WAL archive queue size is above the limit1417 returns Stop signal1418Gitlab::Database::HealthStatus::Logger1419 # order random1420 excludes context1421 behaves like a json logger1422 formats strings1423 formats hashes1424Gitlab::Database::HealthStatus::Signals1425 # order random1426 with Normal signal it should not stop and log1427 behaves like health status signal1428 #log_info?1429 returns the log signal1430 #stop?1431 returns the stop signal1432 with Stop signal it should stop and log1433 behaves like health status signal1434 #log_info?1435 returns the log signal1436 #stop?1437 returns the stop signal1438 with NotAvailable signal it should not stop and log1439 behaves like health status signal1440 #log_info?1441 returns the log signal1442 #stop?1443 returns the stop signal1444 with Unknown signal it should only log and not stop1445 behaves like health status signal1446 #log_info?1447 returns the log signal1448 #stop?1449 returns the stop signal1450Gitlab::Database::HealthStatus1451 # order random1452 .evaluate1453 returns the signal of the given indicator1454 does not log signals of no interest1455 with default indicators1456 returns a collection of signals1457 with stop signals1458 with batched migrations as the status checker1459 captures BatchedMigration class name in the log1460 with sidekiq deferred job as the status checker1461 captures sidekiq job class in the log1462 on indicator error1463 does not fail1464 returns Unknown signal1465 reports the exception to error tracking1466Gitlab::Database::LoadBalancing::ActionCableCallbacks1467 .wrapper1468 releases the connection and clears the session1469 with an exception1470 releases the connection and clears the session1471Gitlab::Database::LoadBalancing::Configuration1472 .for_model1473 when load balancing is not configured1474 uses the default settings1475 when load balancing is configured1476 uses the custom configuration settings1477 when the load balancing configuration uses strings as the keys1478 uses the custom configuration settings1479 #load_balancing_enabled?1480 returns false when running inside a Rake task1481 returns true when hosts are configured1482 returns true when a service discovery record is configured1483 returns false when no hosts are configured and service discovery is disabled1484 #service_discovery_enabled?1485 returns false when running inside a Rake task1486 returns true when a record is configured1487 returns false when no record is configured1488 #pool_size1489 when a custom pool size is used1490 always reads the value from the model configuration1491 when the pool size is nil1492 returns the default pool size1493 #db_config_name1494 returns connection name as symbol1495 #db_config1496 returns exactly db_config1497Gitlab::Database::LoadBalancing::ConnectionProxy1498 #select1499 performs a read1500 #select_all1501 method signatures match1502 using a SELECT query1503 runs the query on a secondary1504 using a SELECT FOR UPDATE query1505 runs the query on the primary and sticks to it1506 sanitize_limit1507 runs the query on the replica1508 select1509 runs the query on the replica1510 select_one1511 runs the query on the replica1512 select_rows1513 runs the query on the replica1514 quote_column_name1515 runs the query on the replica1516 delete1517 runs the query on the primary and sticks to it1518 delete_all1519 runs the query on the primary and sticks to it1520 insert1521 runs the query on the primary and sticks to it1522 update1523 runs the query on the primary and sticks to it1524 update_all1525 runs the query on the primary and sticks to it1526 exec_insert_all1527 runs the query on the primary and sticks to it1528 methods using exec_insert_all on the connection1529 #upsert1530-- create_table(:_test_connection_proxy_insert_all, {:force=>true})1531 -> 0.0074s1532-- drop_table(:_test_connection_proxy_insert_all, {:force=>true})1533 -> 0.0017s1534 upserts a record and marks the session to stick to the primary1535 #insert_all!1536-- create_table(:_test_connection_proxy_insert_all, {:force=>true})1537 -> 0.0066s1538-- drop_table(:_test_connection_proxy_insert_all, {:force=>true})1539 -> 0.0024s1540 inserts multiple records and marks the session to stick to the primary1541 #insert1542-- create_table(:_test_connection_proxy_insert_all, {:force=>true})1543 -> 0.0064s1544-- drop_table(:_test_connection_proxy_insert_all, {:force=>true})1545 -> 0.0018s1546 inserts a single record and marks the session to stick to the primary1547 #transaction1548 session fallbacks ambiguous queries to replicas1549 with a read query1550 runs the transaction and any nested queries on the replica1551 with a write query1552 raises an exception1553 session does not fallback to replicas for ambiguous queries1554 with a read query1555 runs the transaction and any nested queries on the primary and stick to it1556 with a write query1557 runs the transaction and any nested queries on the primary and stick to it1558 #method_missing1559 runs the query on the primary without sticking to it1560 properly forwards keyword arguments1561 current session prefers to fallback ambiguous queries to replicas1562 runs the query on the replica1563 properly forwards keyword arguments1564 #read_using_load_balancer1565 with a regular session1566 uses a secondary1567 with a regular session and forcing all reads to replicas1568 uses a secondary1569 with a session using the primary but forcing all reads to replicas1570 uses a secondary1571 with a session using the primary1572 uses the primary1573 #write_using_load_balancer1574 uses but does not stick to the primary1575Gitlab::Database::LoadBalancing::HostList1576 #initialize1577 sets metrics for current number of hosts and current index1578 #length1579 returns the number of hosts in the list1580 #host_names_and_ports1581 with ports1582 returns the host names of all hosts1583 without ports1584 returns the host names of all hosts1585 #hosts1586 returns a copy of the host1587 #hosts=1588 updates the list of hosts to use1589 #next1590 returns a host1591 cycles through all available hosts1592 skips hosts that are offline1593 returns nil if no hosts are online1594 returns nil if no hosts are available1595 #shuffle1596 randomizes the list1597Gitlab::Database::LoadBalancing::Host1598 #connection1599 returns a connection from the pool1600 #disconnect!1601 disconnects the pool1602 disconnects the pool when waiting for connections takes too long1603 #release_connection1604 releases the current connection from the pool1605 #offline!1606 marks the host as offline1607 #online?1608 when the replica status is recent enough1609 returns the latest status1610 returns an offline status1611 when the replica status is outdated1612 refreshes the status1613 and replica is not up to date1614 marks the host offline1615 when the replica is not online1616 returns false when ActionView::Template::Error is raised1617 returns false when ActiveRecord::StatementInvalid is raised1618 returns false when PG::Error is raised1619 returns false when ActiveRecord::ConnectionNotEstablished is raised1620 #refresh_status1621 refreshes the status1622 clears the cache for latest_lsn_query1623 #check_replica_status?1624 returns true when we need to check the replica status1625 returns false when we do not need to check the replica status1626 #replica_is_up_to_date?1627 when the lag time is below the threshold1628 returns true1629 when the lag time exceeds the threshold1630 returns true if the data is recent enough1631 returns false when the data is not recent enough1632 #replication_lag_below_threshold1633 returns true when the lag time is below the threshold1634 returns false when the lag time exceeds the threshold1635 returns false when no lag time could be calculated1636 #data_is_recent_enough?1637 returns true when the data is recent enough1638 returns false when the data is not recent enough1639 returns false when no lag size could be calculated1640 #replication_lag_time1641 returns the lag time as a Float1642 returns nil when the database query returned no rows1643 #replication_lag_size1644 returns the lag size as an Integer1645 returns nil when the database query returned no rows1646 returns nil when the database connection fails1647 when can_track_logical_lsn? is false1648 uses LATEST_LSN_WITHOUT_LOGICAL_QUERY1649 when can_track_logical_lsn? is true1650 uses LATEST_LSN_WITH_LOGICAL_QUERY1651 when CAN_TRACK_LOGICAL_LSN_QUERY raises connection errors1652 uses LATEST_LSN_WITHOUT_LOGICAL_QUERY1653 #primary_write_location1654 returns the write location of the primary1655 #caught_up?1656 returns true when a host has caught up1657 returns false when diff query returns nothing1658 returns false when a host has not caught up1659 returns false when the connection fails1660 #database_replica_location1661 returns the write ahead location of the replica1662 returns nil when the database query returned no rows1663 returns nil when the database connection fails1664 #query_and_release1665 executes a SQL query1666 releases the connection after running the query1667 returns an empty Hash in the event of an error1668 #host1669 returns the hostname1670Gitlab::Database::LoadBalancing::LoadBalancer1671 #initialize1672 ignores the hosts when load balancing is disabled1673 sets the name of the connection that is used1674 #read1675 yields a connection for a read1676 ensures that query cache is enabled1677 does not enable query cache when outside Rails executor context1678 marks hosts that are offline1679 retries a query in the event of a serialization failure1680 retries every host at most 3 times when a query conflict is raised1681 uses the primary if no secondaries are available1682 uses the primary when load balancing is disabled1683 behaves like logs service discovery thread interruption1684 with service discovery1685 calls logs service discovery thread interruption1686 only primary is configured1687 does not retry a query on connection error if only the primary is configured1688 #read_write1689 yields a connection for a write1690 uses a retry with exponential backoffs1691 does not raise NoMethodError error when primary_only?1692 behaves like logs service discovery thread interruption1693 with service discovery1694 calls logs service discovery thread interruption1695 #host1696 returns the secondary host to use1697 stores the host in a thread-local variable1698 does not create conflicts with other load balancers when caching hosts1699 #release_host1700 releases the host and its connection1701 #release_primary_connection1702 releases the connection to the primary1703 #primary_write_location1704 returns a String in the right format1705 raises an error if the write location could not be retrieved1706 #retry_with_backoff1707 returns the value returned by the block1708 re-raises errors not related to database connections1709 retries the block when a connection error is raised1710 re-raises the connection error if the retries did not succeed1711 skips retries when only the primary is used1712 yields the current retry iteration1713 #connection_error?1714 returns true for a connection error1715 returns false for a missing database error1716 returns true for a wrapped connection error1717 returns true for a wrapped connection error from a view1718 returns true for deeply wrapped/nested errors1719 returns true for an invalid encoding error1720 returns false for errors not related to database connections1721 returns false for ActiveRecord errors without a cause1722 #serialization_failure?1723 returns for a serialization error1724 returns true for a wrapped error1725 #select_up_to_date_host1726 when none of the replicas are caught up1727 returns false and does not update the host thread-local variable1728 when any of the replicas is caught up1729 returns true and sets host thread-local variable1730 #create_replica_connection_pool1731 creates a new connection pool with specific pool size and name1732 allows setting of a custom hostname and port1733 does not modify connection class pool1734 #disconnect!1735 calls disconnect on all hosts with a timeout1736 #get_write_location1737 returns a string1738 returns nil if there are no results1739 #wal_diff1740 returns the diff between two write locations1741Gitlab::Database::LoadBalancing::Logger1742 # order random1743 excludes context1744 behaves like a json logger1745 formats strings1746 formats hashes1747Gitlab::Database::LoadBalancing::PrimaryHost1748 #connection1749 returns a connection from the pool1750 #release_connection1751 does nothing1752 #enable_query_cache!1753 does nothing1754 #disable_query_cache!1755 does nothing1756 #query_cache_enabled1757 delegates to the primary connection pool1758 #disconnect!1759 does nothing1760 #offline!1761 logs the event but does nothing else1762 #online?1763 returns true1764 #primary_write_location1765 raises NotImplementedError1766 #caught_up?1767 returns true1768 #database_replica_location1769 raises NotImplementedError1770Gitlab::Database::LoadBalancing::RackMiddleware1771 #call1772 handles a request1773 #unstick_or_continue_sticking1774 does not stick if no namespace and identifier could be found1775 sticks to the primary if a warden user is found1776 sticks to the primary if a sticking namespace and identifier is found1777 sticks to the primary if multiple sticking namespaces and identifiers were found1778 #stick_if_necessary1779 does not stick to the primary if not necessary1780 sticks to the primary if a warden user is found1781 sticks to the primary if a a single sticking object is found1782 sticks to the primary if multiple sticking namespaces and identifiers were found1783 #clear1784 clears the currently used host and session1785 #sticking_namespaces1786 using a Warden request1787 returns the warden user if present1788 returns an empty Array if no user was present1789 using a request with a manually set sticking object1790 returns the sticking object1791 using a regular request1792 returns an empty Array1793Gitlab::Database::LoadBalancing::Resolver1794 #resolve1795 when nameserver is an IP1796 returns an IPAddr object1797 when nameserver is not an IP1798 looks the nameserver up in the hosts file1799 when nameserver is not in the hosts file1800 looks the nameserver up in DNS1801 when nameserver is not in DNS1802 raises an exception1803 when DNS does not respond1804 raises an exception1805Gitlab::Database::LoadBalancing::ServiceDiscovery::Sampler1806 # order random1807 #sample1808 samples max_replica_pools addresses1809 samples random ports across all hosts1810 returns the same answer for the same input when called multiple times1811 gives a consistent answer regardless of input ordering1812 samples fairly across all hosts1813 when input is an empty array1814 returns an empty array1815 when there are less replicas than max_replica_pools1816 returns the same addresses1817 when max_replica_pools is nil1818 returns the same addresses1819Gitlab::Database::LoadBalancing::ServiceDiscovery1820 #initialize1821 :record_type1822 with a supported type1823 is expected to eq 331824 with an unsupported type1825 raises an argument error1826 #start1827 starts service discovery in a new thread with proper assignments1828 #perform_service_discovery1829 without any failures1830 runs once1831 with StandardError1832 retries service discovery when under the retry limit1833 does not retry service discovery after exceeding the limit1834 reports exceptions to Sentry1835 #refresh_if_necessary1836 when a refresh is necessary1837 refreshes the load balancer hosts1838 when a refresh is not necessary1839 does not refresh the load balancer hosts1840 #replace_hosts1841 replaces the hosts of the load balancer1842 disconnects the old connections1843 #addresses_from_dns1844 with an A record1845 returns a TTL and ordered list of IP addresses1846 with an SRV record1847 returns a TTL and ordered list of hosts1848 when max_replica_pools is set1849 when the number of addresses exceeds max_replica_pools1850 limits to max_replica_pools1851 when the number of addresses is less than max_replica_pools1852 returns all addresses1853 when the resolver returns an empty response1854 raises EmptyDnsResponse1855 #new_wait_time_for1856 returns the DNS TTL if greater than the default interval1857 returns the default interval if greater than the DNS TTL1858 returns the default interval if no resources are given1859 #addresses_from_load_balancer1860 returns the ordered host names of the load balancer1861 #resolver1862 without predefined resolver1863 fetches a new resolver and assigns it to the instance variable1864 with predefined resolver1865 when nameserver's TTL is in the future1866 returns the existing resolver1867 when nameserver's TTL is in the past1868 fetches new resolver1869 #log_refresh_thread_interruption1870 without refresh thread timestamp1871 does not log any interruption1872 with refresh thread timestamp1873 does not log if last run time plus delta is in future1874 with way past last run timestamp1875 does not log if the interruption is already logged1876 logs the error if the interruption was not logged before1877Gitlab::Database::LoadBalancing::Session1878 .current1879 returns the current session1880 .clear_session1881 clears the current session1882 .without_sticky_writes1883 ignores sticky write events sent by a connection proxy1884 still is aware of write that happened1885 #use_primary?1886 returns true when the primary should be used1887 returns false when a secondary should be used1888 returns true when a write was performed1889 #use_primary1890 uses primary during block1891 continues using primary when write was performed1892 when primary was used before1893 restores state after use1894 when primary was not used1895 restores state after use1896 #performed_write?1897 returns true if a write was performed1898 #ignore_writes1899 ignores write events1900 does not prevent using primary if an exception is raised1901 #use_replicas_for_read_queries1902 sets the flag inside the block1903 restores state after use1904 when primary was used before1905 sets the flag inside the block1906 when a write query is performed before1907 sets the flag inside the block1908 #fallback_to_replicas_for_ambiguous_queries1909 sets the flag inside the block1910 restores state after use1911 when primary was used before1912 uses primary during block1913 when a write was performed before1914 uses primary during block1915 when primary was used inside the block1916 uses primary aterward1917 restores state after use1918 when a write was performed inside the block1919 uses primary aterward1920 restores state after use1921Gitlab::Database::LoadBalancing::Setup1922 #setup1923 sets up the load balancer1924 #configure_connection1925 configures pool, prepared statements and reconnects to the database1926 #setup_connection_proxy1927 sets up the load balancer1928 #setup_service_discovery1929 when service discovery is disabled1930 does nothing1931 when service discovery is enabled1932 immediately performs service discovery1933 starts service discovery if needed1934 uses correct base models1935 results match expectations1936 does return load_balancer assigned to a given connection1937Gitlab::Database::LoadBalancing::SidekiqClientMiddleware1938 #call1939 when worker cannot be constantized1940 does not pass database locations1941 sets job data consistency1942 when worker class does not include ApplicationWorker1943 does not pass database locations1944 sets job data consistency1945 when job contains wrapped worker1946 when wrapped worker does not include WorkerAttributes1947 does not pass database locations1948 sets job data consistency1949 when wrapped worker includes WorkerAttributes1950 when write was not performed1951 sets job data consistency1952 when replica hosts are available1953 passes database_replica_location1954 when no replica hosts are available1955 passes primary_write_location1956 when write was performed1957 passes primary write location1958 sets job data consistency1959 database wal location was already provided1960 when write was performed1961 does not set database locations again1962 when write was not performed1963 does not set database locations again1964 when worker data consistency is :always1965 does not pass database locations1966 sets job data consistency1967 when worker data consistency is :delayed1968 when write was not performed1969 sets job data consistency1970 when replica hosts are available1971 passes database_replica_location1972 when no replica hosts are available1973 passes primary_write_location1974 when write was performed1975 passes primary write location1976 sets job data consistency1977 when worker data consistency is :sticky1978 when write was not performed1979 sets job data consistency1980 when replica hosts are available1981 passes database_replica_location1982 when no replica hosts are available1983 passes primary_write_location1984 when write was performed1985 passes primary write location1986 sets job data consistency1987Gitlab::Database::LoadBalancing::SidekiqServerMiddleware1988 #call1989 when worker class does not include WorkerAttributes1990 sticks to the primary1991 sets load balancing strategy to primary1992 when job contains wrapped worker class1993 uses wrapped job if available1994 when worker data consistency is :always1995 sticks to the primary1996 sets load balancing strategy to primary1997 when delay interval has not elapsed1998 does not sleep1999 when worker data consistency is :delayed2000 when database wal location is set2001 behaves like replica is up to date2002 does not stick to the primary2003 sets load balancing strategy to replica2004 when deduplication wal location is set2005 behaves like replica is up to date2006 does not stick to the primary2007 sets load balancing strategy to replica2008 when database location is not set2009 sticks to the primary2010 sets load balancing strategy to primary_no_wal2011 when WAL locations are blank2012 does not sleep2013 when WAL locations are present2014 when delay interval has not elapsed2015 when replica is up to date2016 does not sleep2017 when replica is not up to date2018 sleeps until the minimum delay is reached2019 when replica is never not up to date2020 sleeps until the maximum delay is reached2021 when replica is not up to date2022 when job is executed first2023 raises an error and retries2024 sets load balancing strategy to retry2025 when job is retried2026 and replica still lagging behind2027 sticks to the primary2028 sets load balancing strategy to primary2029 and replica is now up-to-date2030 does not stick to the primary2031 sets load balancing strategy to replica_retried2032 when worker data consistency is :sticky2033 when database wal location is set2034 behaves like replica is up to date2035 does not stick to the primary2036 sets load balancing strategy to replica2037 when deduplication wal location is set2038 behaves like replica is up to date2039 does not stick to the primary2040 sets load balancing strategy to replica2041 when database location is not set2042 sticks to the primary2043 sets load balancing strategy to primary_no_wal2044 when WAL locations are blank2045 does not sleep2046 when WAL locations are present2047 when delay interval has not elapsed2048 when replica is up to date2049 does not sleep2050 when replica is not up to date2051 sleeps until the minimum delay is reached2052 when replica is never not up to date2053 sleeps until the maximum delay is reached2054 when replica is not up to date2055 sticks to the primary2056 sets load balancing strategy to primary2057 #databases_in_sync?2058 treats load balancers without WAL entries as in sync2059 returns true when all load balancers are in sync2060 returns false when the load balancers are not in sync2061 when locations have string keys2062 returns false when the load balancers are not in sync2063Gitlab::Database::LoadBalancing::SrvResolver2064 #address_for2065 when additional section contains an A record2066 returns an IP4 address2067 when additional section contains an AAAA record2068Net::DNS unsupported record type: uninitialized constant Net::DNS::RR::OPT2069Did you mean? Net::DNS::OPT2070 returns an IP6 address2071 when additional section does not contain A nor AAAA records2072 when host resolves to an A record2073 returns an IP4 address2074 when host does resolves to an AAAA record2075Net::DNS unsupported record type: uninitialized constant Net::DNS::RR::OPT2076Did you mean? Net::DNS::OPT2077 returns an IP6 address2078Gitlab::Database::LoadBalancing::Sticking2079 with multi-store feature flags turned on2080 behaves like tracking status in redis2081 #stick_or_unstick_request2082 sticks or unsticks a single object and updates the Rack environment2083 sticks or unsticks multiple objects and updates the Rack environment2084 #stick_if_necessary2085 does not stick if no write was performed2086 sticks to the primary if a write was performed2087 #all_caught_up?2088 when no write location could be found2089 returns true2090 when all secondaries have caught up2091 returns true, and unsticks2092 notifies with the proper event payload2093 when the secondaries have not yet caught up2094 returns false2095 notifies with the proper event payload2096 #unstick_or_continue_sticking2097 simply returns if no write location could be found2098 unsticks if all secondaries have caught up2099 continues using the primary if the secondaries have not yet caught up2100 #stick2101 behaves like sticking2102 sticks an entity to the primary2103 does not update the write location when no replicas are used2104 #bulk_stick2105 behaves like sticking2106 sticks an entity to the primary2107 does not update the write location when no replicas are used2108 #mark_primary_write_location2109 updates the write location with the load balancer2110 does nothing when no replicas are used2111 #unstick2112 removes the sticking data from Redis2113 #last_write_location_for2114 returns the last WAL write location for a user2115 #select_caught_up_replicas2116 with no write location2117 returns false and does not try to find caught up hosts2118 with write location2119 returns true, selects hosts, and unsticks if any secondary has caught up2120 when both multi-store feature flags are off2121 behaves like tracking status in redis2122 #stick_or_unstick_request2123 sticks or unsticks a single object and updates the Rack environment2124 sticks or unsticks multiple objects and updates the Rack environment2125 #stick_if_necessary2126 does not stick if no write was performed2127 sticks to the primary if a write was performed2128 #all_caught_up?2129 when no write location could be found2130 returns true2131 when all secondaries have caught up2132 returns true, and unsticks2133 notifies with the proper event payload2134 when the secondaries have not yet caught up2135 returns false2136 notifies with the proper event payload2137 #unstick_or_continue_sticking2138 simply returns if no write location could be found2139 unsticks if all secondaries have caught up2140 continues using the primary if the secondaries have not yet caught up2141 #stick2142 behaves like sticking2143 sticks an entity to the primary2144 does not update the write location when no replicas are used2145 #bulk_stick2146 behaves like sticking2147 sticks an entity to the primary2148 does not update the write location when no replicas are used2149 #mark_primary_write_location2150 updates the write location with the load balancer2151 does nothing when no replicas are used2152 #unstick2153 removes the sticking data from Redis2154 #last_write_location_for2155 returns the last WAL write location for a user2156 #select_caught_up_replicas2157 with no write location2158 returns false and does not try to find caught up hosts2159 with write location2160 returns true, selects hosts, and unsticks if any secondary has caught up2161 #redis_key_for2162 returns a String2163Load balancer behavior with errors inside a transaction2164 in a transaction2165 raises an exception when a retry would occur2166 without a transaction2167 retries2168Gitlab::Database::LoadBalancing2169 .base_models2170 returns the models to apply load balancing to2171 returns the models as a frozen array2172 .each_load_balancer2173 yields every load balancer to the supplied block2174 returns an Enumerator when no block is given2175 .primary_only?2176 returns true if all load balancers have no replicas2177 returns false if at least one has replicas2178 .release_hosts2179 releases the host of every load balancer2180 .db_role_for_connection2181 when the NullPool is used for connection2182 returns unknown2183 when the load balancing is configured2184 when a proxy connection is used2185 returns :unknown2186 when an invalid connection is used2187 returns :unknown2188 when a null connection is used2189 returns :unknown2190 when a read connection is used2191 returns :replica2192 when a read_write connection is used2193 returns :primary2194 LoadBalancing integration tests2195-- create_table(:_test_load_balancing_test, {:force=>true})2196 -> 0.0044s2197 queries: -> { model.first }, include_transaction: false, expected_results: [:replica]2198 redirects queries to the right roles2199 queries: -> { model.find_by(id: 123) }, include_transaction: false, expected_results: [:replica]2200 redirects queries to the right roles2201 queries: -> { model.where(name: 'hello').to_a }, include_transaction: false, expected_results: [:replica]2202 redirects queries to the right roles2203 queries: -> { model.create!(name: 'test1') }, include_transaction: false, expected_results: [:primary]2204 redirects queries to the right roles2205 queries: -> {2206 instance = model.create!(name: 'test1')2207 instance.update!(name: 'test2')2208 }, include_transaction: false, expected_results: [:primary, :primary]2209 redirects queries to the right roles2210 queries: -> { model.update_all(name: 'test2') }, include_transaction: false, expected_results: [:primary]2211 redirects queries to the right roles2212 queries: -> {2213 instance = model.create!(name: 'test1')2214 instance.destroy!2215 }, include_transaction: false, expected_results: [:primary, :primary]2216 redirects queries to the right roles2217 queries: -> { model.delete_all }, include_transaction: false, expected_results: [:primary]2218 redirects queries to the right roles2219 queries: -> { model.connection.exec_query('SELECT 1').to_a }, include_transaction: false, expected_results: [:primary]2220 redirects queries to the right roles2221 queries: -> {2222 model.first2223 model.create!(name: 'test1')2224 model.first2225 model.find_by(name: 'test1')2226 }, include_transaction: false, expected_results: [:replica, :primary, :primary, :primary]2227 redirects queries to the right roles2228 queries: -> {2229 model.transaction do2230 model.find_by(name: 'test1')2231 model.create!(name: 'test1')2232 instance = model.find_by(name: 'test1')2233 instance.update!(name: 'test2')2234 end2235 model.find_by(name: 'test1')2236 }, include_transaction: true, expected_results: [:primary, :primary, :primary, :primary, :primary, :primary, :primary]2237 redirects queries to the right roles2238 queries: -> {2239 model.transaction do2240 model.transaction do2241 model.create!(name: 'test1')2242 end2243 model.update_all(name: 'test2')2244 end2245 model.find_by(name: 'test1')2246 }, include_transaction: true, expected_results: [:primary, :primary, :primary, :primary, :primary]2247 redirects queries to the right roles2248 queries: -> {2249 model.transaction do2250 model.first2251 model.where(name: 'test1').to_a2252 end2253 }, include_transaction: true, expected_results: [:primary, :primary, :primary, :primary]2254 redirects queries to the right roles2255 queries: -> {2256 ::Gitlab::Database::LoadBalancing::Session.current.use_primary do2257 model.first2258 model.where(name: 'test1').to_a2259 end2260 model.first2261 }, include_transaction: false, expected_results: [:primary, :primary, :replica]2262 redirects queries to the right roles2263 queries: -> {2264 model.first2265 ::Gitlab::Database::LoadBalancing::Session.current.use_primary!2266 model.where(name: 'test1').to_a2267 }, include_transaction: false, expected_results: [:replica, :primary]2268 redirects queries to the right roles2269 queries: -> {2270 ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries do2271 model.where(name: 'test1').to_a2272 end2273 }, include_transaction: false, expected_results: [:replica]2274 redirects queries to the right roles2275 queries: -> {2276 ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries do2277 model.create!(name: 'test1')2278 end2279 }, include_transaction: false, expected_results: [:primary]2280 redirects queries to the right roles2281 queries: -> {2282 ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries do2283 model.connection.exec_query("SELECT 1")2284 end2285 }, include_transaction: false, expected_results: [:primary]2286 redirects queries to the right roles2287 queries: -> {2288 ::Gitlab::Database::LoadBalancing::Session.current.use_primary!2289 ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries do2290 model.where(name: 'test1').to_a2291 end2292 }, include_transaction: false, expected_results: [:replica]2293 redirects queries to the right roles2294 queries: -> {2295 ::Gitlab::Database::LoadBalancing::Session.current.use_primary!2296 ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries do2297 model.create!(name: 'test1')2298 end2299 }, include_transaction: false, expected_results: [:primary]2300 redirects queries to the right roles2301 queries: -> {2302 ::Gitlab::Database::LoadBalancing::Session.current.use_primary!2303 ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries do2304 model.connection.exec_query('SELECT 1')2305 end2306 }, include_transaction: false, expected_results: [:primary]2307 redirects queries to the right roles2308 queries: -> {2309 ::Gitlab::Database::LoadBalancing::Session.current.use_primary do2310 ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries do2311 model.where(name: 'test1').to_a2312 end2313 end2314 }, include_transaction: false, expected_results: [:replica]2315 redirects queries to the right roles2316 queries: -> {2317 ::Gitlab::Database::LoadBalancing::Session.current.write!2318 ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries do2319 model.where(name: 'test1').to_a2320 end2321 }, include_transaction: false, expected_results: [:replica]2322 redirects queries to the right roles2323 queries: -> {2324 ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do2325 model.first2326 model.where(name: 'test1').to_a2327 end2328 }, include_transaction: false, expected_results: [:replica, :replica]2329 redirects queries to the right roles2330 queries: -> {2331 ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do2332 model.transaction do2333 model.first2334 model.where(name: 'test1').to_a2335 end2336 end2337 }, include_transaction: false, expected_results: [:replica, :replica]2338 redirects queries to the right roles2339 queries: -> {2340 ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do2341 model.connection.exec_query("SELECT 1")2342 end2343 }, include_transaction: false, expected_results: [:replica]2344 redirects queries to the right roles2345 queries: -> {2346 ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do2347 model.transaction do2348 model.connection.exec_query("SET LOCAL statement_timeout = 5000")2349 model.count2350 end2351 end2352 }, include_transaction: true, expected_results: [:replica, :replica, :replica, :replica]2353 redirects queries to the right roles2354 queries: -> {2355 model.create!(name: 'Test1')2356 ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do2357 model.connection.exec_query("SELECT 1")2358 end2359 }, include_transaction: false, expected_results: [:primary, :primary]2360 redirects queries to the right roles2361 queries: -> {2362 ::Gitlab::Database::LoadBalancing::Session.current.use_primary!2363 ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do2364 model.connection.exec_query("SELECT 1")2365 end2366 }, include_transaction: false, expected_results: [:primary]2367 redirects queries to the right roles2368 queries: -> {2369 ::Gitlab::Database::LoadBalancing::Session.current.use_primary do2370 ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do2371 model.connection.exec_query("SELECT 1")2372 end2373 end2374 }, include_transaction: false, expected_results: [:primary]2375 redirects queries to the right roles2376 queries: -> {2377 ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do2378 ::Gitlab::Database::LoadBalancing::Session.current.use_primary do2379 model.connection.exec_query("SELECT 1")2380 end2381 end2382 }, include_transaction: false, expected_results: [:primary]2383 redirects queries to the right roles2384 queries: -> {2385 ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do2386 model.connection.exec_query("SELECT 1")2387 model.delete_all2388 model.connection.exec_query("SELECT 1")2389 end2390 }, include_transaction: false, expected_results: [:replica, :primary, :primary]2391 redirects queries to the right roles2392 queries: -> {2393 ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries do2394 ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do2395 model.connection.exec_query('SELECT 1')2396 model.where(name: 'test1').to_a2397 end2398 end2399 }, include_transaction: false, expected_results: [:replica, :replica]2400 redirects queries to the right roles2401 custom connection handling2402 queries: -> {2403 ::Gitlab::Database::LoadBalancing::Session.current.use_primary!2404 model.connection.clear_cache!2405 model.connection.schema_cache.add('users')2406 model.connection.pool.release_connection2407 }, expected_role: :replica2408 redirects queries to the right roles2409 queries: -> {2410 connection = model.connection2411 connection.select_one('SELECT 1')2412 connection.pool.release_connection2413 }, expected_role: :replica2414 redirects queries to the right roles2415 queries: -> {2416 connection = model.retrieve_connection2417 connection.select_one('SELECT 1')2418 connection.pool.release_connection2419 }, expected_role: :primary2420 redirects queries to the right roles2421 a write inside a transaction inside fallback_to_replicas_for_ambiguous_queries block2422 raises an exception2423-- drop_table(:_test_load_balancing_test, {:force=>true})2424 -> 0.1030s2425Gitlab::Database::LockWritesManager2426 #table_locked_for_writes?2427 returns false for a table that is not locked for writes2428 returns true for a table that is locked for writes2429 for detached partition tables in another schema2430 returns true for a table that is locked for writes2431 #lock_writes2432 prevents any writes on the table2433 prevents truncating the table2434 adds 3 triggers to the ci schema tables on the main database2435 logs the write locking2436 retries again if it receives a statement_timeout a few number of times2437 raises the exception if it happened many times2438 skips the operation if the table is already locked for writes2439 when running in dry_run mode2440 prints the sql statement to the logger2441 does not lock the tables for writes2442 returns result hash with action needs_lock2443 #unlock_writes2444 allows writing on the table again2445 skips unlocking the table if the table was already unlocked for writes2446 removes the write protection triggers from the gitlab_main tables on the ci database2447 logs the write unlocking2448 when running in dry_run mode2449 prints the sql statement to the logger2450 does not unlock the tables for writes2451 returns result hash with dry_run true2452Gitlab::Database::LooseForeignKeys2453 verify all definitions2454 all definitions have assigned a known gitlab_schema and on_delete2455 ensure keys are sorted2456 does not have any keys that are out of order2457 ensure no duplicates are found2458 does not have duplicate tables defined2459 does not have duplicate column definitions2460 ensuring database integrity2461 all `to_table` tables are present2462 all `from_table` tables are present2463 all tables have correct triggers installed2464 all YAML tables do have `track_record_deletions` installed2465 no extra tables have `track_record_deletions` installed2466 .build_definition2467 when child table schema is not defined2468 raises Gitlab::Database::GitlabSchema::UnknownSchemaError error2469Gitlab::Database::MigrationHelpers::AnnounceDatabase2470 #announce2471 prefixes message with database name2472 #say2473 prefixes message with database name2474 prefixes subitem message with database name2475 #write2476 does not prefix empty write2477Gitlab::Database::MigrationHelpers::AutomaticLockWritesOnTables2478 # order random2479 when renaming a table2480 when a gitlab_main table2481 behaves like does not lock writes on table2482main: == : migrating ===============================================================2483main: -- create_table(:_test_gitlab_main_table)2484main: -> 0.1483s2485main: == : migrated (0.1868s) ======================================================2486main: == : migrating ===============================================================2487main: -- rename_table(:_test_gitlab_main_table, :_test_gitlab_main_new_table)2488main: -> 0.1629s2489main: == : migrated (0.1710s) ======================================================2490 allows deleting records from the table2491 behaves like locks writes on table2492ci: == : migrating ===============================================================2493ci: -- create_table(:_test_gitlab_main_table)2494ci: -> 0.1406s2495I, [2023-07-27T04:23:11.302698 #320] INFO -- : Database: 'ci', Table: '_test_gitlab_main_table': Lock Writes2496I, [2023-07-27T04:23:11.304849 #320] INFO -- : {:method=>"with_lock_retries", :class=>"gitlab:db:lock_writes", :message=>"Lock timeout is set", :current_iteration=>1, :lock_timeout_in_ms=>100}2497I, [2023-07-27T04:23:11.320280 #320] INFO -- : {:method=>"with_lock_retries", :class=>"gitlab:db:lock_writes", :message=>"Migration finished", :current_iteration=>1, :lock_timeout_in_ms=>100}2498ci: == : migrated (0.2749s) ======================================================2499ci: == : migrating ===============================================================2500ci: -- rename_table(:_test_gitlab_main_table, :_test_gitlab_main_new_table)2501ci: -> 0.0153s2502I, [2023-07-27T04:23:11.364657 #320] INFO -- : Database: 'ci', Table: '_test_gitlab_main_new_table': Lock Writes2503ci: == : migrated (0.0419s) ======================================================2504 errors on deleting2505 when a gitlab_ci table2506 behaves like does not lock writes on table2507ci: == : migrating ===============================================================2508ci: -- create_table(:_test_gitlab_ci_table)2509ci: -> 0.0049s2510ci: == : migrated (0.0275s) ======================================================2511ci: == : migrating ===============================================================2512ci: -- rename_table(:_test_gitlab_ci_table, :_test_gitlab_ci_new_table)2513ci: -> 0.0098s2514ci: == : migrated (0.0354s) ======================================================2515 allows deleting records from the table2516 behaves like locks writes on table2517main: == : migrating ===============================================================2518main: -- create_table(:_test_gitlab_ci_table)2519main: -> 0.0448s2520I, [2023-07-27T04:23:15.768510 #320] INFO -- : Database: 'main', Table: '_test_gitlab_ci_table': Lock Writes2521I, [2023-07-27T04:23:15.770332 #320] INFO -- : {:method=>"with_lock_retries", :class=>"gitlab:db:lock_writes", :message=>"Lock timeout is set", :current_iteration=>1, :lock_timeout_in_ms=>100}2522I, [2023-07-27T04:23:15.771570 #320] INFO -- : {:method=>"with_lock_retries", :class=>"gitlab:db:lock_writes", :message=>"Migration finished", :current_iteration=>1, :lock_timeout_in_ms=>100}2523main: == : migrated (0.1724s) ======================================================2524main: == : migrating ===============================================================2525main: -- rename_table(:_test_gitlab_ci_table, :_test_gitlab_ci_new_table)2526main: -> 0.0091s2527I, [2023-07-27T04:23:15.792467 #320] INFO -- : Database: 'main', Table: '_test_gitlab_ci_new_table': Lock Writes2528main: == : migrated (0.0191s) ======================================================2529 errors on deleting2530 when reversing drop_table migrations2531 when single database2532 does not lock any newly created tables (PENDING: Skipping because database ci exists)2533 when multiple databases2534 for re-creating a gitlab_main table2535 behaves like does not lock writes on table2536main: == : migrating ===============================================================2537main: -- drop_table(:_test_gitlab_main_table)2538main: -> 0.0022s2539main: == : migrated (0.0115s) ======================================================2540main: == : reverting ===============================================================2541main: -- create_table(:_test_gitlab_main_table)2542main: -> 0.0037s2543main: == : reverted (0.0490s) ======================================================2544 allows deleting records from the table2545 behaves like locks writes on table2546ci: == : migrating ===============================================================2547ci: -- drop_table(:_test_gitlab_main_table)2548ci: -> 0.0015s2549ci: == : migrated (0.0283s) ======================================================2550ci: == : reverting ===============================================================2551ci: -- create_table(:_test_gitlab_main_table)2552ci: -> 0.0026s2553I, [2023-07-27T04:23:20.416251 #320] INFO -- : Database: 'ci', Table: '_test_gitlab_main_table': Lock Writes2554ci: == : reverted (0.0245s) ======================================================2555 errors on deleting2556 for re-creating a gitlab_ci table2557 behaves like does not lock writes on table2558ci: == : migrating ===============================================================2559ci: -- drop_table(:_test_gitlab_ci_table)2560ci: -> 0.0017s2561ci: == : migrated (0.0229s) ======================================================2562ci: == : reverting ===============================================================2563ci: -- create_table(:_test_gitlab_ci_table)2564ci: -> 0.0029s2565ci: == : reverted (0.0242s) ======================================================2566 allows deleting records from the table2567 behaves like locks writes on table2568main: == : migrating ===============================================================2569main: -- drop_table(:_test_gitlab_ci_table)2570main: -> 0.0017s2571main: == : migrated (0.0095s) ======================================================2572main: == : reverting ===============================================================2573main: -- create_table(:_test_gitlab_ci_table)2574main: -> 0.0028s2575I, [2023-07-27T04:23:23.556986 #320] INFO -- : Database: 'main', Table: '_test_gitlab_ci_table': Lock Writes2576main: == : reverted (0.0145s) ======================================================2577 errors on deleting2578 for re-creating a gitlab_shared table2579 behaves like does not lock writes on table2580main: == : migrating ===============================================================2581main: -- drop_table(:_test_table)2582main: -> 0.0060s2583main: == : migrated (0.0148s) ======================================================2584main: == : reverting ===============================================================2585main: -- create_table(:_test_table)2586main: -> 0.0681s2587main: == : reverted (0.0758s) ======================================================2588 allows deleting records from the table2589 behaves like does not lock writes on table2590ci: == : migrating ===============================================================2591ci: -- drop_table(:_test_table)2592ci: -> 0.0016s2593ci: == : migrated (0.0221s) ======================================================2594ci: == : reverting ===============================================================2595ci: -- create_table(:_test_table)2596ci: -> 0.0027s2597ci: == : reverted (0.0220s) ======================================================2598 allows deleting records from the table2599 when executing create_table migrations2600 when single database2601 does not lock any newly created tables (PENDING: Skipping because database ci exists)2602 when multiple databases2603 for creating a gitlab_main table2604 behaves like does not lock writes on table2605main: == : migrating ===============================================================2606main: -- create_table(:_test_gitlab_main_table)2607main: -> 0.0032s2608main: == : migrated (0.0107s) ======================================================2609 allows deleting records from the table2610 behaves like locks writes on table2611ci: == : migrating ===============================================================2612ci: -- create_table(:_test_gitlab_main_table)2613ci: -> 0.0335s2614I, [2023-07-27T04:23:31.430247 #320] INFO -- : Database: 'ci', Table: '_test_gitlab_main_table': Lock Writes2615ci: == : migrated (0.0596s) ======================================================2616 errors on deleting2617 when table listed as a deleted table2618 behaves like does not lock writes on table2619ci: == : migrating ===============================================================2620ci: -- create_table(:_test_gitlab_main_table)2621ci: -> 0.0029s2622ci: == : migrated (0.0238s) ======================================================2623 allows deleting records from the table2624 when the migration skips automatic locking of tables2625 behaves like does not lock writes on table2626ci: == : migrating ===============================================================2627ci: -- create_table(:_test_gitlab_main_table)2628ci: -> 0.0041s2629ci: == : migrated (0.0052s) ======================================================2630 allows deleting records from the table2631 when migration does not run within a transaction2632 behaves like locks writes on table using WithLockRetries2633ci: == : migrating ===============================================================2634ci: -- create_table(:_test_gitlab_main_table)2635ci: -> 0.0029s2636I, [2023-07-27T04:23:35.999927 #320] INFO -- : Database: 'ci', Table: '_test_gitlab_main_table': Lock Writes2637I, [2023-07-27T04:23:36.002217 #320] INFO -- : {:method=>"with_lock_retries", :class=>"gitlab:db:lock_writes", :message=>"Lock timeout is set", :current_iteration=>1, :lock_timeout_in_ms=>100}2638I, [2023-07-27T04:23:36.003290 #320] INFO -- : {:method=>"with_lock_retries", :class=>"gitlab:db:lock_writes", :message=>"Migration finished", :current_iteration=>1, :lock_timeout_in_ms=>100}2639ci: == : migrated (0.0307s) ======================================================2640 locks the writes on the table using WithLockRetries2641 when the SKIP_AUTOMATIC_LOCK_ON_WRITES feature flag is set2642 behaves like does not lock writes on table2643ci: == : migrating ===============================================================2644ci: -- create_table(:_test_gitlab_main_table)2645ci: -> 0.0039s2646ci: == : migrated (0.0052s) ======================================================2647 allows deleting records from the table2648 when the automatic_lock_writes_on_table feature flag is disabled2649 behaves like does not lock writes on table2650ci: == : migrating ===============================================================2651ci: -- create_table(:_test_gitlab_main_table)2652ci: -> 0.0042s2653ci: == : migrated (0.0179s) ======================================================2654 allows deleting records from the table2655 for creating a gitlab_main_clusterwide table2656 behaves like does not lock writes on table2657main: == : migrating ===============================================================2658main: -- create_table(:_test_gitlab_main_clusterwide_table)2659main: -> 0.0034s2660main: == : migrated (0.0112s) ======================================================2661 allows deleting records from the table2662 behaves like locks writes on table2663ci: == : migrating ===============================================================2664ci: -- create_table(:_test_gitlab_main_clusterwide_table)2665ci: -> 0.0032s2666I, [2023-07-27T04:23:42.088736 #320] INFO -- : Database: 'ci', Table: '_test_gitlab_main_clusterwide_table': Lock Writes2667ci: == : migrated (0.0298s) ======================================================2668 errors on deleting2669 for creating a gitlab_main_cell table2670 behaves like does not lock writes on table2671main: == : migrating ===============================================================2672main: -- create_table(:_test_gitlab_main_cell_table)2673main: -> 0.0029s2674main: == : migrated (0.0104s) ======================================================2675 allows deleting records from the table2676 behaves like locks writes on table2677ci: == : migrating ===============================================================2678ci: -- create_table(:_test_gitlab_main_cell_table)2679ci: -> 0.0036s2680I, [2023-07-27T04:23:45.303769 #320] INFO -- : Database: 'ci', Table: '_test_gitlab_main_cell_table': Lock Writes2681ci: == : migrated (0.0303s) ======================================================2682 errors on deleting2683 for creating a gitlab_pm table2684 behaves like does not lock writes on table2685main: == : migrating ===============================================================2686main: -- create_table(:_test_gitlab_pm_table)2687main: -> 0.0032s2688main: == : migrated (0.0116s) ======================================================2689 allows deleting records from the table2690 behaves like locks writes on table2691ci: == : migrating ===============================================================2692ci: -- create_table(:_test_gitlab_pm_table)2693ci: -> 0.0034s2694I, [2023-07-27T04:23:48.435913 #320] INFO -- : Database: 'ci', Table: '_test_gitlab_pm_table': Lock Writes2695ci: == : migrated (0.0307s) ======================================================2696 errors on deleting2697 for creating a gitlab_ci table2698 behaves like does not lock writes on table2699ci: == : migrating ===============================================================2700ci: -- create_table(:_test_gitlab_ci_table)2701ci: -> 0.0027s2702ci: == : migrated (0.0224s) ======================================================2703 allows deleting records from the table2704 behaves like locks writes on table2705main: == : migrating ===============================================================2706main: -- create_table(:_test_gitlab_ci_table)2707main: -> 0.0030s2708I, [2023-07-27T04:23:51.518473 #320] INFO -- : Database: 'main', Table: '_test_gitlab_ci_table': Lock Writes2709main: == : migrated (0.0158s) ======================================================2710 errors on deleting2711 when table listed as a deleted table2712 behaves like does not lock writes on table2713main: == : migrating ===============================================================2714main: -- create_table(:_test_gitlab_ci_table)2715main: -> 0.0027s2716main: == : migrated (0.0100s) ======================================================2717 allows deleting records from the table2718 when the migration skips automatic locking of tables2719 behaves like does not lock writes on table2720main: == : migrating ===============================================================2721main: -- create_table(:_test_gitlab_ci_table)2722main: -> 0.0037s2723main: == : migrated (0.0041s) ======================================================2724 allows deleting records from the table2725 when the SKIP_AUTOMATIC_LOCK_ON_WRITES feature flag is set2726 behaves like does not lock writes on table2727main: == : migrating ===============================================================2728main: -- create_table(:_test_gitlab_ci_table)2729main: -> 0.0039s2730main: == : migrated (0.0046s) ======================================================2731 allows deleting records from the table2732 when the automatic_lock_writes_on_table feature flag is disabled2733 behaves like does not lock writes on table2734main: == : migrating ===============================================================2735main: -- create_table(:_test_gitlab_ci_table)2736main: -> 0.0047s2737main: == : migrated (0.0058s) ======================================================2738 allows deleting records from the table2739 for creating gitlab_shared table2740 behaves like does not lock writes on table2741main: == : migrating ===============================================================2742main: -- create_table(:_test_table)2743main: -> 0.0028s2744main: == : migrated (0.0104s) ======================================================2745 allows deleting records from the table2746 behaves like does not lock writes on table2747ci: == : migrating ===============================================================2748ci: -- create_table(:_test_table)2749ci: -> 0.0035s2750ci: == : migrated (0.0275s) ======================================================2751 allows deleting records from the table2752 for creating a gitlab_geo table2753 behaves like does not lock writes on table2754 allows deleting records from the table (PENDING: No reason given)2755 for creating an unknown gitlab_schema table2756main: == : migrating ===============================================================2757main: -- create_table(:foobar)2758 raises an error about undefined gitlab_schema2759Gitlab::Database::MigrationHelpers::CascadingNamespaceSettings2760 #add_cascading_namespace_setting2761-- column_exists?(:namespace_settings, :some_setting)2762 -> 0.0053s2763-- column_exists?(:namespace_settings, :lock_some_setting)2764 -> 0.0066s2765-- column_exists?(:application_settings, :some_setting)2766 -> 0.2842s2767-- column_exists?(:application_settings, :lock_some_setting)2768 -> 0.2845s2769 creates the required columns2770 when columns already exist2771-- add_column(:namespace_settings, :cascading_setting, :integer)2772 -> 0.0325s2773-- add_column(:application_settings, :lock_cascading_setting, :boolean)2774 -> 0.0210s2775-- column_exists?(:namespace_settings, :cascading_setting)2776 -> 0.0050s2777-- column_exists?(:namespace_settings, :lock_cascading_setting)2778 -> 0.0043s2779-- column_exists?(:application_settings, :cascading_setting)2780 -> 0.2849s2781-- column_exists?(:application_settings, :lock_cascading_setting)2782 -> 0.2854s2783 raises an error when some columns already exist2784 #remove_cascading_namespace_setting2785 removes the columns2786Gitlab::Database::MigrationHelpers::ConvertToBigint2787 # order random2788 #columns_swapped?2789 returns true if columns are already swapped2790 returns false if columns are not yet swapped2791 #temp_column_removed?2792 return true when column is not present2793 return false when column present2794 #com_or_dev_or_test_but_not_jh?2795 dot_com: true, dev_or_test: true, jh: true, expectation: true2796 returns true for GitLab.com (but not JH), dev, or test2797 dot_com: true, dev_or_test: false, jh: true, expectation: false2798 returns true for GitLab.com (but not JH), dev, or test2799 dot_com: false, dev_or_test: true, jh: true, expectation: true2800 returns true for GitLab.com (but not JH), dev, or test2801 dot_com: false, dev_or_test: false, jh: true, expectation: false2802 returns true for GitLab.com (but not JH), dev, or test2803 dot_com: true, dev_or_test: true, jh: false, expectation: true2804 returns true for GitLab.com (but not JH), dev, or test2805 dot_com: true, dev_or_test: false, jh: false, expectation: true2806 returns true for GitLab.com (but not JH), dev, or test2807 dot_com: false, dev_or_test: true, jh: false, expectation: true2808 returns true for GitLab.com (but not JH), dev, or test2809 dot_com: false, dev_or_test: false, jh: false, expectation: false2810 returns true for GitLab.com (but not JH), dev, or test2811Gitlab::Database::MigrationHelpers::LooseForeignKeyHelpers2812-- create_table(:_test_loose_fk_test_table)2813 -> 0.0028s2814 when the record deletion tracker trigger is not installed2815 does store record deletions2816-- current_schema()2817 -> 0.0007s2818 is expected to be falsy2819 when the record deletion tracker trigger is installed2820-- execute("CREATE TRIGGER _test_loose_fk_test_table_loose_fk_trigger AFTER DELETE ON _test_loose_fk_test_table REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();")2821 -> 0.0168s2822 stores the record deletion2823-- execute("CREATE TRIGGER _test_loose_fk_test_table_loose_fk_trigger AFTER DELETE ON _test_loose_fk_test_table REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();")2824 -> 0.0012s2825 stores multiple record deletions2826-- execute("CREATE TRIGGER _test_loose_fk_test_table_loose_fk_trigger AFTER DELETE ON _test_loose_fk_test_table REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();")2827 -> 0.0012s2828-- current_schema()2829 -> 0.0006s2830 is expected to be truthy2831-- drop_table(:_test_loose_fk_test_table)2832 -> 0.0023s2833Gitlab::Database::MigrationHelpers::RestrictGitlabSchema2834 #restrict_gitlab_migration2835 invalid schema raises exception2836 does configure allowed_gitlab_schema2837 when executing migrations2838 does create table in gitlab_main and gitlab_ci2839 for db_config_name=main2840 while restrict_gitlab_migration=no_gitlab_schema2841 does run migrate :up and :down2842 while restrict_gitlab_migration=gitlab_schema_gitlab_main2843 does run migrate :up and :down2844 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2845 does run migrate :up and :down2846 for db_config_name=ci2847 while restrict_gitlab_migration=no_gitlab_schema2848 does run migrate :up and :down2849 while restrict_gitlab_migration=gitlab_schema_gitlab_main2850 does run migrate :up and :down2851 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2852 does run migrate :up and :down2853 does add column to projects in gitlab_main and gitlab_ci2854 for db_config_name=main2855 while restrict_gitlab_migration=no_gitlab_schema2856 does run migrate :up and :down2857 while restrict_gitlab_migration=gitlab_schema_gitlab_main2858 does run migrate :up and :down2859 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2860 does run migrate :up and :down2861 for db_config_name=ci2862 while restrict_gitlab_migration=no_gitlab_schema2863 does run migrate :up and :down2864 while restrict_gitlab_migration=gitlab_schema_gitlab_main2865 does run migrate :up and :down2866 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2867 does run migrate :up and :down2868 does add column to p_ci_builds in gitlab_main and gitlab_ci2869 for db_config_name=main2870 while restrict_gitlab_migration=no_gitlab_schema2871 does run migrate :up and :down2872 while restrict_gitlab_migration=gitlab_schema_gitlab_main2873 does run migrate :up and :down2874 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2875 does run migrate :up and :down2876 for db_config_name=ci2877 while restrict_gitlab_migration=no_gitlab_schema2878 does run migrate :up and :down2879 while restrict_gitlab_migration=gitlab_schema_gitlab_main2880 does run migrate :up and :down2881 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2882 does run migrate :up and :down2883 does add index to projects in gitlab_main and gitlab_ci2884 for db_config_name=main2885 while restrict_gitlab_migration=no_gitlab_schema2886 does run migrate :up and :down2887 while restrict_gitlab_migration=gitlab_schema_gitlab_main2888 does run migrate :up and :down2889 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2890 does run migrate :up and :down2891 for db_config_name=ci2892 while restrict_gitlab_migration=no_gitlab_schema2893 does run migrate :up and :down2894 while restrict_gitlab_migration=gitlab_schema_gitlab_main2895 does run migrate :up and :down2896 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2897 does run migrate :up and :down2898 does add index to ci_builds in gitlab_main and gitlab_ci2899 for db_config_name=main2900 while restrict_gitlab_migration=no_gitlab_schema2901 does run migrate :up and :down2902 while restrict_gitlab_migration=gitlab_schema_gitlab_main2903 does run migrate :up and :down2904 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2905 does run migrate :up and :down2906 for db_config_name=ci2907 while restrict_gitlab_migration=no_gitlab_schema2908 does run migrate :up and :down2909 while restrict_gitlab_migration=gitlab_schema_gitlab_main2910 does run migrate :up and :down2911 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2912 does run migrate :up and :down2913 does create trigger in gitlab_main and gitlab_ci2914 for db_config_name=main2915 while restrict_gitlab_migration=no_gitlab_schema2916 does run migrate :up and :down2917 while restrict_gitlab_migration=gitlab_schema_gitlab_main2918 does run migrate :up and :down2919 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2920 does run migrate :up and :down2921 for db_config_name=ci2922 while restrict_gitlab_migration=no_gitlab_schema2923 does run migrate :up and :down2924 while restrict_gitlab_migration=gitlab_schema_gitlab_main2925 does run migrate :up and :down2926 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2927 does run migrate :up and :down2928 does create schema in gitlab_main and gitlab_ci2929 for db_config_name=main2930 while restrict_gitlab_migration=no_gitlab_schema2931 does run migrate :up and :down2932 while restrict_gitlab_migration=gitlab_schema_gitlab_main2933 does run migrate :up and :down2934 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2935 does run migrate :up and :down2936 for db_config_name=ci2937 while restrict_gitlab_migration=no_gitlab_schema2938 does run migrate :up and :down2939 while restrict_gitlab_migration=gitlab_schema_gitlab_main2940 does run migrate :up and :down2941 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2942 does run migrate :up and :down2943 does attach loose foreign key trigger in gitlab_main and gitlab_ci2944 for db_config_name=main2945 while restrict_gitlab_migration=no_gitlab_schema2946 does run migrate :up and :down2947 while restrict_gitlab_migration=gitlab_schema_gitlab_main2948 does run migrate :up and :down2949 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2950 does run migrate :up and :down2951 for db_config_name=ci2952 while restrict_gitlab_migration=no_gitlab_schema2953 does run migrate :up and :down2954 while restrict_gitlab_migration=gitlab_schema_gitlab_main2955 does run migrate :up and :down2956 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2957 does run migrate :up and :down2958 does insert into software_licenses2959 for db_config_name=main2960 while restrict_gitlab_migration=no_gitlab_schema2961 does run migrate :up and :down2962 while restrict_gitlab_migration=gitlab_schema_gitlab_main2963 does run migrate :up and :down2964 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2965 does run migrate :up and :down2966 for db_config_name=ci2967 while restrict_gitlab_migration=no_gitlab_schema2968 does run migrate :up and :down2969 while restrict_gitlab_migration=gitlab_schema_gitlab_main2970 does run migrate :up and :down2971 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2972 does run migrate :up and :down2973 does raise exception when accessing tables outside of gitlab_main2974 for db_config_name=main2975 while restrict_gitlab_migration=no_gitlab_schema2976 does run migrate :up and :down2977 while restrict_gitlab_migration=gitlab_schema_gitlab_main2978 does run migrate :up and :down2979 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2980 does run migrate :up and :down2981 for db_config_name=ci2982 while restrict_gitlab_migration=no_gitlab_schema2983 does run migrate :up and :down2984 while restrict_gitlab_migration=gitlab_schema_gitlab_main2985 does run migrate :up and :down2986 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2987 does run migrate :up and :down2988 does allow modifying gitlab_shared2989 for db_config_name=main2990 while restrict_gitlab_migration=no_gitlab_schema2991 does run migrate :up and :down2992 while restrict_gitlab_migration=gitlab_schema_gitlab_main2993 does run migrate :up and :down2994 while restrict_gitlab_migration=gitlab_schema_gitlab_shared2995 does run migrate :up and :down2996 for db_config_name=ci2997 while restrict_gitlab_migration=no_gitlab_schema2998 does run migrate :up and :down2999 while restrict_gitlab_migration=gitlab_schema_gitlab_main3000 does run migrate :up and :down3001 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3002 does run migrate :up and :down3003 does update data in batches of gitlab_main, but skips gitlab_ci3004 for db_config_name=main3005 while restrict_gitlab_migration=no_gitlab_schema3006 does run migrate :up and :down3007 while restrict_gitlab_migration=gitlab_schema_gitlab_main3008 does run migrate :up and :down3009 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3010 does run migrate :up and :down3011 for db_config_name=ci3012 while restrict_gitlab_migration=no_gitlab_schema3013 does run migrate :up and :down3014 while restrict_gitlab_migration=gitlab_schema_gitlab_main3015 does run migrate :up and :down3016 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3017 does run migrate :up and :down3018 does not allow executing mixed DDL and DML migrations3019 for db_config_name=main3020 while restrict_gitlab_migration=no_gitlab_schema3021 does run migrate :up and :down3022 while restrict_gitlab_migration=gitlab_schema_gitlab_main3023 does run migrate :up and :down3024 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3025 does run migrate :up and :down3026 for db_config_name=ci3027 while restrict_gitlab_migration=no_gitlab_schema3028 does run migrate :up and :down3029 while restrict_gitlab_migration=gitlab_schema_gitlab_main3030 does run migrate :up and :down3031 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3032 does run migrate :up and :down3033 does schedule background migrations on gitlab_main3034 for db_config_name=main3035 while restrict_gitlab_migration=no_gitlab_schema3036 does run migrate :up and :down3037 while restrict_gitlab_migration=gitlab_schema_gitlab_main3038 does run migrate :up and :down3039 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3040 does run migrate :up and :down3041 for db_config_name=ci3042 while restrict_gitlab_migration=no_gitlab_schema3043 does run migrate :up and :down3044 while restrict_gitlab_migration=gitlab_schema_gitlab_main3045 does run migrate :up and :down3046 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3047 does run migrate :up and :down3048 does support prepare_async_index3049 for db_config_name=main3050 while restrict_gitlab_migration=no_gitlab_schema3051 does run migrate :up and :down3052 while restrict_gitlab_migration=gitlab_schema_gitlab_main3053 does run migrate :up and :down3054 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3055 does run migrate :up and :down3056 for db_config_name=ci3057 while restrict_gitlab_migration=no_gitlab_schema3058 does run migrate :up and :down3059 while restrict_gitlab_migration=gitlab_schema_gitlab_main3060 does run migrate :up and :down3061 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3062 does run migrate :up and :down3063 does raise exception when accessing current settings3064 for db_config_name=main3065 while restrict_gitlab_migration=no_gitlab_schema3066 does run migrate :up and :down3067 while restrict_gitlab_migration=gitlab_schema_gitlab_main3068 does run migrate :up and :down3069 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3070 does run migrate :up and :down3071 for db_config_name=ci3072 while restrict_gitlab_migration=no_gitlab_schema3073 does run migrate :up and :down3074 while restrict_gitlab_migration=gitlab_schema_gitlab_main3075 does run migrate :up and :down3076 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3077 does run migrate :up and :down3078 does raise exception when accessing feature flags3079 for db_config_name=main3080 while restrict_gitlab_migration=no_gitlab_schema3081 does run migrate :up and :down3082 while restrict_gitlab_migration=gitlab_schema_gitlab_main3083 does run migrate :up and :down3084 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3085 does run migrate :up and :down (FAILED - 1)30871st Try error in ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:554:3088expected Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError but nothing was raised3090RSpec::Retry: 2nd try ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:5543091 for db_config_name=ci3092 while restrict_gitlab_migration=no_gitlab_schema3093 does run migrate :up and :down (FAILED - 2)30951st Try error in ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:554:3096expected Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLNotAllowedError but nothing was raised3098RSpec::Retry: 2nd try ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:5543099 while restrict_gitlab_migration=gitlab_schema_gitlab_main3100 does run migrate :up and :down3101 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3102 does run migrate :up and :down (FAILED - 3)31041st Try error in ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:554:3105expected Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError but nothing was raised3107RSpec::Retry: 2nd try ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:5543108 does raise exception about cross schema access when suppressing restriction to ensure3109 for db_config_name=main3110 while restrict_gitlab_migration=no_gitlab_schema3111 does run migrate :up and :down3112 while restrict_gitlab_migration=gitlab_schema_gitlab_main3113 does run migrate :up and :down3114 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3115 does run migrate :up and :down3116 for db_config_name=ci3117 while restrict_gitlab_migration=no_gitlab_schema3118 does run migrate :up and :down3119 while restrict_gitlab_migration=gitlab_schema_gitlab_main3120 does run migrate :up and :down3121 while restrict_gitlab_migration=gitlab_schema_gitlab_shared3122 does run migrate :up and :down3123Gitlab::Database::MigrationHelpers::V23124 #rename_column_concurrently3125 behaves like Setting up to rename a column3126 creates the renamed column, syncing existing data3127 installs triggers to sync new data3128 requires the helper to run in ddl mode3129 when called inside a transaction block3130 raises an error3131 when the existing column has a default function3132 raises an error3133 when passing a batch column3134 when the batch column does not exist3135 raises an error3136 when the batch column does exist3137 passes it when creating the column3138 when the existing column has a default value3139 creates the renamed column, syncing existing data3140 installs triggers to sync new data3141 when the existing column has a default value that evaluates to NULL3142 creates the renamed column, syncing existing data3143 installs triggers to sync new data3144 when the column to rename does not exist3145 raises an error3146 #undo_cleanup_concurrent_column_rename3147 behaves like Setting up to rename a column3148 creates the renamed column, syncing existing data3149 installs triggers to sync new data3150 requires the helper to run in ddl mode3151 when called inside a transaction block3152 raises an error3153 when the existing column has a default function3154 raises an error3155 when passing a batch column3156 when the batch column does not exist3157 raises an error3158 when the batch column does exist3159 passes it when creating the column3160 when the existing column has a default value3161 creates the renamed column, syncing existing data3162 installs triggers to sync new data3163 when the existing column has a default value that evaluates to NULL3164 creates the renamed column, syncing existing data3165 installs triggers to sync new data3166 when the renamed column does not exist3167 raises an error3168 #undo_rename_column_concurrently3169 behaves like Cleaning up from renaming a column3170 when the helper is called repeatedly3171 does not make repeated attempts to cleanup3172 when the renamed column exists3173 removes the sync triggers and renamed columns3174 #cleanup_concurrent_column_rename3175 behaves like Cleaning up from renaming a column3176 when the helper is called repeatedly3177 does not make repeated attempts to cleanup3178 when the renamed column exists3179 removes the sync triggers and renamed columns3180 #create_table3181 using a limit: attribute on .text3182 creates the table as expected3183 #with_lock_retries3184-- transaction_open?()3185 -> 0.0003s3186 sets the migration class name in the logs3187-- transaction_open?()3188 -> 0.0003s3189 does not raise on exhaustion by default3190-- transaction_open?()3191 -> 0.0002s3192 defaults to disallowing subtransactions3193 raise_on_exhaustion: true3194-- transaction_open?()3195 -> 0.0005s3196 sets raise_on_exhaustion as requested3197 raise_on_exhaustion: false3198-- transaction_open?()3199 -> 0.0002s3200 sets raise_on_exhaustion as requested3201 when in transaction3202 when lock retries are enabled3203 does not use Gitlab::Database::WithLockRetries and executes the provided block directly3204 when lock retries are not enabled3205 raises an error3206 #truncate_tables!3207 truncates the table3208 truncates multiple tables3209 raises an ArgumentError if truncating multiple gitlab_schema3210 with multiple databases3211 for ci database3212 skips the TRUNCATE statement tables not in schema for connection3213 for main database3214 executes a TRUNCATE statement3215 with single database3216 executes a TRUNCATE statement (PENDING: Skipping because database ci exists)3217Gitlab::Database::MigrationHelpers::WraparoundAutovacuum3218 # order random3219 #can_execute_on?3220 dot_com: true, dev_or_test: true, wraparound_prevention: true, expectation: false3221main: -- Wraparound prevention vacuum detected, skipping migration3222 returns true for GitLab.com, dev, or test3223 dot_com: true, dev_or_test: false, wraparound_prevention: true, expectation: false3224main: -- Wraparound prevention vacuum detected, skipping migration3225 returns true for GitLab.com, dev, or test3226 dot_com: false, dev_or_test: true, wraparound_prevention: true, expectation: false3227main: -- Wraparound prevention vacuum detected, skipping migration3228 returns true for GitLab.com, dev, or test3229 dot_com: false, dev_or_test: false, wraparound_prevention: true, expectation: false3230 returns true for GitLab.com, dev, or test3231 dot_com: true, dev_or_test: true, wraparound_prevention: false, expectation: true3232 returns true for GitLab.com, dev, or test3233 dot_com: true, dev_or_test: false, wraparound_prevention: false, expectation: true3234 returns true for GitLab.com, dev, or test3235 dot_com: false, dev_or_test: true, wraparound_prevention: false, expectation: true3236 returns true for GitLab.com, dev, or test3237 dot_com: false, dev_or_test: false, wraparound_prevention: false, expectation: false3238 returns true for GitLab.com, dev, or test3239 #wraparound_prevention_on_tables?3240 is expected to be falsey3241 is expected to be truthy3242 is expected to be truthy3243Gitlab::Database::MigrationHelpers::WraparoundVacuumHelpers3244 # order random3245 Gitlab::Database::MigrationHelpers::WraparoundVacuumHelpers::WraparoundCheck3246 #execute3247 with wraparound vacuuum running3248 outputs a message related to autovacuum3249 is expected to output /autovacuum: VACUUM public.ci_builds \(to prevent wraparound\)/ to stdout3250 is expected to output /Current duration: 2 hours, 30 minutes/ to stdout3251 when GITLAB_MIGRATIONS_DISABLE_WRAPAROUND_CHECK is set3252 is expected not to output /autovacuum/i to stdout3253 is disabled on .com3254 when executed by self-managed3255 is expected not to output /autovacuum/i to stdout3256 with wraparound vacuuum not running3257 is expected not to output /autovacuum/i to stdout3258 when the table does not exist3259 is expected to raise Gitlab::Database::MigrationHelpers::WraparoundVacuumHelpers::WraparoundCheck::WraparoundError with message matching /no_table/3260 #check_if_wraparound_in_progress3261 delegates to the wraparound class3262Gitlab::Database::MigrationHelpers3263 is expected to include Gitlab::Database::MigrationHelpers::WraparoundVacuumHelpers3264 overridden dynamic model helpers3265 #define_batchable_model3266 defines a batchable model with the migration connection3267 #each_batch3268 calls each_batch with the migration connection3269 #each_batch_range3270 calls each_batch with the migration connection3271 #remove_timestamps3272 can remove the default timestamps3273 can remove custom timestamps3274 #add_timestamps_with_timezone3275 adds "created_at" and "updated_at" fields with the "datetime_with_timezone" data type3276 can disable the NOT NULL constraint3277 can add just one column3278 can add choice of acceptable columns3279 cannot add unacceptable column names3280 #add_concurrent_index3281 outside a transaction3282 creates the index concurrently3283 creates unique index concurrently3284 unprepares the async index creation3285 when the index exists and is valid3286 does leaves the existing index3287 when an invalid copy of the index exists3288 when the default name is used3289 drops and recreates the index3290 when a custom name is used3291 drops and recreates the index3292 when a qualified table name is used3293 drops and recreates the index3294 when targeting a partition table3295 when allow_partition is true3296 creates the index concurrently3297 when allow_partition is not provided3298 raises ArgumentError3299 inside a transaction3300 raises RuntimeError3301 #remove_concurrent_index3302 outside a transaction3303 by column name3304 removes the index concurrently3305 does nothing if the index does not exist3306 unprepares the async index creation3307 when targeting a partition table3308 when dropping an index on the partition table3309 raises ArgumentError3310 by index name3311 removes the index concurrently by index name3312 does nothing if the index does not exist3313 removes the index with keyword arguments3314 raises an error if the index is blank3315 unprepares the async index creation3316 when targeting a partition table3317 when dropping an index on the partition table3318 raises ArgumentError3319 inside a transaction3320 raises RuntimeError3321 #remove_foreign_key_if_exists3322 when the foreign key does not exist3323 does nothing3324 when the foreign key exists3325 removes the foreign key3326 when the target table is not given3327 passes the options as the second parameter3328 when the reverse_lock_order option is given3329 requests for lock before removing the foreign key3330 when not inside a transaction3331 does not lock3332 #add_concurrent_foreign_key3333 inside a transaction3334 raises an error3335 outside a transaction3336 target column3337 defaults to (id) when no custom target column is provided3338 references the custom taget column when provided3339 ON DELETE statements3340 on_delete: :nullify3341 appends ON DELETE SET NULL statement3342 on_delete: :cascade3343 appends ON DELETE CASCADE statement3344 on_delete: nil3345 appends no ON DELETE statement3346 ON UPDATE statements3347 on_update: :nullify3348 appends ON UPDATE SET NULL statement3349 on_update: :cascade3350 appends ON UPDATE CASCADE statement3351 on_update: nil3352 appends no ON UPDATE statement3353 when on_update is not provided3354 appends no ON UPDATE statement3355 when no custom key name is supplied3356 creates a concurrent foreign key and validates it3357 does not create a foreign key if it exists already3358 when a custom key name is supplied3359 for creating a new foreign key for a column that does not presently exist3360 creates a new foreign key3361 for creating a duplicate foreign key for a column that presently exists3362 when the supplied key name is the same as the existing foreign key name3363 does not create a new foreign key3364 when the supplied key name is different from the existing foreign key name3365 creates a new foreign key3366 validate option3367 when validate is supplied with a falsey value3368 behaves like skips validation3369 skips validation3370 behaves like skips validation3371 skips validation3372 when validate is supplied with a truthy value3373 behaves like performs validation3374 performs validation3375 behaves like performs validation3376 performs validation3377 when validate is not supplied3378 behaves like performs validation3379 performs validation3380 when the reverse_lock_order flag is set3381 explicitly locks the tables in target-source order3382 when creating foreign key for a group of columns3383 references the custom target columns when provided3384 when foreign key is already defined3385 does not create foreign key3386 when creating foreign key on a partitioned table3387 creates the FK without using NOT VALID3388 raises an error if allow_partitioned is not set3389 when the reverse_lock_order flag is set3390 explicitly locks the tables in target-source order3391 #validate_foreign_key3392 when name is provided3393 does not infer the foreign key constraint name3394 when name is not provided3395 infers the foreign key constraint name3396 when the inferred foreign key constraint does not exist3397 raises an error3398 #concurrent_foreign_key_name3399 returns the name for a foreign key3400 when using multiple columns3401 returns the name of the foreign key3402 #foreign_key_exists?3403 compares by target table if no column given3404 raises an error if an invalid on_delete is specified3405 without specifying a target table3406 behaves like foreign key checks3407 finds existing foreign keys by column3408 finds existing foreign keys by name3409 finds existing foreign_keys by name and column3410 finds existing foreign_keys by name, column and on_delete3411 finds existing foreign keys by target table only3412 finds existing foreign_keys by identifier3413 compares by column name if given3414 compares by target column name if given3415 compares by foreign key name if given3416 compares by foreign key name and column if given3417 compares by foreign key name, column and on_delete if given3418 specifying a target table3419 behaves like foreign key checks3420 finds existing foreign keys by column3421 finds existing foreign keys by name3422 finds existing foreign_keys by name and column3423 finds existing foreign_keys by name, column and on_delete3424 finds existing foreign keys by target table only3425 finds existing foreign_keys by identifier3426 compares by column name if given3427 compares by target column name if given3428 compares by foreign key name if given3429 compares by foreign key name and column if given3430 compares by foreign key name, column and on_delete if given3431 if the schema cache does not include the constrained_columns column3432-- transaction()3433main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3434main: -> 0.0944s3435main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3436main: -> 0.0287s3437 -> 0.2074s3438 correctly sets up the test without the column in the columns_hash3439 behaves like foreign key checks3440-- transaction()3441main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3442main: -> 0.0051s3443main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3444main: -> 0.0069s3445 -> 0.0682s3446 finds existing foreign keys by column3447-- transaction()3448main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3449main: -> 0.0065s3450main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3451main: -> 0.0069s3452 -> 0.0705s3453 finds existing foreign keys by name3454-- transaction()3455main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3456main: -> 0.0048s3457main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3458main: -> 0.0059s3459 -> 1.1110s3460 finds existing foreign_keys by name and column3461-- transaction()3462main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3463main: -> 0.0056s3464main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3465main: -> 0.0072s3466 -> 0.0720s3467 finds existing foreign_keys by name, column and on_delete3468-- transaction()3469main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3470main: -> 0.0054s3471main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3472main: -> 0.0072s3473 -> 0.0644s3474 finds existing foreign keys by target table only3475-- transaction()3476main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3477main: -> 0.0054s3478main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3479main: -> 0.0338s3480 -> 0.1002s3481 finds existing foreign_keys by identifier3482-- transaction()3483main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3484main: -> 0.0285s3485main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3486main: -> 0.0063s3487 -> 0.0963s3488 compares by column name if given3489-- transaction()3490main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3491main: -> 0.0046s3492main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3493main: -> 0.0058s3494 -> 0.0737s3495 compares by target column name if given3496-- transaction()3497main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3498main: -> 0.0045s3499main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3500main: -> 0.0057s3501 -> 0.0647s3502 compares by foreign key name if given3503-- transaction()3504main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3505main: -> 0.0052s3506main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3507main: -> 0.0063s3508 -> 0.0663s3509 compares by foreign key name and column if given3510-- transaction()3511main: -- execute("DROP VIEW IF EXISTS postgres_foreign_keys;\nCREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\nWHERE contype = 'f';\n")3512main: -> 0.0055s3513main: -- execute("CREATE OR REPLACE VIEW postgres_foreign_keys AS\nSELECT\n pg_constraint.oid AS oid,\n pg_constraint.conname AS name,\n constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,\n referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,\n constrained_table.relname::text AS constrained_table_name,\n referenced_table.relname::text AS referenced_table_name,\n constrained_cols.constrained_columns,\n referenced_cols.referenced_columns,\n pg_constraint.confdeltype AS on_delete_action,\n pg_constraint.coninhcount > 0 as is_inherited\nFROM pg_constraint\n INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid\n INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid\n INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid\n INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array\n FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid\n ) constrained_cols(constrained_columns)\n CROSS JOIN LATERAL (\n SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)\n FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)\n INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid\n ) referenced_cols(referenced_columns)\nWHERE contype = 'f';\n")3514main: -> 0.0064s3515 -> 0.0672s3516 compares by foreign key name, column and on_delete if given3517 with foreign key using multiple columns3518 finds existing foreign keys by columns3519 finds existing foreign keys by name3520 finds existing foreign_keys by name and column3521 finds existing foreign_keys by name, column and on_delete3522 finds existing foreign keys by target table only3523 compares by column name if given3524 compares by target column name if given3525 compares by foreign key name if given3526 compares by foreign key name and column if given3527 compares by foreign key name, column and on_delete if given3528 #true_value3529 returns the appropriate value3530 #false_value3531 returns the appropriate value3532 #update_column_in_batches3533 when running outside of a transaction3534 updates all the rows in a table3535 updates boolean values correctly3536 when a block is supplied3537 yields an Arel table and query object to the supplied block3538 when the value is Arel.sql (Arel::Nodes::SqlLiteral)3539 updates the value as a SQL expression3540 when the table is write-locked3541 disables the write-lock trigger function3542 raises an error if it does not disable the trigger function3543 when running inside the transaction3544 raises RuntimeError3545 #rename_column_concurrently3546 in a transaction3547 raises RuntimeError3548 outside a transaction3549 when the column to rename exists3550 renames a column concurrently3551 passes the batch_column_name3552 passes the type_cast_function3553 raises an error with invalid batch_column_name3554 with existing records and type casting3555 copies the value to the new column using the type_cast_function3556 when default is false3557 copies the default to the new column3558 when the table in the other database is write-locked3559 does not raise an error when renaming the column3560 when the column to be renamed does not exist3561 raises an error with appropriate message3562 #undo_rename_column_concurrently3563 reverses the operations of rename_column_concurrently3564 #cleanup_concurrent_column_rename3565 cleans up the renaming procedure3566 #undo_cleanup_concurrent_column_rename3567 in a transaction3568 raises RuntimeError3569 outside a transaction3570 reverses the operations of cleanup_concurrent_column_rename3571 passes the batch_column_name3572 raises an error with invalid batch_column_name3573 when default is false3574 copies the default to the old column3575 #change_column_type_concurrently3576 changes the column type3577 passed the batch column name3578 with type cast3579 changes the column type with casting the value to the new type3580 #undo_change_column_type_concurrently3581 reverses the operations of change_column_type_concurrently3582 #cleanup_concurrent_column_type_change3583 cleans up the type changing procedure3584 #undo_cleanup_concurrent_column_type_change3585 in a transaction3586 raises RuntimeError3587 outside a transaction3588 reverses the operations of cleanup_concurrent_column_type_change3589 passes the type_cast_function, batch_column_name and limit3590 raises an error with invalid batch_column_name3591 #install_rename_triggers3592 installs the triggers3593 #remove_rename_triggers3594 removes the function and trigger3595 #rename_trigger_name3596 returns a String3597 #indexes_for3598 returns the indexes for a column3599 #foreign_keys_for3600 returns the foreign keys for a column3601 #copy_indexes3602 using a regular index using a single column3603 copies the index3604 using a regular index with multiple columns3605 copies the index3606 using an index with a WHERE clause3607 copies the index3608 using an index with a USING clause3609 copies the index3610 using an index with custom operator classes3611 copies the index3612 using an index with multiple columns and custom operator classes3613 copies the index3614 using an index with multiple columns and a custom operator class on the non affected column3615 copies the index3616 using an index of which the name does not contain the source column3617 raises RuntimeError3618 #copy_foreign_keys3619 copies foreign keys from one column to another3620 #column_for3621 returns a column object for an existing column3622 raises an error when a column does not exist3623 #replace_sql3624 builds the sql with correct functions3625 results3626 replaces the correct part of the string3627 #check_trigger_permissions!3628 does nothing when the user has the correct permissions3629 raises RuntimeError when the user does not have the correct permissions3630 #convert_to_bigint_column3631 returns the name of the temporary column used to convert to bigint3632 #convert_to_type_column3633 returns the name of the temporary column used to convert to bigint3634 returns the name of the temporary column used to convert to uuid3635 #create_temporary_columns_and_triggers3636 when no mappings are provided3637 raises an error3638 when any of the mappings does not have the required keys3639 raises an error3640 when the target table does not exist3641 raises an error3642 when the column to migrate does not exist3643 raises an error3644 when old_bigint_column_naming is true3645 calls convert_to_bigint_column3646 when old_bigint_column_naming is false3647 calls convert_to_type_column3648 #initialize_conversion_of_integer_to_bigint3649 when the target table does not exist3650 raises an error3651 when the primary key does not exist3652 raises an error3653 when the column to migrate does not exist3654 raises an error3655 when the column to convert is the primary key3656 creates a not-null bigint column and installs triggers3657 when the column to convert is not the primary key, but non-nullable3658 creates a not-null bigint column and installs triggers3659 when the column to convert is not the primary key, but nullable3660 creates a nullable bigint column and installs triggers3661 when multiple columns are given3662 creates the correct columns and installs the trigger3663 #restore_conversion_of_integer_to_bigint3664 when the target table does not exist3665 raises an error3666 when the column to migrate does not exist3667 raises an error3668 when a single column is given3669 creates the correct columns and installs the trigger3670 when multiple columns are given3671 creates the correct columns and installs the trigger3672 #revert_initialize_conversion_of_integer_to_bigint3673 when single column is given3674 removes column, trigger, and function3675 when multiple columns are given3676 removes column, trigger, and function3677 #backfill_conversion_of_integer_to_bigint3678 when the target table does not exist3679 raises an error3680 when the primary key does not exist3681 raises an error3682 when the column to convert does not exist3683 raises an error3684 when the temporary column does not exist3685 raises an error3686 when the conversion is properly initialized3687 when a single column is being converted3688 creates the batched migration tracking record3689 when multiple columns are being converted3690 creates the batched migration tracking record3691 #revert_backfill_conversion_of_integer_to_bigint3692 when a single column is being converted3693 deletes the batched migration tracking record3694 when a multiple columns are being converted3695 deletes the batched migration tracking record3696 when primary key column has custom name3697 deletes the batched migration tracking record3698 #index_exists_by_name?3699 returns true if an index exists3700 returns false if the index does not exist3701 when an index with a function exists3702 returns true if an index exists3703 when an index exists for a table with the same name in another schema3704 returns false if the index does not exist in the current schema3705 #create_or_update_plan_limit3706 properly escapes names3707 when plan does not exist3708 does not create any plan limits3709 when plan does exist3710 when limit does not exist3711 inserts a new plan limits3712 when limit does exist3713 updates an existing plan limits3714 #backfill_iids3715 generates iids properly for models created after the migration3716 generates iids properly for models created after the migration when iids are backfilled3717 generates iids properly for models created after the migration across multiple projects3718 when the first model is created for a project after the migration3719 generates an iid3720 when a row already has an iid set in the database3721 backfills iids3722 backfills for multiple projects3723 #add_primary_key_using_index3724 executes the statement to add the primary key3725 when changing the primary key of a given table3726 #swap_primary_key3727 executes statements to swap primary key3728 when new index does not exist3729 raises ActiveRecord::StatementInvalid3730 #unswap_primary_key3731 executes statements to unswap primary key3732 #drop_sequence3733 executes the statement to drop the sequence3734 #add_sequence3735 executes the statement to add the sequence3736 #partition?3737 when a partition table exist3738 when the view postgres_partitions exists3739 calls the view3740 when the view postgres_partitions does not exist3741 does not call the view3742 when a partition table does not exist3743 is expected to be falsey3744 #table_partitioned?3745 is expected to be truthy3746 with a non-partitioned table3747 is expected to be falsey3748Gitlab::Database::Migration3749 .[]3750 version: 1.03751 inherits from ActiveRecord::Migration[6.1]3752 includes migration helpers version 23753 includes LockRetriesConcern3754 unknown version3755 raises an error3756 .current_version3757 includes current ActiveRecord migration class3758 Gitlab::Database::Migration::LockRetriesConcern3759 when not explicitly called3760 does not disable lock retries by default3761 when explicitly disabled3762 does not disable lock retries by default3763Gitlab::Database::Migrations::BackgroundMigrationHelpers3764 when the migration is running against the main database3765 behaves like helpers that enqueue background migrations3766 #queue_background_migration_jobs_by_range_at_intervals3767 when the model has an ID column3768-- Scheduled 2 FooJob jobs with a maximum of 2 records per batch and an interval of 600 seconds.3769The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:13 UTC."3770 returns the final expected delay3771-- Scheduled 0 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3772The migration is expected to take at least 0 seconds. Expect all jobs to have completed after 2023-07-27 04:26:14 UTC."3773 returns zero when nothing gets queued3774 when the delay_interval is smaller than the minimum3775-- Scheduled 2 FooJob jobs with a maximum of 2 records per batch and an interval of 120 seconds.3776The migration is expected to take at least 240 seconds. Expect all jobs to have completed after 2023-07-27 04:30:14 UTC."3777 sets the delay_interval to the minimum value3778 with batch_size option3779-- Scheduled 2 FooJob jobs with a maximum of 2 records per batch and an interval of 600 seconds.3780The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:15 UTC."3781 queues jobs correctly3782 without batch_size option3783-- Scheduled 1 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3784The migration is expected to take at least 600 seconds. Expect all jobs to have completed after 2023-07-27 04:36:15 UTC."3785 queues jobs correctly3786 with other_job_arguments option3787-- Scheduled 1 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3788The migration is expected to take at least 600 seconds. Expect all jobs to have completed after 2023-07-27 04:36:16 UTC."3789 queues jobs correctly3790 with initial_delay option3791-- Scheduled 1 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3792The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:16 UTC."3793 queues jobs correctly3794 with track_jobs option3795-- Scheduled 1 ::FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3796The migration is expected to take at least 600 seconds. Expect all jobs to have completed after 2023-07-27 04:36:16 UTC."3797 creates a record for each job in the database3798 without track_jobs option3799-- Scheduled 1 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3800The migration is expected to take at least 600 seconds. Expect all jobs to have completed after 2023-07-27 04:36:17 UTC."3801 does not create records in the database3802 when the model specifies a primary_column_name3803-- Scheduled 2 FooJob jobs with a maximum of 2 records per batch and an interval of 600 seconds.3804The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:17 UTC."3805 returns the final expected delay3806 when the primary_column_name is a string3807-- Scheduled 1 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3808The migration is expected to take at least 600 seconds. Expect all jobs to have completed after 2023-07-27 04:36:18 UTC."3809 does not raise error3810 when the primary_column_name is not an integer or a string3811 raises error3812 when the primary_column_name does not exist3813 raises error3814 when the model doesn't have an ID or primary_column_name column3815 raises error (for now)3816 when using Migration[2.0]3817 when restriction is set to gitlab_shared3818 does raise an exception3819 when within transaction3820 does raise an exception3821 #requeue_background_migration_jobs_by_range_at_intervals3822-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3823The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:21 UTC."3824 returns the expected duration3825-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3826The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:21 UTC."3827 queues pending jobs3828 when using Migration[2.0]3829main: -- Scheduled 2 TestJob jobs with an interval of 600 seconds.3830The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:21 UTC."3831 does re-enqueue pending jobs3832 when restriction is set3833 does raise an exception3834 when within transaction3835 does raise an exception3836 when nothing is queued3837-- Scheduled 0 FakeJob jobs with an interval of 600 seconds.3838The migration is expected to take at least 0 seconds. Expect all jobs to have completed after 2023-07-27 04:26:21 UTC."3839 returns expected duration of zero when nothing gets queued3840 with batch_size option3841-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3842The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:22 UTC."3843 returns the expected duration3844-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3845The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:22 UTC."3846 queues pending jobs3847-- Scheduled 0 TestJob jobs with an interval of 600 seconds.3848The migration is expected to take at least 0 seconds. Expect all jobs to have completed after 2023-07-27 04:26:22 UTC."3849 retrieve jobs in batches3850 with initial_delay option3851-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3852The migration is expected to take at least 1380 seconds. Expect all jobs to have completed after 2023-07-27 04:49:22 UTC."3853 returns the expected duration3854-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3855The migration is expected to take at least 1380 seconds. Expect all jobs to have completed after 2023-07-27 04:49:22 UTC."3856 queues pending jobs3857 when nothing is queued3858-- Scheduled 0 FakeJob jobs with an interval of 600 seconds.3859The migration is expected to take at least 0 seconds. Expect all jobs to have completed after 2023-07-27 04:26:22 UTC."3860 returns expected duration of zero when nothing gets queued3861 #finalize_background_migration3862 behaves like finalized tracked background migration3863 processed the scheduled sidekiq queue3864 processed the async sidekiq queue3865 removes 'pending' tracked jobs3866 removes 'succeeded' tracked jobs3867 when within transaction3868 does raise an exception3869 when using Migration[2.0]3870 behaves like finalized tracked background migration3871 processed the scheduled sidekiq queue3872 processed the async sidekiq queue3873 removes 'pending' tracked jobs3874 removes 'succeeded' tracked jobs3875 when restriction is set3876 does raise an exception3877 when running migration in reconfigured ActiveRecord::Base context3878 behaves like reconfigures connection stack3879 does restore connection hierarchy3880 when removing all tracked job records3881 behaves like finalized tracked background migration3882 processed the scheduled sidekiq queue3883 processed the async sidekiq queue3884 removes 'pending' tracked jobs3885 removes 'succeeded' tracked jobs3886 behaves like removed tracked jobs3887 removes 'pending' tracked jobs3888 behaves like removed tracked jobs3889 removes 'succeeded' tracked jobs3890 when retaining all tracked job records3891 retains 'succeeded' tracked jobs3892 behaves like finalized background migration3893 processed the scheduled sidekiq queue3894 processed the async sidekiq queue3895 removes 'pending' tracked jobs3896 during retry race condition3897 behaves like finalized tracked background migration3898 processed the scheduled sidekiq queue3899 processed the async sidekiq queue3900 removes 'pending' tracked jobs3901 removes 'succeeded' tracked jobs3902 #migrate_in3903 calls perform_in for the correct worker3904 pushes a context with the current class name as caller_id3905 when a specific coordinator is given3906 uses that coordinator3907 #delete_queued_jobs3908 deletes all queued jobs for the given background migration3909 when the migration is running against the ci database3910 behaves like helpers that enqueue background migrations3911 #queue_background_migration_jobs_by_range_at_intervals3912 when the model has an ID column3913-- Scheduled 2 FooJob jobs with a maximum of 2 records per batch and an interval of 600 seconds.3914The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:30 UTC."3915 returns the final expected delay3916-- Scheduled 0 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3917The migration is expected to take at least 0 seconds. Expect all jobs to have completed after 2023-07-27 04:26:30 UTC."3918 returns zero when nothing gets queued3919 when the delay_interval is smaller than the minimum3920-- Scheduled 2 FooJob jobs with a maximum of 2 records per batch and an interval of 120 seconds.3921The migration is expected to take at least 240 seconds. Expect all jobs to have completed after 2023-07-27 04:30:30 UTC."3922 sets the delay_interval to the minimum value3923 with batch_size option3924-- Scheduled 2 FooJob jobs with a maximum of 2 records per batch and an interval of 600 seconds.3925The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:31 UTC."3926 queues jobs correctly3927 without batch_size option3928-- Scheduled 1 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3929The migration is expected to take at least 600 seconds. Expect all jobs to have completed after 2023-07-27 04:36:31 UTC."3930 queues jobs correctly3931 with other_job_arguments option3932-- Scheduled 1 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3933The migration is expected to take at least 600 seconds. Expect all jobs to have completed after 2023-07-27 04:36:32 UTC."3934 queues jobs correctly3935 with initial_delay option3936-- Scheduled 1 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3937The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:32 UTC."3938 queues jobs correctly3939 with track_jobs option3940-- Scheduled 1 ::FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3941The migration is expected to take at least 600 seconds. Expect all jobs to have completed after 2023-07-27 04:36:32 UTC."3942 creates a record for each job in the database3943 without track_jobs option3944-- Scheduled 1 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3945The migration is expected to take at least 600 seconds. Expect all jobs to have completed after 2023-07-27 04:36:33 UTC."3946 does not create records in the database3947 when the model specifies a primary_column_name3948-- Scheduled 2 FooJob jobs with a maximum of 2 records per batch and an interval of 600 seconds.3949The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:33 UTC."3950 returns the final expected delay3951 when the primary_column_name is a string3952-- Scheduled 1 FooJob jobs with a maximum of 1000 records per batch and an interval of 600 seconds.3953The migration is expected to take at least 600 seconds. Expect all jobs to have completed after 2023-07-27 04:36:34 UTC."3954 does not raise error3955 when the primary_column_name is not an integer or a string3956 raises error3957 when the primary_column_name does not exist3958 raises error3959 when the model doesn't have an ID or primary_column_name column3960 raises error (for now)3961 when using Migration[2.0]3962 when restriction is set to gitlab_shared3963 does raise an exception3964 when within transaction3965 does raise an exception3966 #requeue_background_migration_jobs_by_range_at_intervals3967-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3968The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:36 UTC."3969 returns the expected duration3970-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3971The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:37 UTC."3972 queues pending jobs3973 when using Migration[2.0]3974ci: -- Scheduled 2 TestJob jobs with an interval of 600 seconds.3975The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:37 UTC."3976 does re-enqueue pending jobs3977 when restriction is set3978 does raise an exception3979 when within transaction3980 does raise an exception3981 when nothing is queued3982-- Scheduled 0 FakeJob jobs with an interval of 600 seconds.3983The migration is expected to take at least 0 seconds. Expect all jobs to have completed after 2023-07-27 04:26:37 UTC."3984 returns expected duration of zero when nothing gets queued3985 with batch_size option3986-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3987The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:37 UTC."3988 returns the expected duration3989-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3990The migration is expected to take at least 1200 seconds. Expect all jobs to have completed after 2023-07-27 04:46:38 UTC."3991 queues pending jobs3992-- Scheduled 0 TestJob jobs with an interval of 600 seconds.3993The migration is expected to take at least 0 seconds. Expect all jobs to have completed after 2023-07-27 04:26:38 UTC."3994 retrieve jobs in batches3995 with initial_delay option3996-- Scheduled 2 TestJob jobs with an interval of 600 seconds.3997The migration is expected to take at least 1380 seconds. Expect all jobs to have completed after 2023-07-27 04:49:38 UTC."3998 returns the expected duration3999-- Scheduled 2 TestJob jobs with an interval of 600 seconds.4000The migration is expected to take at least 1380 seconds. Expect all jobs to have completed after 2023-07-27 04:49:38 UTC."4001 queues pending jobs4002 when nothing is queued4003-- Scheduled 0 FakeJob jobs with an interval of 600 seconds.4004The migration is expected to take at least 0 seconds. Expect all jobs to have completed after 2023-07-27 04:26:38 UTC."4005 returns expected duration of zero when nothing gets queued4006 #finalize_background_migration4007 behaves like finalized tracked background migration4008 processed the scheduled sidekiq queue4009 processed the async sidekiq queue4010 removes 'pending' tracked jobs4011 removes 'succeeded' tracked jobs4012 when within transaction4013 does raise an exception4014 when using Migration[2.0]4015 behaves like finalized tracked background migration4016 processed the scheduled sidekiq queue4017 processed the async sidekiq queue4018 removes 'pending' tracked jobs4019 removes 'succeeded' tracked jobs4020 when restriction is set4021 does raise an exception4022 when running migration in reconfigured ActiveRecord::Base context4023 behaves like reconfigures connection stack4024 does restore connection hierarchy4025 when removing all tracked job records4026 behaves like finalized tracked background migration4027 processed the scheduled sidekiq queue4028 processed the async sidekiq queue4029 removes 'pending' tracked jobs4030 removes 'succeeded' tracked jobs4031 behaves like removed tracked jobs4032 removes 'pending' tracked jobs4033 behaves like removed tracked jobs4034 removes 'succeeded' tracked jobs4035 when retaining all tracked job records4036 retains 'succeeded' tracked jobs4037 behaves like finalized background migration4038 processed the scheduled sidekiq queue4039 processed the async sidekiq queue4040 removes 'pending' tracked jobs4041 during retry race condition4042 behaves like finalized tracked background migration4043 processed the scheduled sidekiq queue4044 processed the async sidekiq queue4045 removes 'pending' tracked jobs4046 removes 'succeeded' tracked jobs4047 #migrate_in4048 calls perform_in for the correct worker4049 pushes a context with the current class name as caller_id4050 when a specific coordinator is given4051 uses that coordinator4052 #delete_queued_jobs4053 deletes all queued jobs for the given background migration4054 #delete_job_tracking4055 with default status4056 retains 'pending' tracked jobs4057 removes 'succeeded' tracked jobs4058 with explicit status4059 removes 'pending' tracked jobs4060 removes 'succeeded' tracked jobs4061Gitlab::Database::Migrations::BaseBackgroundRunner4062 subclassing4063 requires that jobs_by_migration_name be implemented4064 requires that run_job be implemented4065Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers4066 #queue_batched_background_migration4067 creates the database record for the migration4068 when such migration already exists4069 does not create duplicate migration4070 when the job interval is lower than the minimum4071 sets the job interval to the minimum value4072 when additional arguments are passed to the method4073 when the job class provides job_arguments_count4074 when defined job arguments for the job class does not match provided arguments4075 raises an error4076 when defined job arguments for the job class match provided arguments4077 saves the arguments on the database record4078 when the job class does not provide job_arguments_count4079 does not raise an error4080 when the max_value is not given4081 when records exist in the database4082 creates the record with the current max value4083 creates the record with an active status4084 when the database is empty4085 sets the max value to the min value4086 creates the record with a finished status4087 when gitlab_schema is not given4088 fetches gitlab_schema from the migration context4089 #finalize_batched_background_migration4090 finalizes the migration4091 when the migration does not exist4092 raises an exception4093 when within transaction4094 does raise an exception4095 when running migration in reconfigured ActiveRecord::Base context4096 behaves like reconfigures connection stack4097 when restrict_gitlab_migration is set to gitlab_ci4098 finalizes the migration4099 when restrict_gitlab_migration is set to gitlab_main4100 does not find any migrations4101 when no restrict is set4102 does not find any migrations4103 when within transaction4104 does raise an exception4105 #delete_batched_background_migration4106 when migration exists4107 deletes it4108 when migration does not exist4109 does nothing4110 #gitlab_schema_from_context4111 when allowed_gitlab_schemas is not available4112 defaults to :gitlab_main4113 when allowed_gitlab_schemas is available4114 uses schema from allowed_gitlab_schema4115 #ensure_batched_background_migration_is_finished4116 raises an error when migration exists and is not marked as finished4117 does not raise error when migration exists and is marked as finished4118 finalizes the migration4119 when specified migration does not exist4120 when DBLAB_ENVIRONMENT is not set4121 logs a warning4122 when DBLAB_ENVIRONMENT is set4123 raises an error4124 when within transaction4125 does raise an exception4126 when the flag finalize is false4127 does not finalize the migration4128Gitlab::Database::Migrations::BatchedMigrationLastId4129 # order random4130 base_model: Ci::ApplicationRecord(abstract)4131 #read4132 when the file exists and have content4133 is expected to eq 994134 when the file exists and is blank4135 is expected to be nil4136 when the file doesn't exists4137 is expected to be nil4138 #store4139 creates the file properly4140 stores the proper id in the file4141 base_model: ApplicationRecord(abstract)4142 #read4143 when the file exists and have content4144 is expected to eq 994145 when the file exists and is blank4146 is expected to be nil4147 when the file doesn't exists4148 is expected to be nil4149 #store4150 creates the file properly4151 stores the proper id in the file4152Gitlab::Database::Migrations::ConstraintsHelpers4153 # order random4154 #add_check_constraint4155 when constraint name validation4156 raises an error when too long4157 does not raise error when the length is acceptable4158 when inside a transaction4159 raises an error4160 when outside a transaction4161 when the constraint is already defined in the database4162 does not create a constraint4163 when the constraint is not defined in the database4164 creates the constraint4165 when validate is not provided4166 performs validation4167 when validate is provided with a falsey value4168 skips validation4169 when validate is provided with a truthy value4170 performs validation4171 #check_not_null_constraint_exists?4172 when constraint_name is not provided4173 calls check_constraint_exists? with an infered constraint name4174 when constraint_name is provided4175 calls check_constraint_exists? with the correct parameters4176 #remove_not_null_constraint4177 when constraint_name is not provided4178 calls remove_check_constraint with an infered constraint name4179 when constraint_name is provided4180 calls remove_check_constraint with the correct parameters4181 #check_constraint_exists?4182 returns true if a constraint exists4183 returns false if a constraint does not exist4184 returns false if a constraint with the same name exists in another table4185 returns false if a constraint with the same name exists for the same table in another schema4186 #rename_constraint4187 executes the statement to rename constraint4188 #drop_constraint4189 executes the statement to drop the constraint4190 when cascade option is false4191 executes the statement to drop the constraint without cascade4192 #validate_not_null_constraint4193 when constraint_name is not provided4194 calls validate_check_constraint with an infered constraint name4195 when constraint_name is provided4196 calls validate_check_constraint with the correct parameters4197 #add_text_limit4198 when it is called with the default options4199 calls add_check_constraint with an infered constraint name and validate: true4200 when all parameters are provided4201 calls add_check_constraint with the correct parameters4202 #validate_text_limit4203 when constraint_name is not provided4204 calls validate_check_constraint with an infered constraint name4205 when constraint_name is provided4206 calls validate_check_constraint with the correct parameters4207 #switch_constraint_names4208 when inside a transaction4209 raises an error4210 when outside a transaction4211 executes the statement to swap the constraint names4212 #copy_check_constraints4213 when inside a transaction4214 raises an error4215 when outside a transaction4216 copies check constraints from one column to another4217 does nothing if there are no constraints defined for the old column4218 raises an error when the orginating column does not exist4219 raises an error when the target column does not exist4220 #check_text_limit_exists?4221 when constraint_name is not provided4222 calls check_constraint_exists? with an infered constraint name4223 when constraint_name is provided4224 calls check_constraint_exists? with the correct parameters4225 #remove_text_limit4226 when constraint_name is not provided4227 calls remove_check_constraint with an infered constraint name4228 when constraint_name is provided4229 calls remove_check_constraint with the correct parameters4230 #check_constraint_name4231 returns a valid constraint name4232 #validate_check_constraint4233 when the constraint does not exist4234 raises an error4235 when the constraint exists4236 performs validation4237 #add_not_null_constraint4238 when it is called with the default options4239 calls add_check_constraint with an infered constraint name and validate: true4240 when all parameters are provided4241 calls add_check_constraint with the correct parameters4242 when the column is defined as NOT NULL4243 does not add a check constraint4244 #remove_check_constraint4245 removes the constraint4246Gitlab::Database::Migrations::ExtensionHelpers4247 # order random4248 #drop_extension4249 executes CREATE EXTENSION statement4250 without proper permissions4251 raises an exception and prints an error message4252 #create_extension4253 executes CREATE EXTENSION statement4254 without proper permissions4255 raises an exception and prints an error message4256Gitlab::Database::Migrations::Instrumentation4257 #observe4258 executes the given block4259 behavior with observers4260 instantiates observer with observation4261 calls #before, #after, #record on given observers4262 ignores errors coming from observers #before4263 ignores errors coming from observers #after4264 ignores errors coming from observers #record4265 on successful execution4266 records a valid observation4267 transforms observation to expected json4268 upon failure4269 exception: StandardError, error_message: "something went wrong"4270 retrieving observations4271 records a valid observation4272 transforms observation to expected json4273 exception: ActiveRecord::StatementTimeout, error_message: "timeout"4274 retrieving observations4275 records a valid observation4276 transforms observation to expected json4277 sequence of migrations with failures4278 records observations for all migrations4279Gitlab::Database::Migrations::LockRetriesHelpers4280 # order random4281 #with_lock_retries4282 sets the migration class name in the logs4283 does not raise on exhaustion by default4284 defaults to allowing subtransactions4285 raise_on_exhaustion: true4286 sets raise_on_exhaustion as requested4287 raise_on_exhaustion: false4288 sets raise_on_exhaustion as requested4289Gitlab::Database::Migrations::LockRetryMixin4290 Gitlab::Database::Migrations::LockRetryMixin::ActiveRecordMigrationProxyLockRetries4291 #enable_lock_retries?4292 delegates to #migration4293 #migration_class4294 retrieves actual migration class from #migration4295 #migration_connection4296 retrieves actual migration connection from #migration4297 Gitlab::Database::Migrations::LockRetryMixin::ActiveRecordMigratorLockRetries4298 with transactions disabled4299 calls super method4300 with transactions enabled, but lock retries disabled4301 calls super method4302 with transactions enabled and lock retries enabled4303 calls super method4304 .patch!4305 patches MigrationProxy4306 patches Migrator4307Gitlab::Database::Migrations::Observers::BatchDetails4308 # order random4309 meta: {:job_meta=>nil}, expected_keys: ["time_spent"]4310 records expected information to file4311 meta: lazy { { job_meta: job_meta } }, expected_keys: ["time_spent", "min_value", "max_value", "batch_size", "sub_batch_size", "pause_ms"]4312 records expected information to file4313 meta: nil, expected_keys: ["time_spent"]4314 records expected information to file4315Gitlab::Database::Migrations::Observers::QueryDetails4316 records details of executed queries4317 unsubscribes after the observation4318Gitlab::Database::Migrations::Observers::QueryLog4319 writes a file with the query log4320 does not change the default logger4321Gitlab::Database::Migrations::Observers::QueryStatistics4322 #before4323 with pgss available4324 resets pg_stat_statements4325 without pgss available4326 executes nothing4327 #record4328 with pgss available4329 fetches data from pg_stat_statements and stores on the observation4330 without pgss available4331 executes nothing4332Gitlab::Database::Migrations::Observers::TotalDatabaseSizeChange4333 records the size change4334 out of order calls4335 does not record anything if before size is unknown4336 does not record anything if after size is unknown4337Gitlab::Database::Migrations::Observers::TransactionDuration4338 records real and sub transactions duration4339 when there are sub-transactions4340 records transaction duration4341 when there are real-transactions4342 records transaction duration4343Gitlab::Database::Migrations::PgBackendPid4344 # order random4345 Gitlab::Database::Migrations::PgBackendPid::MigratorPgBackendPid4346 re-yields with same arguments and wraps it with calls to .say4347 .say4348/builds/gitlab-org/gitlab/vendor/ruby/3.0.0/gems/rspec-mocks-3.12.6/lib/rspec/mocks/method_double.rb:294: warning: removing `object_id' may cause serious problems4349 outputs the connection information4350 outputs nothing if ActiveRecord::Migration.verbose is false4351 .patch!4352 patches ActiveRecord::Migrator4353Gitlab::Database::Migrations::RedisHelpers4354 # order random4355 #queue_redis_migration_job4356 when migrator does not exist4357 raises error and fails the migration4358 when migrator exists4359 checks migrator and enqueues job4360Gitlab::Database::Migrations::ReestablishedConnectionStack4361 #with_restored_connection_stack4362 main4363 behaves like reconfigures connection stack4364 does restore connection hierarchy4365 does keep original connection handler4366 ci4367 behaves like reconfigures connection stack4368 does restore connection hierarchy4369 does reconfigure connection handler4370Gitlab::Database::Migrations::RunnerBackoff::ActiveRecordMixin4371 # order random4372 Gitlab::Database::Migrations::RunnerBackoff::ActiveRecordMixin::ActiveRecordMigratorRunnerBackoff4373 with runner backoff disabled4374 calls super method4375 with runner backoff enabled4376 calls super method4377 Gitlab::Database::Migrations::RunnerBackoff::ActiveRecordMixin::ActiveRecordMigrationProxyRunnerBackoff4378 #enable_runner_backoff?4379 delegates to #migration4380 returns false if migration does not implement it4381 .patch!4382 patches MigrationProxy4383 patches Migrator4384Gitlab::Database::Migrations::RunnerBackoff::Communicator4385 # order random4386 .backoff_runner?4387 is expected to be falsey4388 is true when the lock is held4389 reads from Redis4390 with runner_migrations_backoff disabled4391 is false when the lock is held4392 .execute_with_lock4393 delegates to a new instance object4394 #execute_with_lock4395 is expected to yield control4396 raises error if it can not set the key4397 removes the lease after executing the migration4398 with logger4399 logs messages around execution4400Gitlab::Database::Migrations::RunnerBackoff::MigrationHelpers4401 # order random4402 .enable_runner_backoff!4403 sets the flag4404 #enable_runner_backoff?4405 is expected to be falsy4406 returns true if the flag is set4407 .enable_runner_backoff?4408 is expected to be falsy4409 returns true if the flag is set4410Gitlab::Database::Migrations::Runner4411 main database4412 creates the results dir when one does not exist4413 .up4414 result directory4415 uses the /up subdirectory4416 migrations to run4417 is the list of pending migrations4418 running migrations4419 runs the unapplied migrations in regular/post order, then version order4420 writes a metadata file with the current schema version and database name4421 runs the unapplied migrations on the correct database4422 .down4423 writes a metadata file with the current schema version4424 result directory4425 is the /down subdirectory4426 migrations to run4427 is the list of migrations that are up and on this branch4428 running migrations4429 runs the applied migrations for the current branch in reverse order4430 .background_migrations4431 is a TestBackgroundRunner4432 is configured with a result dir of /background_migrations4433 .batched_background_migrations4434 is a TestBatchedBackgroundRunner4435 choosing the database to test against4436 chooses the provided database4437 throws an error with an invalid name4438 includes the database name in the result dir4439 legacy mode4440 does not include the database name in the path4441 .batched_migrations_last_id4442 matches the expected runner class4443 main database (legacy mode)4444 creates the results dir when one does not exist4445 .up4446 result directory4447 uses the /up subdirectory4448 migrations to run4449 is the list of pending migrations4450 running migrations4451 runs the unapplied migrations in regular/post order, then version order4452 writes a metadata file with the current schema version and database name4453 runs the unapplied migrations on the correct database4454 .down4455 writes a metadata file with the current schema version4456 result directory4457 is the /down subdirectory4458 migrations to run4459 is the list of migrations that are up and on this branch4460 running migrations4461 runs the applied migrations for the current branch in reverse order4462 .background_migrations4463 is a TestBackgroundRunner4464 is configured with a result dir of /background_migrations4465 .batched_background_migrations4466 is a TestBatchedBackgroundRunner4467 choosing the database to test against4468 chooses the provided database4469 throws an error with an invalid name4470 includes the database name in the result dir4471 legacy mode4472 does not include the database name in the path4473 .batched_migrations_last_id4474 matches the expected runner class4475 ci database4476 creates the results dir when one does not exist4477 .up4478 result directory4479 uses the /up subdirectory4480 migrations to run4481 is the list of pending migrations4482 running migrations4483 runs the unapplied migrations in regular/post order, then version order4484 writes a metadata file with the current schema version and database name4485 runs the unapplied migrations on the correct database4486 .down4487 writes a metadata file with the current schema version4488 result directory4489 is the /down subdirectory4490 migrations to run4491 is the list of migrations that are up and on this branch4492 running migrations4493 runs the applied migrations for the current branch in reverse order4494 .background_migrations4495 is a TestBackgroundRunner4496 is configured with a result dir of /background_migrations4497 .batched_background_migrations4498 is a TestBatchedBackgroundRunner4499 choosing the database to test against4500 chooses the provided database4501 throws an error with an invalid name4502 includes the database name in the result dir4503 legacy mode4504 does not include the database name in the path4505 .batched_migrations_last_id4506 matches the expected runner class4507Gitlab::Database::Migrations::SidekiqHelpers4508 # order random4509 sidekiq migration helpers4510 #sidekiq_remove_jobs4511 when inside a transaction4512 raises RuntimeError4513 when outside a transaction4514 removes all related job instances from the job classes' queues4515 when the constant is not defined4516 doesn't try to delete it4517 when the constant is defined4518 will use it find job instances to delete4519 when job instances are in the scheduled set4520 removes all related job instances from the scheduled set4521 when job instances are in the retry set4522 removes all related job instances from the retry set4523 when job fails to be deleted4524 and does not work enough times in a row before max attempts4525 tries the max attempts without succeeding4526 and then it works enough times in a row before max attempts4527 succeeds4528 #sidekiq_queue_length4529 when queue is empty4530 returns zero4531 when queue contains jobs4532 returns correct size of the queue4533 #sidekiq_queue_migrate4534 migrates jobs from one sidekiq queue to another4535Gitlab::Database::Migrations::Squasher4536 # order random4537 #files_to_delete4538 only deletes the files we're expecting4539Gitlab::Database::Migrations::TestBackgroundRunner4540 without jobs to run4541 returns immediately4542 with jobs to run4543 finding pending background jobs4544 finds all the migrations4545 running migrations4546 runs the migration class correctly4547 runs the migration for a uniform amount of time4548 with multiple migrations to run4549 splits the time between migrations when all migrations use all their time4550 does not give leftover time to extra migrations4551Gitlab::Database::Migrations::TestBatchedBackgroundRunner4552 main database4553 running a real background migration4554 runs sampled jobs from the batched background migration4555 uses the correct params to instrument the background migration4556 uses the filtering clause from the migration4557 exports migration details to a file4558 with jobs to run4559 samples jobs4560 samples 1 job with a batch size higher than the table size4561 does not sample a job if there are zero rows to sample4562 with multiple jobs to run4563 runs all pending jobs based on the last migration id4564 choosing uniform batches to run4565 #uniform_fractions4566 generates evenly distributed sequences of fractions4567 ci database4568 running a real background migration4569 runs sampled jobs from the batched background migration4570 uses the correct params to instrument the background migration4571 uses the filtering clause from the migration4572 exports migration details to a file4573 with jobs to run4574 samples jobs4575 samples 1 job with a batch size higher than the table size4576 does not sample a job if there are zero rows to sample4577 with multiple jobs to run4578 runs all pending jobs based on the last migration id4579 choosing uniform batches to run4580 #uniform_fractions4581 generates evenly distributed sequences of fractions4582Gitlab::Database::Migrations::TimeoutHelpers4583 # order random4584 #disable_statement_timeout4585-- transaction_open?()4586 -> 0.0001s4587 disables statement timeouts to current transaction only4588 with real environment4589-- execute("SET statement_timeout TO '20000'")4590 -> 0.0012s4591-- execute("SHOW statement_timeout")4592 -> 0.0010s4593-- transaction_open?()4594 -> 0.0001s4595-- execute("SET LOCAL statement_timeout TO 0")4596 -> 0.0017s4597-- execute("SHOW statement_timeout")4598 -> 0.0007s4599-- execute("SHOW statement_timeout")4600 -> 0.0007s4601-- execute("RESET statement_timeout")4602 -> 0.0007s4603 defines statement to 0 only for current transaction4604 when passing a blocks4605-- execute("SET statement_timeout TO '20000'")4606 -> 0.0041s4607 disables statement timeouts on session level and executes the block4608 with real environment4609-- execute("SET statement_timeout TO '20000'")4610 -> 0.0035s4611-- execute("SET statement_timeout TO '20000'")4612 -> 0.0011s4613-- execute("SHOW statement_timeout")4614 -> 0.0009s4615-- execute("SET statement_timeout TO 0")4616 -> 0.0008s4617-- execute("SHOW statement_timeout")4618 -> 0.0015s4619-- execute("SHOW statement_timeout")4620 -> 0.0007s4621-- execute("RESET statement_timeout")4622 -> 0.0008s4623-- execute("RESET statement_timeout")4624 -> 0.0008s4625-- execute("RESET statement_timeout")4626 -> 0.0009s4627 defines statement to 0 for any code run inside the block4628 when the statement_timeout is already disabled4629 yields control without disabling the timeout or resetting4630cross-database foreign keys4631 onlies have allowed list of cross-database foreign keys4632Gitlab::Database::ObsoleteIgnoredColumns4633 # order random4634 #execute4635 returns a list of class names and columns pairs4636Gitlab::Database::Partitioning::CiSlidingListStrategy4637 # order random4638 #extra_partitions4639 when all partitions are true for detach_partition_if4640 is expected to be empty4641 when all partitions are false for detach_partition_if4642 is expected to be empty4643 #active_partition4644 is the partition with the largest value4645 #validate_and_fix4646 does not call change_column_default4647 #current_partitions4648 detects both partitions4649 #initial_partition4650 starts with the value 1004651 with routing tables4652 removes the prefix4653 #next_partition4654 is one after the active partition4655 with routing tables4656 removes the prefix4657 #missing_partitions4658 when next_partition_if returns true4659 is a partition definition for the next partition in the series4660 when next_partition_if returns false4661 is empty4662 when there are no partitions for the table4663 returns a partition for value 14664 #ensure_partitioning_column_ignored_or_readonly!4665 does not raise when the column is not ignored4666Gitlab::Database::Partitioning::DetachedPartitionDropper4667 #perform4668 when the partition should not be dropped yet4669 does not drop the partition4670 with a partition to drop4671 drops the partition4672 removing foreign keys4673 removes foreign keys from the table before dropping it4674 does not remove foreign keys from the parent table4675 when another process drops the foreign key4676 skips dropping that foreign key4677 when another process drops the partition4678 skips dropping the foreign key4679 when another process drops the table while the first waits for a lock4680 skips the table4681 when the partition to drop is still attached to its table4682 does not drop the partition, but does remove the DetachedPartition entry4683 when another process removes the entry before this process4684 does nothing4685 with multiple partitions to drop4686 drops both partitions4687 when the first drop returns an error4688 still drops the second partition4689Gitlab::Database::Partitioning::List::ConvertTable4690 # order random4691 #partition4692WARNING: Active Record does not support composite primary key.4693_test_table_to_partition_parent has composite primary key. Composite primary key is ignored.4694 migrates the table to a partitioned table4695 when the primary key is incorrect4696 throws a reasonable error message4697 when there is not a supporting check constraint4698 throws a reasonable error message4699 when supporting check constraint is not valid4700 throws a reasonable error message4701 when the existing table is owned by a different user4702 partitions without error4703 when an error occurs during the conversion4704 when partitioning fails the first time4705 creating parent table4706 recovers from a fault4707 adding the first foreign key4708 recovers from a fault4709 adding the second foreign key4710 recovers from a fault4711 attaching table4712 recovers from a fault4713 when table has LFK triggers4714 moves the trigger on the parent table4715 #prepare_for_partitioning4716 adds a check constraint4717 when it fails to add constraint4718 raises UnableToPartition error4719 when async4720 adds a NOT VALID check constraint4721 adds a PostgresAsyncConstraintValidation record4722 when constraint exists but is not valid4723 validates the check constraint4724 when it fails to validate constraint4725 raises UnableToPartition error4726 when constraint exists and is valid4727 raises UnableToPartition error4728 #revert_preparation_for_partitioning4729 removes a check constraint4730 #revert_partitioning4731 detaches the partition4732 does not drop the child partition4733 removes the parent table4734 re-adds the check constraint4735 moves sequences back to the original table4736 when table has LFK triggers4737 restores the trigger on the partition4738Gitlab::Database::Partitioning::List::LockingConfiguration4739 # order random4740 #locking_statement_for4741main: -- quote_table_name("table_1")4742main: -> 0.0002s4743main: -- quote_table_name("table_1")4744main: -> 0.0001s4745 only includes locking information for tables in the locking specification4746 is nil when none of the tables match the lock configuration4747main: -- quote_table_name("table_2")4748main: -> 0.0002s4749main: -- quote_table_name("table_3")4750main: -> 0.0001s4751 is a lock tables statement4752 raises if a table name with schema is passed4753 #lock_ordering_for4754 is the intersection with the locking specification, in the order of the specification4755 raises if a table name with schema is passed4756Gitlab::Database::Partitioning::MonthlyStrategy4757 #current_partitions4758 detects both partitions4759 #missing_partitions4760 with existing partitions4761 detects the gap and the missing partition in May 20204762 detects the missing partitions at the end of the range and expects a partition for July 20204763 detects the missing partitions at the end of the range and expects a partition for August 20204764 creates partitions 6 months out from now (Sep 2020 through Feb 2021)4765 detects all missing partitions4766 when pruning partitions before June 20204767 does not include the missing partition from May 2020 because it would be dropped4768 detects the missing partition for 1 month ago (July 2020)4769 without existing partitions4770 detects the missing catch-all partition at the beginning4771 detects the missing partition for today and expects a partition for August 20204772 creates partitions 6 months out from now (Sep 2020 through Feb 20214773 detects all missing partitions4774 when pruning partitions before June 20204775 detects exactly the set of partitions from June 2020 to March 20214776 with a regular partition but no catchall (MINVALUE, to) partition4777 detects a missing catch-all partition to add before the existing partition4778 #extra_partitions4779 with existing partitions4780 without a time retention policy4781 has no extra partitions to prune4782 with a time retention policy that excludes no partitions4783 has no extra partitions to prune4784 with a time retention policy of 3 months4785 prunes the unbounded partition ending 2020-05-014786 with a time retention policy of 2 months4787 prunes the unbounded partition and the partition for May-June4788 when the retain_non_empty_partitions is true4789 prunes empty partitions4790 does not prune non-empty partitions4791Gitlab::Database::Partitioning::PartitionManager4792 creating partitions (mocked)4793 when the given table is partitioned4794 creates the partition4795 with explicitly provided connection4796 uses the explicitly provided connection when any4797 when an ArgumentError occurs during partition management4798 raises error4799 when an error occurs during partition management4800 does not raise an error4801 when the table is not partitioned4802 does not try creating the partitions4803 creating partitions4804 creates partitions4805 detaching partitions (mocked)4806 detaches each extra partition4807 logs an error if the partitions are not detachable4808 #detach_partitions4809 detaches exactly one partition4810 detaches the old partition4811 deletes zero tables4812 creates the appropriate PendingPartitionDrop entry4813 when the model is the target of a foreign key4814 does not detach partitions with a referenced foreign key4815 creating and then detaching partitions for a table4816 creates partitions for the future then drops the oldest one after a month4817Gitlab::Database::Partitioning::PartitionMonitoring4818 #report_metrics4819 reports number of present partitions4820 reports number of missing partitions4821 reports number of extra partitions4822Gitlab::Database::Partitioning::ReplaceTable#perform4823 replaces the current table, archiving the old4824 transfers the primary key sequence to the replacement table4825 renames the primary key constraints to match the new table names4826 when the table has partitions4827 renames the partitions to match the new table name4828 renames the primary key constraints to match the new partition names4829Gitlab::Database::Partitioning::SingleNumericListPartition4830 .from_sql4831 uses specified table name4832 uses specified partition name4833 parses the definition4834 #partition_name4835 is the explicit name if provided4836 defaults to the table name followed by the partition value4837 sorting4838 is incomparable if the tables do not match4839 sorts by the value when the tables match4840 sorts by numeric value rather than text value4841Gitlab::Database::Partitioning::SlidingListStrategy4842 #current_partitions4843 detects both partitions4844 #validate_and_fix4845 does not call change_column_default if the partitioning in a valid state4846 calls change_column_default on partition_key with the most default partition number4847 does not change the default column if it has been changed in the meanwhile by another process4848 when the shared connection is for the wrong database4849 does not attempt to fix connections4850 #active_partition4851 is the partition with the largest value4852 #missing_partitions4853 when next_partition_if returns true4854 is a partition definition for the next partition in the series4855 when next_partition_if returns false4856 is empty4857 when there are no partitions for the table4858 returns a partition for value 14859 #extra_partitions4860 when some partitions are true for detach_partition_if4861 is the leading set of partitions before that value4862 when all partitions are true for detach_partition_if4863 is all but the most recent partition4864 #initial_partition4865 starts with the value 14866 #next_partition4867 is one after the active partition4868 #ensure_partitioning_column_ignored!4869 raises when the column is not ignored4870 does not raise when the column is ignored4871 redirecting inserts as the active partition changes4872 redirects to the new partition4873Gitlab::Database::Partitioning::TimePartition4874 .from_sql4875 uses specified table name4876 uses specified partition name4877 parses start date4878 parses end date4879 with MINVALUE as a start date4880 sets from to nil4881 with MAXVALUE as an end date4882 raises a NotImplementedError4883 #partition_name4884 uses table as prefix4885 uses Year-Month (from) as suffix4886 without from date4887 uses 000000 as suffix for first partition4888 with partition name explicitly given4889 uses given partition name4890 #to_sql4891 transforms to a CREATE TABLE statement4892 without from date4893 uses MINVALUE instead4894 object equality - #eql4895 treats objects identical with identical attributes4896 different table leads to in-equality4897 different from leads to in-equality4898 different to leads to in-equality4899 different partition_name leads to in-equality4900 nil partition_name is ignored if auto-generated matches4901 Comparable, #<=>4902 sorts by partition name, i.e. by month - MINVALUE partition first4903 returns nil for partitions of different tables4904Gitlab::Database::PartitioningMigrationHelpers::BackfillPartitionedTable#perform4905 when the destination table exists4906WARNING: Active Record does not support composite primary key.4907_test_partitioning_backfills_part has composite primary key. Composite primary key is ignored.4908 copies data into the destination table idempotently4909 breaks the assigned batch into smaller batches4910 pauses after copying each sub-batch4911 marks each job record as succeeded after processing4912 returns the number of job records marked as succeeded4913 when the job is run within an explicit transaction block4914 raises an error before copying data4915 when the destination table does not exist4916 exits without attempting to copy data4917 logs a warning message that the job was skipped4918Gitlab::Database::PartitioningMigrationHelpers::ForeignKeyHelpers4919 #add_concurrent_partitioned_foreign_key4920 when the foreign key does not exist on the parent table4921 creates the foreign key on each partition, and the parent table4922 with validate: false option4923 creates the foreign key only on partitions4924 when the foreign key exists on the parent table4925 does not attempt to create any foreign keys4926 when additional foreign key options are given4927 forwards them to the foreign key helper methods4928 when run inside a transaction block4929 raises an error4930 #validate_partitioned_foreign_key4931 when run inside a transaction block4932 raises an error4933 when run outside a transaction block4934 validates FK for each partition4935Gitlab::Database::PartitioningMigrationHelpers::IndexHelpers4936 #add_concurrent_partitioned_index4937 when the index does not exist on the parent table4938 creates the index on each partition, and the parent table4939 when the index exists on the parent table4940 does not attempt to create any indexes4941 when additional index options are given4942 forwards them to the index helper methods4943 when a name argument for the index is not given4944 raises an error4945 when the given table is not a partitioned table4946 raises an error4947 when run inside a transaction block4948 raises an error4949 #remove_concurrent_partitioned_index_by_name4950 when the index exists4951 drops the index on the parent table, cascading to all partitions4952 when the index does not exist4953 does not attempt to drop the index4954 when the given table is not a partitioned table4955 raises an error4956 when run inside a transaction block4957 raises an error4958 #find_duplicate_indexes4959 when duplicate and non-duplicate indexes exist4960 finds the duplicate index4961 #indexes_by_definition_for_table4962 when a partitioned table has indexes4963 captures partitioned index names by index definition4964 when a non-partitioned table has indexes4965 captures index names by index definition4966 when a non-partitioned table has duplicate indexes4967 raises an error4968 #rename_indexes_for_table4969 when changing a table within the current schema4970 maps index names after they are changed4971 does not rename an index which does not exist in the to_hash4972 when partitioning an existing table4973 renames indexes across schemas4974Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers4975 list partitioning conversion helpers4976 #convert_table_to_first_list_partition4977 behaves like delegates to ConvertTable4978 throws an error if in a transaction4979 delegates to a method on List::ConvertTable4980 #revert_converting_table_to_first_list_partition4981 behaves like delegates to ConvertTable4982 throws an error if in a transaction4983 delegates to a method on List::ConvertTable4984 #prepare_constraint_for_list_partitioning4985 behaves like delegates to ConvertTable4986 throws an error if in a transaction4987 delegates to a method on List::ConvertTable4988 #revert_preparing_constraint_for_list_partitioning4989 behaves like delegates to ConvertTable4990 throws an error if in a transaction4991 delegates to a method on List::ConvertTable4992 #partition_table_by_date4993 when the table is not allowed4994 raises an error4995 when run inside a transaction block4996 raises an error4997 when the the max_date is less than the min_date4998 raises an error4999 when the max_date is equal to the min_date5000 raises an error5001 when the given table does not have a primary key5002 raises an error5003 when an invalid partition column is given5004 raises an error5005 constructing the partitioned table5006 creates a table partitioned by the proper column5007 requires the migration helper to be run in DDL mode5008 changes the primary key datatype to bigint5009 removes the default from the primary key column5010 creates the partitioned table with the same non-key columns5011 creates a partition spanning over each month in the range given5012 with a non-integer primary key datatype5013 does not change the primary key datatype5014 when min_date is not given5015 with records present already5016 creates a partition spanning over each month from the first record5017 without data5018 creates the catchall partition plus two actual partition5019 when max_date is not given5020 creates partitions including the next month from today5021 without min_date, max_date5022 creates partitions for the current and next month5023 keeping data in sync with the partitioned table5024 creates a trigger function on the original table5025 syncs inserts to the partitioned tables5026 syncs updates to the partitioned tables5027 syncs deletes to the partitioned tables5028 #drop_partitioned_table_for5029 drops the trigger syncing to the partitioned table5030 drops the partitioned copy and all partitions5031 when the table is not allowed5032 raises an error5033 #enqueue_partitioning_data_migration5034 when the table is not allowed5035 raises an error5036 when run inside a transaction block5037 raises an error5038 when records exist in the source table5039 enqueues jobs to copy each batch of data5040 #cleanup_partitioning_data_migration5041 when the table is not allowed5042 raises an error5043 when tracking records exist in the batched_background_migrations table5044 deletes those pertaining to the given table5045 #create_hash_partitions5046 creates partitions for the full hash space (8 partitions)5047 creates partitions for the full hash space (16 partitions)5048 #finalize_backfilling_partitioned_table5049 when the table is not allowed5050 raises an error5051 when the partitioned table does not exist5052 raises an error5053 finishing pending batched background migration jobs5054 ensures finishing of remaining jobs and vacuums the partitioned table5055 #replace_with_partitioned_table5056 replaces the original table with the partitioned table5057 moves the trigger from the original table to the new table5058 #rollback_replace_with_partitioned_table5059 replaces the partitioned table with the non-partitioned table5060 moves the trigger from the partitioned table to the non-partitioned table5061 #drop_nonpartitioned_archive_table5062 drops the archive table5063 drops the trigger on the source table5064 drops the sync function5065 #create_trigger_to_sync_tables5066 creates the sync function5067 installs the trigger5068Gitlab::Database::Partitioning5069 .register_models5070 ensure that the registered models have partitioning strategy5071 fails when partitioning_strategy is not specified for the model5072 .sync_partitions_ignore_db_error5073 calls sync_partitions5074 when ActiveRecord::ActiveRecordError is raised5075 ignores it5076 when PG::Error is raised5077 ignores it5078 when DISABLE_POSTGRES_PARTITION_CREATION_ON_STARTUP is set5079 does not call sync_partitions5080 .sync_partitions5081 manages partitions for each given model5082 with multiple databases5083 creates partitions in each database5084 without ci database5085 only creates partitions for main database (PENDING: Skipping because database ci exists)5086 when no partitioned models are given5087 manages partitions for each registered model5088 when only a specific database is requested5089 manages partitions for models for the given database5090 when partition_manager_sync_partitions feature flag is disabled5091 skips sync_partitions5092 .report_metrics5093 when no partitioned models are given5094 reports metrics for each registered model5095 when partitioned models are given5096 reports metrics for each given model5097 .drop_detached_partitions5098 drops detached partitions for each database5099 when the feature flag is disabled5100 does not call the DetachedPartitionDropper5101Gitlab::Database::PgClass5102 #cardinality_estimate5103 when no information is available5104 returns nil for the estimate5105 with reltuples available5106 returns the reltuples for the estimate5107 .for_table5108 returns PgClass for this table5109 matches the relname5110Gitlab::Database::PgDepend5111 # order random5112 .from_pg_extension5113 when having views as dependency5114 returns pg_stat_statements (PENDING: Skipping ./spec/lib/gitlab/database/pg_depend_spec.rb[1:1:1:1] because it's been fast-quarantined.)5115Gitlab::Database::PostgresAutovacuumActivity5116 is expected to be a kind of Gitlab::Database::SharedModel(abstract)5117 .for_tables5118 returns autovacuum activity for queries tables5119 executes the query5120 .wraparound_prevention5121 is expected to match (a hash including {"wraparound_prevention" => true})5122Gitlab::Database::PostgresConstraint5123 # order random5124 #check_constraints5125 finds check constraints for the table5126 includes columns for the check constraints5127 #not_including_column5128 only matches constraints not including the given column5129 #valid5130 excludes invalid constraints5131 #by_table_identifier5132 includes all constraints on the table5133 throws an error if the format is incorrect5134 #primary_key_constraints5135 finds the primary key constraint for the table5136 finds the columns in the primary key constraint5137 #primary_or_unique_constraints5138 finds primary and unique constraints5139 #including_column5140 only matches constraints on the given column5141 #unique_constraints5142 finds the unique constraints for the table5143Gitlab::Database::PostgresForeignKey5144 #by_referenced_table_identifier5145 throws an error when the identifier name is not fully qualified5146 finds the foreign keys for the referenced table5147 #by_referenced_table_name5148 finds the foreign keys for the referenced table5149 #by_constrained_table_identifier5150 throws an error when the identifier name is not fully qualified5151 finds the foreign keys for the constrained table5152 #by_constrained_table_name5153 finds the foreign keys for the constrained table5154 #by_constrained_table_name_or_identifier5155 when using table name5156 finds the foreign keys for the constrained table5157 when using identifier5158 finds the foreign keys for the constrained table5159 #by_name5160 finds foreign keys by name5161 when finding columns for foreign keys5162 fk: lazy { described_class.find_by(name: 'fk_constrained_to_referenced') }, expected_constrained: ["referenced_table_id", "referenced_table_id_b"], expected_referenced: ["id", "id_b"]5163 finds the correct constrained column names5164 finds the correct referenced column names5165 #by_constrained_columns5166 finds the correct foreign key5167 #by_referenced_columns5168 finds the correct foreign key5169 fk: lazy { described_class.find_by(name: 'fk_constrained_to_other_referenced') }, expected_constrained: ["other_referenced_table_id"], expected_referenced: ["id"]5170 finds the correct constrained column names5171 finds the correct referenced column names5172 #by_constrained_columns5173 finds the correct foreign key5174 #by_referenced_columns5175 finds the correct foreign key5176 #on_delete_action and #on_update_action5177 with an invalid on_delete_action5178 raises an error5179 fk_name: "fk_no_action", expected_action: "no_action"5180 has the appropriate on delete action5181 has the appropriate on update action5182 #by_on_delete_action5183 finds the key by on delete action5184 #by_on_update_action5185 finds the key by on update action5186 fk_name: "fk_restrict", expected_action: "restrict"5187 has the appropriate on delete action5188 has the appropriate on update action5189 #by_on_delete_action5190 finds the key by on delete action5191 #by_on_update_action5192 finds the key by on update action5193 fk_name: "fk_nullify", expected_action: "nullify"5194 has the appropriate on delete action5195 has the appropriate on update action5196 #by_on_delete_action5197 finds the key by on delete action5198 #by_on_update_action5199 finds the key by on update action5200 fk_name: "fk_cascade", expected_action: "cascade"5201 has the appropriate on delete action5202 has the appropriate on update action5203 #by_on_delete_action5204 finds the key by on delete action5205 #by_on_update_action5206 finds the key by on update action5207 fk_name: "fk_set_default", expected_action: "set_default"5208 has the appropriate on delete action5209 has the appropriate on update action5210 #by_on_delete_action5211 finds the key by on delete action5212 #by_on_update_action5213 finds the key by on update action5214 when supporting foreign keys on partitioned tables5215 #is_inherited5216 fk: lazy { described_class.find_by(name: 'fk_inherited') }, inherited: false5217 has the appropriate inheritance value5218 fk: lazy { described_class.by_referenced_table_identifier(schema_table_name('child')).first! }, inherited: true5219 has the appropriate inheritance value5220 fk: lazy { described_class.find_by(name: 'fk_constrained_to_referenced') }, inherited: false5221 has the appropriate inheritance value5222 #not_inherited5223 lists all non-inherited foreign keys5224 with two tables both partitioned5225 #child_foreign_keys5226 is the child foreign keys of the partitioned parent fk5227Gitlab::Database::PostgresHll::BatchDistinctCounter5228 unit test for different counting parameters5229 #execute5230 builds hll buckets5231 defaults batch size to 100005232 when a transaction is open5233 raises an error5234 disallowed configurations5235 raises WRONG_CONFIGURATION_ERROR if start is bigger than finish5236 raises WRONG_CONFIGURATION_ERROR if data volume exceeds upper limit5237 raises WRONG_CONFIGURATION_ERROR if batch size is less than min required5238Gitlab::Database::PostgresHll::Buckets5239 #estimated_distinct_count5240 provides estimated cardinality5241 #merge_hash!5242 merges two hashes together into union of two sets5243 #to_json5244 serialize HyperLogLog buckets as hash5245Gitlab::Database::PostgresIndexBloatEstimate5246 is expected to be a kind of Gitlab::Database::SharedModel(abstract)5247 #bloat_size5248 returns the bloat size in bytes5249 #bloat_size_bytes5250 is an alias of #bloat_size5251 #index5252 belongs to a PostgresIndex5253Gitlab::Database::PostgresIndex5254 is expected to be a kind of Gitlab::Database::SharedModel(abstract)5255 behaves like a postgres model5256 .by_identifier5257 finds the Gitlab::Database::PostgresIndex5258 raises an error if not found5259 raises ArgumentError if given a non-fully qualified identifier5260 #to_s5261 returns the name5262 #schema5263 returns the schema5264 #name5265 returns the name5266 .reindexing_support5267 only non partitioned indexes5268 only indexes that dont serve an exclusion constraint5269 only non-expression indexes5270 only btree and gist indexes5271 with leftover indexes5272 excludes temporary indexes from reindexing5273 .reindexing_leftovers5274 retrieves leftover indexes matching the /_ccnew[0-9]*$/ pattern5275 .not_match5276 excludes indexes matching the given regex5277 matches indexes without this prefix regex5278 #bloat_size5279 returns the bloat size from the estimate5280 without a bloat estimate available5281 returns 05282 #relative_bloat_level5283 calculates the relative bloat level5284 #reset5285 calls #reload5286 resets the bloat estimation5287 #unique?5288 returns true for a unique index5289 returns false for a regular, non-unique index5290 returns true for a primary key index5291 #valid_index?5292 returns true if the index is invalid5293 returns false if the index is marked as invalid5294 #definition5295 returns the index definition5296Gitlab::Database::PostgresPartition5297 associations5298 is expected to belong to postgres_partitioned_table required: false5299 behaves like a postgres model5300 .by_identifier5301 finds the Gitlab::Database::PostgresPartition5302 raises an error if not found5303 raises ArgumentError if given a non-fully qualified identifier5304 #to_s5305 returns the name5306 #schema5307 returns the schema5308 #name5309 returns the name5310 .for_parent_table5311 returns partitions for the parent table in the current schema5312 returns the partitions if the parent table schema is included in the table name5313 does not return partitions for tables not in the current schema5314 does not return partitions for tables if the schema is not the current5315 #parent_identifier5316 returns the parent table identifier5317 #condition5318 returns the condition for the partitioned values5319 .partition_exists?5320 when the partition exists5321 is expected to be truthy5322 when the partition does not exist5323 is expected to be falsey5324 .legacy_partition_exists?5325 when the partition exists5326 is expected to be truthy5327 when the partition does not exist5328 is expected to be falsey5329Gitlab::Database::PostgresPartitionedTable5330 associations5331 is expected to have many postgres_partitions5332 behaves like a postgres model5333 .by_identifier5334 finds the Gitlab::Database::PostgresPartitionedTable5335 raises an error if not found5336 raises ArgumentError if given a non-fully qualified identifier5337 #to_s5338 returns the name5339 #schema5340 returns the schema5341 #name5342 returns the name5343 .find_by_name_in_current_schema5344 finds the partitioned tables in the current schema by name5345 does not find partitioned tables in a different schema5346 .each_partition5347 without partitions5348 does not yield control5349 with partitions5350 yields control with partition as argument5351 #dynamic?5352 returns true for tables partitioned by range5353 returns true for tables partitioned by list5354 returns false for tables partitioned by hash5355 #static?5356 returns false for tables partitioned by range5357 returns false for tables partitioned by list5358 returns true for tables partitioned by hash5359 #strategy5360 returns the partitioning strategy5361 #key_columns5362 returns the partitioning key columns5363Gitlab::Database::PostgresqlAdapter::DumpSchemaVersionsMixin5364 calls SchemaMigrations touch_all and skips original implementation5365 does not call touch_all in production5366Gitlab::Database::PostgresqlAdapter::ForceDisconnectableMixin5367 checking in a connection to the pool5368 calls the force disconnect callback on checkin5369 disconnecting from the database5370 when the timer is expired5371 disconnects from the database5372 when the timer is not expired5373 does not disconnect from the database5374Gitlab::Database::PostgresqlAdapter::TypeMapCache5375 #initialize_type_map5376 caches loading of types in memory5377 only reuses the cache if the connection parameters are exactly the same5378 #reload_type_map5379 clears the cache and executes the type map query again5380Gitlab::Database::PostgresqlDatabaseTasks::LoadSchemaVersionsMixin5381 calls SchemaMigrations load_all5382Gitlab::Database::QueryAnalyzer5383 the hook is enabled by default in specs5384 does process queries and gets normalized SQL5385 does prevent recursive execution5386 #within5387 when it is already initialized5388 does initialize analyzer only once5389 does initialize user analyzer when enabled5390 does initialize user analyzer only once5391 does not initializer user analyzer when disabled5392 when initializer is enabled5393 calls begin! and end!5394 when begin! raises the end! is not called5395 when user analyzers are used5396 calls begin! and end!5397 #process_sql5398 does not analyze query if not enabled5399 does analyze query if enabled5400 does track exception if query cannot be parsed5401 does track exception if analyzer raises exception on enabled?5402 does track exception if analyzer raises exception on analyze5403 does call analyze only on enabled initializers5404 does not call analyze on suppressed analyzers5405 does call analyze on suppressed analyzers if some queries require tracking5406Gitlab::Database::QueryAnalyzers::Ci::PartitioningIdAnalyzer5407 # order random5408 when ci_partitioning_analyze_queries_partition_id_check is enabled5409 when querying a routing table5410 when partition_id is present5411 when selecting data5412 behaves like a good query5413 does not raise error5414 with a join query5415 behaves like a good query5416 does not raise error5417 when removing data5418 behaves like a good query5419 does not raise error5420 when updating data5421 behaves like a good query5422 does not raise error5423 when inserting a record5424 behaves like a good query5425 does not raise error5426 when partition_id is missing5427 when inserting a record5428 behaves like a bad query5429 raises PartitionIdMissingError5430 when selecting data5431 behaves like a bad query5432 raises PartitionIdMissingError5433 when removing data5434 behaves like a bad query5435 raises PartitionIdMissingError5436 when updating data5437 behaves like a bad query5438 raises PartitionIdMissingError5439 with a join query5440 behaves like a bad query5441 raises PartitionIdMissingError5442 when ci_partitioning_analyze_queries_partition_id_check is disabled5443 does not analyze the query5444Gitlab::Database::QueryAnalyzers::Ci::PartitioningRoutingAnalyzer5445 # order random5446 when ci_partitioning_analyze_queries is enabled5447 when analyzing targeted tables5448 when querying a non routing table5449 tracks exception5450 raises RoutingTableNotUsedError5451 when updating a record5452 raises RoutingTableNotUsedError5453 when inserting a record5454 raises RoutingTableNotUsedError5455 when analyzing non targeted table5456 does not raise error5457 when ci_partitioning_analyze_queries is disabled5458 does not analyze the query5459Gitlab::Database::QueryAnalyzers::GitlabSchemasMetrics5460 does not increment metrics if feature flag is disabled5461 properly observes all queries5462 for simple query observes schema correctly5463 is expected to receive increment({:db_config_name=>"main", :gitlab_schemas=>"gitlab_main"}) 1 time5464 for query accessing gitlab_ci and gitlab_main5465 is expected to receive increment({:db_config_name=>"main", :gitlab_schemas=>"gitlab_ci,gitlab_main"}) 1 time5466 for query accessing gitlab_ci and gitlab_main the gitlab_schemas is always ordered5467 is expected to receive increment({:db_config_name=>"main", :gitlab_schemas=>"gitlab_ci,gitlab_main"}) 1 time5468 for query accessing CI database5469 is expected to receive increment({:db_config_name=>"ci", :gitlab_schemas=>"gitlab_ci"}) 1 time5470 for query accessing gitlab_main and unknown schema5471 is expected to raise /Could not find gitlab schema for table not_in_schema/5472 for query altering an INDEX5473 is expected not to receive increment(*(any args)) 0 times5474Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection5475 properly observes all queries5476 for simple query observes schema correctly5477 is expected not to raise Exception5478 for query accessing gitlab_ci and gitlab_main5479 is expected to raise /The query tried to access \["projects", "ci_builds"\]/5480 for query accessing gitlab_ci and gitlab_main the gitlab_schemas is always ordered5481 is expected to raise /The query tried to access \["ci_builds", "projects"\]/5482 for query accessing main table from CI database5483 is expected to raise /The query tried to access \["projects"\]/5484 for query accessing CI database5485 is expected not to raise Exception5486 for query accessing CI table from main database5487 is expected to raise /The query tried to access \["ci_builds"\]/5488 for query accessing unknown gitlab_schema5489 is expected to raise /Could not find gitlab schema for table new_table/5490 when analyzer is enabled for tests5491 throws an error when trying to access a table that belongs to the gitlab_main schema from the ci database5492 throws an error when trying to access a table that belongs to the gitlab_ci schema from the main database5493Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification5494 context and suppress key names5495 .context_key5496 contains class name5497 .suppress_key5498 contains class name5499 when CI and other tables are read in a transaction5500 outside transaction5501 is expected not to raise Exception5502 within Project transaction5503 is expected not to raise Exception5504 within nested Project transaction5505 is expected not to raise Exception5506 outside transaction5507 is expected not to raise Exception5508 within Ci::Pipeline transaction5509 is expected not to raise Exception5510 within nested Ci::Pipeline transaction5511 is expected not to raise Exception5512 when only CI data is modified5513 outside transaction5514 is expected not to raise Exception5515 within Ci::Pipeline transaction5516 is expected not to raise Exception5517 within nested Ci::Pipeline transaction5518 is expected not to raise Exception5519 within Project transaction5520 raises error5521 when other data is modified5522 outside transaction5523 is expected not to raise Exception5524 within Project transaction5525 is expected not to raise Exception5526 within nested Project transaction5527 is expected not to raise Exception5528 within Ci::Pipeline transaction5529 raises error5530 when both CI and other data is modified5531 outside transaction5532 is expected not to raise Exception5533 when data modification happens in a transaction5534 within Project transaction5535 raises error5536 when ci_pipelines are ignored for cross modification5537 does not raise error5538 when data modification happens in nested transactions5539 raises error, with the generated sql queries included5540 when comments are added to the front of query strings5541 within Project transaction5542 raises error5543 when executing a SELECT FOR UPDATE query5544 outside transaction5545 is expected not to raise Exception5546 when data modification happens in a transaction5547 within Project transaction5548 raises error5549 when the modification is inside a factory save! call5550 does not raise an error5551 when CI association is modified through project5552 outside transaction5553 is expected not to raise Exception5554 within Ci::Pipeline transaction5555 is expected not to raise Exception5556 within nested Ci::Pipeline transaction5557 is expected not to raise Exception5558 within Project transaction5559 raises error5560 .allow_cross_database_modification_within_transaction5561 skips raising error5562 skips raising error on factory creation5563 when execution is rescued with StandardError5564 raises cross-database data modification exception5565 when uniquiness validation is tested5566 does not raise exceptions5567 when doing rollback in a suppressed block5568 does not raise misaligned transactions exception5569Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas5570 properly analyzes queries5571 for SELECT on projects for allowed_gitlab_schema=no_schema5572 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLNotAllowedError5573 for SELECT on projects for allowed_gitlab_schema=gitlab_main5574 is expected not to raise Exception5575 for SELECT on projects for allowed_gitlab_schema=gitlab_main_clusterwide5576 is expected not to raise Exception5577 for SELECT on projects for allowed_gitlab_schema=gitlab_main_cell5578 is expected not to raise Exception5579 for SELECT on projects for allowed_gitlab_schema=gitlab_ci5580 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError5581 for SELECT on namespaces for allowed_gitlab_schema=no_schema5582 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLNotAllowedError5583 for SELECT on namespaces for allowed_gitlab_schema=gitlab_main5584 is expected not to raise Exception5585 for SELECT on namespaces for allowed_gitlab_schema=gitlab_main_clusterwide5586 is expected not to raise Exception5587 for SELECT on namespaces for allowed_gitlab_schema=gitlab_main_cell5588 is expected not to raise Exception5589 for SELECT on namespaces for allowed_gitlab_schema=gitlab_ci5590 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError5591 for INSERT on projects for allowed_gitlab_schema=no_schema5592 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLNotAllowedError5593 for INSERT on projects for allowed_gitlab_schema=gitlab_main5594 is expected not to raise Exception5595 for INSERT on projects for allowed_gitlab_schema=gitlab_main_clusterwide5596 is expected not to raise Exception5597 for INSERT on projects for allowed_gitlab_schema=gitlab_main_cell5598 is expected not to raise Exception5599 for INSERT on projects for allowed_gitlab_schema=gitlab_ci5600 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError5601 for INSERT on namespaces for allowed_gitlab_schema=no_schema5602 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLNotAllowedError5603 for INSERT on namespaces for allowed_gitlab_schema=gitlab_main5604 is expected not to raise Exception5605 for INSERT on namespaces for allowed_gitlab_schema=gitlab_main_clusterwide5606 is expected not to raise Exception5607 for INSERT on namespaces for allowed_gitlab_schema=gitlab_main_cell5608 is expected not to raise Exception5609 for INSERT on namespaces for allowed_gitlab_schema=gitlab_ci5610 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError5611 for CREATE INDEX for allowed_gitlab_schema=no_schema5612 is expected not to raise Exception5613 for CREATE INDEX for allowed_gitlab_schema=gitlab_main5614 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DDLNotAllowedError5615 for CREATE INDEX for allowed_gitlab_schema=gitlab_ci5616 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DDLNotAllowedError5617 for CREATE SCHEMA for allowed_gitlab_schema=no_schema5618 is expected not to raise Exception5619 for CREATE SCHEMA for allowed_gitlab_schema=gitlab_main5620 is expected not to raise Exception5621 for CREATE SCHEMA for allowed_gitlab_schema=gitlab_ci5622 is expected not to raise Exception5623 for CREATE FUNCTION for allowed_gitlab_schema=no_schema5624 is expected not to raise Exception5625 for CREATE FUNCTION for allowed_gitlab_schema=gitlab_main5626 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DDLNotAllowedError5627 for CREATE FUNCTION for allowed_gitlab_schema=gitlab_ci5628 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DDLNotAllowedError5629 for CREATE TRIGGER for allowed_gitlab_schema=no_schema5630 is expected not to raise Exception5631 for CREATE TRIGGER for allowed_gitlab_schema=gitlab_main5632 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DDLNotAllowedError5633 for CREATE TRIGGER for allowed_gitlab_schema=gitlab_ci5634 is expected to raise Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DDLNotAllowedError5635 .require_ddl_mode!5636 when not configured does not raise exception5637 when no schemas are configured does not raise exception (DDL mode)5638 with schemas configured does raise exception (DML mode)5639 .require_dml_mode!5640 when not configured does not raise exception5641 when no schemas are configured does raise exception (DDL mode)5642 with schemas configured does raise exception (DML mode)5643Gitlab::Database::Reflection5644 #username5645 when a username is set5646 returns the username5647 when a username is not set5648 returns the value of the USER environment variable5649 #database_name5650 returns the name of the database5651 #adapter_name5652 returns the database adapter name5653 #human_adapter_name5654 when the adapter is PostgreSQL5655 returns PostgreSQL5656 when the adapter is not PostgreSQL5657 returns Unknown5658 #postgresql?5659 when using PostgreSQL5660 returns true5661 when not using PostgreSQL5662 returns false5663 #db_read_only?5664 detects a read-only database5665 detects a read-only database5666 detects a read-write database5667 detects a read-write database5668 #db_read_write?5669 detects a read-only database5670 detects a read-only database5671 detects a read-write database5672 detects a read-write database5673 #version5674 memoizes the result5675 on postgresql5676 extracts the version number5677 #postgresql_minimum_supported_version?5678 returns false when using PostgreSQL 105679 returns false when using PostgreSQL 115680 returns false when using PostgreSQL 125681 returns true when using PostgreSQL 135682 #cached_column_exists?5683 only retrieves the data from the schema cache5684 #cached_table_exists?5685 only retrieves the data from the schema cache5686 returns false when database does not exist5687 #exists?5688 returns true if the database exists5689 returns false if the database doesn't exist5690 #system_id5691 returns the PostgreSQL system identifier5692 #flavor5693 re-raises exceptions not matching expected messages5694 recognizes Amazon Aurora PostgreSQL5695 recognizes PostgreSQL on Amazon RDS5696 recognizes CloudSQL for PostgreSQL5697 recognizes Azure Database for PostgreSQL - Flexible Server5698 recognizes Azure Database for PostgreSQL - Single Server5699 recognizes AlloyDB for PostgreSQL5700 returns nil if can not recognize the flavor5701 #config5702 returns a HashWithIndifferentAccess5703 returns a default pool size5704 does not cache its results5705Gitlab::Database::Reindexing::Coordinator5706 #perform5707 when executed during the weekend5708 locking5709 acquires a lock while reindexing5710 does not perform reindexing actions if lease is not granted5711 notifications5712 sends #notify_start before reindexing5713 sends #notify_end after reindexing and updating the action is done5714 action tracking5715 calls #finish on the action5716 upon error, it still calls finish and raises the error5717 when executed during the week5718 does not start reindexing5719 #drop5720 when executed during the weekend5721 when exclusive lease is granted5722 drops the index with lock retries5723 when exclusive lease is not granted5724 does not drop the index5725 when executed during the week5726 does not start reindexing5727Gitlab::Database::Reindexing::GrafanaNotifier5728 #notify_start5729 when Grafana is configured using application settings5730 behaves like interacting with Grafana annotations API5731 POSTs a JSON payload5732 on error5733 does not raise the error and returns false5734 when request was not successful5735 returns false5736 without api_key5737 does not post anything5738 without api_url5739 does not post anything5740 when there is no additional tag5741 behaves like interacting with Grafana annotations API5742 POSTs a JSON payload5743 on error5744 does not raise the error and returns false5745 when request was not successful5746 returns false5747 without api_key5748 does not post anything5749 without api_url5750 does not post anything5751 additional tag is provided5752 behaves like interacting with Grafana annotations API5753 POSTs a JSON payload5754 on error5755 does not raise the error and returns false5756 when request was not successful5757 returns false5758 without api_key5759 does not post anything5760 without api_url5761 does not post anything5762 #notify_end5763 when Grafana is configured using application settings5764 behaves like interacting with Grafana annotations API5765 POSTs a JSON payload5766 on error5767 does not raise the error and returns false5768 when request was not successful5769 returns false5770 without api_key5771 does not post anything5772 without api_url5773 does not post anything5774 when there is no additional tag5775 behaves like interacting with Grafana annotations API5776 POSTs a JSON payload5777 on error5778 does not raise the error and returns false5779 when request was not successful5780 returns false5781 without api_key5782 does not post anything5783 without api_url5784 does not post anything5785 additional tag is provided5786 behaves like interacting with Grafana annotations API5787 POSTs a JSON payload5788 on error5789 does not raise the error and returns false5790 when request was not successful5791 returns false5792 without api_key5793 does not post anything5794 without api_url5795 does not post anything5796Gitlab::Database::Reindexing::IndexSelection5797 orders by highest relative bloat first5798 excludes indexes with a relative bloat level below 20%5799 excludes indexes smaller than 1 GiB ondisk size5800 includes indexes larger than 100 GiB ondisk size5801 with time frozen5802 does not return indexes with reindex action in the last 10 days5803 with restricted tables5804 when executed on Fridays5805 is expected not to include #<Gitlab::Database::PostgresIndex identifier: "public.some_index_119", indexrelid: 119, schema: "publ...efinition: "CREATE INDEX public.some_index_119 ON ci_builds (b...", ondisk_size_bytes: 107374182400>5806 when executed on Saturdays5807 is expected to include #<Gitlab::Database::PostgresIndex identifier: "public.some_index_130", indexrelid: 130, schema: "publ...efinition: "CREATE INDEX public.some_index_130 ON ci_builds (b...", ondisk_size_bytes: 107374182400>5808 when executed on Sundays5809 is expected not to include #<Gitlab::Database::PostgresIndex identifier: "public.some_index_141", indexrelid: 141, schema: "publ...efinition: "CREATE INDEX public.some_index_141 ON ci_builds (b...", ondisk_size_bytes: 107374182400>5810 when executed on Mondays5811 is expected not to include #<Gitlab::Database::PostgresIndex identifier: "public.some_index_152", indexrelid: 152, schema: "publ...efinition: "CREATE INDEX public.some_index_152 ON ci_builds (b...", ondisk_size_bytes: 107374182400>5812Gitlab::Database::Reindexing::ReindexAction5813 is expected to be a kind of Gitlab::Database::SharedModel(abstract)5814 .create_for5815 creates a new record for the given index5816 #finish5817 sets #action_end5818 sets #ondisk_size_bytes_end after reloading the index record5819 saves the record5820 setting #state5821 sets #state to finished if not given5822 sets #state to finished if not set to started5823 does not change state if set to failed5824Gitlab::Database::Reindexing::ReindexConcurrently#perform5825 recreates the index using REINDEX with a long statement timeout5826 when the index serves an exclusion constraint5827 raises an error5828 when attempting to reindex an expression index5829 raises an error5830 when the index is a dangling temporary index from a previous reindexing run5831 with the temporary index prefix5832 raises an error5833 with the temporary index prefix with a counter5834 raises an error5835 with dangling indexes matching TEMPORARY_INDEX_PATTERN, i.e. /some\_index\_ccnew(\d)*/5836 with normal index names5837 behaves like dropping the dangling index5838 drops the dangling indexes while controlling lock_timeout5839 with index name at 63 character limit5840 behaves like dropping the dangling index5841 drops the dangling indexes while controlling lock_timeout5842Gitlab::Database::Reindexing5843 .invoke5844 cleans up any leftover indexes5845 executes async index destruction prior to any reindexing actions5846 when there is an error raised5847 logs and re-raise5848 when async index creation is enabled5849 executes async index creation prior to any reindexing actions5850 when async index creation is disabled5851 does not execute async index creation5852 calls automatic reindexing5853 uses all candidate indexes5854 when explicit database is given5855 skips other databases5856 when async FK validation is enabled5857 executes FK validation for each database prior to any reindexing actions5858 when async FK validation is disabled5859 does not execute FK validation5860 .automatic_reindexing5861 cleans up leftovers, before consuming the queue5862 with records in the queue5863 with enough records in the queue to reach limit5864 does not perform reindexing with heuristic5865 without enough records in the queue to reach limit5866 continues if the queue did not have enough records5867 .perform_with_heuristic5868 delegates to Coordinator5869 .perform_from_queue5870 consumes the queue in order of created_at and applies the limit5871 updates queued action and sets state to done5872 updates queued action upon error and sets state to failed5873 .cleanup_leftovers!5874 drops both leftover indexes5875Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase5876 #remove_last_occurrence5877 removes only the last occurrence of a string5878 #remove_cached_html_for_projects5879 removes description_html from projects5880 removes issue descriptions5881 removes merge request descriptions5882 removes note html5883 removes milestone description5884 #rename_path_for_routable5885 for personal namespaces5886 renames namespaces called the-path5887 renames the route to the namespace5888 renames the route for projects of the namespace5889 returns the old & the new path5890 doesn't rename routes that start with a similar name5891 for groups5892 the-path group -> subgroup -> the-path0 project5893 updates the route of the project correctly5894 for projects5895 renames the project called `the-path`5896 renames the route for the project5897 returns the old & new path5898 #perform_rename5899 for personal namespaces5900 renames the path5901 for groups5902 renames all the routes for the group5903 #move_pages5904 moves the pages directory5905 #move_uploads5906 moves subdirectories in the uploads folder5907 doesn't move uploads when they are stored in object storage5908 #move_folders5909 moves a folder with files5910 #track_rename5911 tracks a rename in redis5912 #reverts_for_type5913 yields for each tracked rename5914 keeps the revert in redis if it failed5915Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces5916 #namespaces_for_paths5917 nested namespaces5918 includes the namespace5919 for child namespaces5920 only returns child namespaces with the correct path5921 has no namespaces that look the same5922 for top levelnamespaces5923 only returns child namespaces with the correct path5924 has no namespaces that just look the same5925 #move_repositories5926 moves a project for a namespace5927 moves a namespace in a subdirectory correctly5928 moves a parent namespace with subdirectories5929 #child_ids_for_parent5930 collects child ids for all levels5931 #rename_namespace5932 renames paths & routes for the namespace5933 tracks the rename5934 renames things related to the namespace5935 #rename_namespace_dependencies5936 moves the repository for a project in the namespace5937 moves the uploads for the namespace5938 moves the pages for the namespace5939 invalidates the markdown cache of related projects5940 doesn't rename users for other namespaces5941 renames the username of a namespace for a user5942 #rename_user5943 renames a username5944 #rename_namespaces5945 renames top level namespaces the namespace5946 renames child namespaces5947 #revert_renames5948 renames the routes back to the previous values5949 moves the repositories back to their original place5950 doesn't break when the namespace was renamed5951Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects5952 #projects_for_paths5953 searches using nested paths5954 includes the correct projects5955 #rename_projects5956 renames each project5957 invalidates the markdown cache of related projects5958 #rename_project5959 renames path & route for the project5960 tracks the rename5961 renames the folders for the project5962 #move_project_folders5963 moves the wiki & the repo5964 does not move the repositories when hashed storage is enabled5965 moves uploads5966 does not move uploads when hashed storage is enabled for attachments5967 moves pages5968 #move_repository5969 moves the repository for a project5970 #revert_renames5971 renames the routes back to the previous values5972 moves the repositories back to their original place5973 doesn't break when the project was renamed5974Gitlab::Database::RenameReservedPathsMigration::V15975 #rename_child_paths5976 behaves like renames child namespaces5977 renames namespaces5978 #rename_wildcard_paths5979 renames projects5980 behaves like renames child namespaces5981 renames namespaces5982 #rename_root_paths5983 renames namespaces5984 #revert_renames5985 renames namespaces5986 renames projects5987Gitlab::Database::SchemaCacheWithRenamedTable5988 when table is not renamed yet5989 uses the original table to look up metadata5990 when table is renamed5991 uses the renamed table to look up metadata5992 has primary key5993 has the same column definitions5994 has the same indexes5995 has the same column_hash5996 when the table behind a model is actually a view5997 can persist records5998 can find records5999Gitlab::Database::SchemaCleaner6000 removes comments on extensions6001 no assumption about public being the default schema6002 cleans up all the gitlab_schema_prevent_write table triggers6003 keeps the lock_writes trigger functions6004 cleans up the full schema as expected (blackbox test with example)6005Gitlab::Database::SchemaMigrations::Context6006 #schema_directory6007 returns db/schema_migrations6008 CI database6009 returns a directory path that is database specific6010 multiple databases6011 when `schema_migrations_path` is configured as string6012 returns a configured directory path that6013 when `schema_migrations_path` is configured as symbol6014 returns a configured directory path that6015 #versions_to_create6016 migrated versions is the same as migration file versions6017 returns migrated versions6018 migrated versions is subset of migration file versions6019 returns migrated versions6020 migrated versions is superset of migration file versions6021 returns file versions6022 migrated versions has slightly different versions to migration file versions6023 returns the common set6024Gitlab::Database::SchemaMigrations::Migrations6025 #touch_all6026 creates a file containing a checksum for each version with a matching migration6027 #load_all6028 when there are no version files6029 does nothing6030 when there are version files6031 inserts the missing versions into schema_migrations6032Gitlab::Database::SchemaValidation::SchemaInconsistency6033 # order random6034 is expected to be a kind of ApplicationRecord(abstract)6035 associations6036 is expected to belong to issue required: false6037 Validations6038 is expected to validate that :object_name cannot be empty/falsy6039 is expected to validate that :valitador_name cannot be empty/falsy6040 is expected to validate that :table_name cannot be empty/falsy6041 is expected to validate that :diff cannot be empty/falsy6042 scopes6043 .with_open_issues6044 returns only schema inconsistencies with GitLab issues open6045Gitlab::Database::ShaAttribute6046 #deserialize6047 converts the binary SHA to a String6048 #serialize6049 converts a SHA String to binary data6050Gitlab::Database::SharedModel6051 using an external connection6052 overrides the connection for the duration of the block6053 does not affect connections in other threads6054 raises an error if the connection does not include `:gitlab_shared` schema6055 when multiple connection overrides are nested6056 allows the nesting with the same connection object6057 raises an error if the connection is changed6058 when the block raises an error6059 re-raises the error, removing the overridden connection6060 #connection_db_config6061 returns the class connection_db_config6062 when switching the class connection6063 returns the db_config of the used connection when using load balancing6064Gitlab::Database::SimilarityScore6065 when passing empty values6066 when search is nil6067 orders by a constant 0 value6068 when rules are empty6069 orders by a constant 0 value6070 when similarity scoring based on the path6071 when searching for `git`6072 is expected to eq ["git", "gitlab", "gitaly"]6073 when searching for `gitlab`6074 is expected to eq ["gitlab", "gitlab-styles", "gitlab-danger"]6075 when searching for something unrelated6076 results have 0 similarity score6077 score multiplier6078 ranks `path` matches higher6079 annotation6080 annotates the generated SQL expression6081Gitlab::Database::TablesLocker6082 # order random6083 when geo database is configured6084 does not lock table in geo database (PENDING: Geo database is not configured)6085 when running on single database6086 #lock_writes6087 does not lock any table (PENDING: Skipping because database ci exists)6088 behaves like unlock tables6089 unlocks table in schema gitlab_main and database main (PENDING: Skipping because database ci exists)6090 returns list of actions (PENDING: Skipping because database ci exists)6091 behaves like unlock tables6092 unlocks table in schema gitlab_ci and database main (PENDING: Skipping because database ci exists)6093 returns list of actions (PENDING: Skipping because database ci exists)6094 behaves like unlock tables6095 unlocks table in schema gitlab_main_clusterwide and database main (PENDING: Skipping because database ci exists)6096 returns list of actions (PENDING: Skipping because database ci exists)6097 behaves like unlock tables6098 unlocks table in schema gitlab_shared and database main (PENDING: Skipping because database ci exists)6099 returns list of actions (PENDING: Skipping because database ci exists)6100 behaves like unlock tables6101 unlocks table in schema gitlab_internal and database main (PENDING: Skipping because database ci exists)6102 returns list of actions (PENDING: Skipping because database ci exists)6103 #unlock_writes6104 does call Gitlab::Database::LockWritesManager.unlock_writes (PENDING: Skipping because database ci exists)6105 when running on multiple databases6106 #lock_writes6107 behaves like lock tables6108 locks table in schema gitlab_ci and database main6109 returns list of actions6110 behaves like lock tables6111 locks table in schema gitlab_main and database ci6112 returns list of actions6113 behaves like lock tables6114 locks table in schema gitlab_main_clusterwide and database ci6115 returns list of actions6116 behaves like unlock tables6117 unlocks table in schema gitlab_main_clusterwide and database main6118 returns list of actions6119 behaves like unlock tables6120 unlocks table in schema gitlab_main and database main6121 returns list of actions6122 behaves like unlock tables6123 unlocks table in schema gitlab_ci and database ci6124 returns list of actions6125 behaves like unlock tables6126 unlocks table in schema gitlab_shared and database main6127 returns list of actions6128 behaves like unlock tables6129 unlocks table in schema gitlab_shared and database ci6130 returns list of actions6131 behaves like unlock tables6132 unlocks table in schema gitlab_internal and database main6133 returns list of actions6134 behaves like unlock tables6135 unlocks table in schema gitlab_internal and database ci6136 returns list of actions6137 behaves like unlock partitions6138 unlocks the partition6139 behaves like lock partitions6140 locks the partition6141 behaves like unlock partitions6142 unlocks the partition6143 behaves like lock partitions6144 locks the partition6145 #unlock_writes6146 behaves like unlock tables6147 unlocks table in schema gitlab_ci and database main6148 returns list of actions6149 behaves like unlock tables6150 unlocks table in schema gitlab_main and database ci6151 returns list of actions6152 behaves like unlock tables6153 unlocks table in schema gitlab_main and database main6154 returns list of actions6155 behaves like unlock tables6156 unlocks table in schema gitlab_ci and database ci6157 returns list of actions6158 behaves like unlock tables6159 unlocks table in schema gitlab_shared and database main6160 returns list of actions6161 behaves like unlock tables6162 unlocks table in schema gitlab_shared and database ci6163 returns list of actions6164 behaves like unlock tables6165 unlocks table in schema gitlab_internal and database main6166 returns list of actions6167 behaves like unlock tables6168 unlocks table in schema gitlab_internal and database ci6169 returns list of actions6170 behaves like unlock partitions6171 unlocks the partition6172 behaves like unlock partitions6173 unlocks the partition6174 behaves like unlock partitions6175 unlocks the partition6176 behaves like unlock partitions6177 unlocks the partition6178 when not including partitions6179 does not include any table partitions6180 does not include any detached partitions6181 when running in dry_run mode6182 passes dry_run flag to LockWritesManager6183 when running on multiple shared databases6184 does not lock any tables if the ci database is shared with main database6185Gitlab::Database::TablesSortedByForeignKeys6186 # order random6187 #execute6188 returns the tables sorted by the foreign keys dependency6189 returns both tables together if they are strongly connected6190Gitlab::Database::TablesTruncate6191 # order random6192 when truncating gitlab_ci tables on the main database6193 behaves like truncating legacy tables on a database6194 when the truncated tables are not locked for writes6195WARNING: Active Record does not support composite primary key.6196_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6197WARNING: Active Record does not support composite primary key.6198gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6199WARNING: Active Record does not support composite primary key.6200_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6201WARNING: Active Record does not support composite primary key.6202gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6203 raises an error that the tables are not locked for writes6204 when the truncated tables are locked for writes6205WARNING: Active Record does not support composite primary key.6206_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6207WARNING: Active Record does not support composite primary key.6208gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6209WARNING: Active Record does not support composite primary key.6210_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6211WARNING: Active Record does not support composite primary key.6212gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6213 truncates the legacy tables6214WARNING: Active Record does not support composite primary key.6215_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6216WARNING: Active Record does not support composite primary key.6217gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6218WARNING: Active Record does not support composite primary key.6219_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6220WARNING: Active Record does not support composite primary key.6221gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6222 does not affect the other tables6223WARNING: Active Record does not support composite primary key.6224_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6225WARNING: Active Record does not support composite primary key.6226gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6227WARNING: Active Record does not support composite primary key.6228_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6229WARNING: Active Record does not support composite primary key.6230gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6231 logs the sql statements to the logger6232 when running in dry_run mode6233WARNING: Active Record does not support composite primary key.6234_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6235WARNING: Active Record does not support composite primary key.6236gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6237WARNING: Active Record does not support composite primary key.6238_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6239WARNING: Active Record does not support composite primary key.6240gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6241 does not truncate the legacy tables if running in dry run mode6242 when passing until_table parameter6243 with a table that exists6244WARNING: Active Record does not support composite primary key.6245_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6246WARNING: Active Record does not support composite primary key.6247gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6248WARNING: Active Record does not support composite primary key.6249_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6250WARNING: Active Record does not support composite primary key.6251gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6252 only truncates until the table specified6253 with a table that does not exist6254WARNING: Active Record does not support composite primary key.6255_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6256WARNING: Active Record does not support composite primary key.6257gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6258WARNING: Active Record does not support composite primary key.6259_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6260WARNING: Active Record does not support composite primary key.6261gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6262 raises an error if the specified table does not exist6263 when one of the attached partitions happened to be locked for writes6264WARNING: Active Record does not support composite primary key.6265_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6266WARNING: Active Record does not support composite primary key.6267gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6268WARNING: Active Record does not support composite primary key.6269_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6270WARNING: Active Record does not support composite primary key.6271gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6272 truncates the locked partition successfully (PENDING: No reason given)6273 with geo configured6274WARNING: Active Record does not support composite primary key.6275_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6276WARNING: Active Record does not support composite primary key.6277gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6278WARNING: Active Record does not support composite primary key.6279_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6280WARNING: Active Record does not support composite primary key.6281gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6282 does not truncate gitlab_geo tables (PENDING: No reason given)6283 when running with multiple shared databases6284 raises an error when truncating the main database that it is a single database setup (PENDING: Skipping because database ci exists)6285 raises an error when truncating the ci database that it is a single database setup (PENDING: Skipping because database ci exists)6286 when truncating gitlab_main tables on the ci database6287 behaves like truncating legacy tables on a database6288 when the truncated tables are not locked for writes6289WARNING: Active Record does not support composite primary key.6290_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6291WARNING: Active Record does not support composite primary key.6292gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6293WARNING: Active Record does not support composite primary key.6294_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6295WARNING: Active Record does not support composite primary key.6296gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6297 raises an error that the tables are not locked for writes6298 when the truncated tables are locked for writes6299WARNING: Active Record does not support composite primary key.6300_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6301WARNING: Active Record does not support composite primary key.6302gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6303WARNING: Active Record does not support composite primary key.6304_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6305WARNING: Active Record does not support composite primary key.6306gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6307WARNING: Active Record does not support composite primary key.6308_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6309WARNING: Active Record does not support composite primary key.6310gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6311WARNING: Active Record does not support composite primary key.6312_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6313WARNING: Active Record does not support composite primary key.6314gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6315 truncates the legacy tables (FAILED - 4)63171st Try error in ./spec/lib/gitlab/database/tables_truncate_spec.rb:184:6318Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first6320RSpec::Retry: 2nd try ./spec/lib/gitlab/database/tables_truncate_spec.rb:1846321WARNING: Active Record does not support composite primary key.6322_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6323WARNING: Active Record does not support composite primary key.6324gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6325WARNING: Active Record does not support composite primary key.6326_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6327WARNING: Active Record does not support composite primary key.6328gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6329WARNING: Active Record does not support composite primary key.6330_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6331WARNING: Active Record does not support composite primary key.6332gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6333WARNING: Active Record does not support composite primary key.6334_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6335WARNING: Active Record does not support composite primary key.6336gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6337 does not affect the other tables (FAILED - 5)63391st Try error in ./spec/lib/gitlab/database/tables_truncate_spec.rb:191:6340Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first6342RSpec::Retry: 2nd try ./spec/lib/gitlab/database/tables_truncate_spec.rb:1916343WARNING: Active Record does not support composite primary key.6344_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6345WARNING: Active Record does not support composite primary key.6346gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6347WARNING: Active Record does not support composite primary key.6348_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6349WARNING: Active Record does not support composite primary key.6350gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6351WARNING: Active Record does not support composite primary key.6352_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6353WARNING: Active Record does not support composite primary key.6354gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6355WARNING: Active Record does not support composite primary key.6356_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6357WARNING: Active Record does not support composite primary key.6358gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6359 logs the sql statements to the logger (FAILED - 6)63611st Try error in ./spec/lib/gitlab/database/tables_truncate_spec.rb:197:6362Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first6364RSpec::Retry: 2nd try ./spec/lib/gitlab/database/tables_truncate_spec.rb:1976365 when running in dry_run mode6366WARNING: Active Record does not support composite primary key.6367_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6368WARNING: Active Record does not support composite primary key.6369gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6370WARNING: Active Record does not support composite primary key.6371_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6372WARNING: Active Record does not support composite primary key.6373gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6374WARNING: Active Record does not support composite primary key.6375_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6376WARNING: Active Record does not support composite primary key.6377gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6378WARNING: Active Record does not support composite primary key.6379_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6380WARNING: Active Record does not support composite primary key.6381gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6382 does not truncate the legacy tables if running in dry run mode (FAILED - 7)63841st Try error in ./spec/lib/gitlab/database/tables_truncate_spec.rb:208:6385Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first6387RSpec::Retry: 2nd try ./spec/lib/gitlab/database/tables_truncate_spec.rb:2086388 when passing until_table parameter6389 with a table that exists6390WARNING: Active Record does not support composite primary key.6391_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6392WARNING: Active Record does not support composite primary key.6393gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6394WARNING: Active Record does not support composite primary key.6395_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6396WARNING: Active Record does not support composite primary key.6397gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6398WARNING: Active Record does not support composite primary key.6399_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6400WARNING: Active Record does not support composite primary key.6401gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6402WARNING: Active Record does not support composite primary key.6403_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6404WARNING: Active Record does not support composite primary key.6405gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6406 only truncates until the table specified (FAILED - 8)64081st Try error in ./spec/lib/gitlab/database/tables_truncate_spec.rb:220:6409Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first6411RSpec::Retry: 2nd try ./spec/lib/gitlab/database/tables_truncate_spec.rb:2206412 with a table that does not exist6413WARNING: Active Record does not support composite primary key.6414_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6415WARNING: Active Record does not support composite primary key.6416gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6417WARNING: Active Record does not support composite primary key.6418_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6419WARNING: Active Record does not support composite primary key.6420gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6421WARNING: Active Record does not support composite primary key.6422_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6423WARNING: Active Record does not support composite primary key.6424gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6425WARNING: Active Record does not support composite primary key.6426_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6427WARNING: Active Record does not support composite primary key.6428gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6429 raises an error if the specified table does not exist (FAILED - 9)64311st Try error in ./spec/lib/gitlab/database/tables_truncate_spec.rb:231:6432expected /The table 'foobar' is not within the truncated tables/, got #<RuntimeError: Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first> with backtrace:6433 # ./lib/gitlab/database/tables_truncate.rb:49:in `block in execute'6434 # ./lib/gitlab/database/tables_truncate.rb:38:in `each'6435 # ./lib/gitlab/database/tables_truncate.rb:38:in `execute'6436 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:47:in `block (3 levels) in <top (required)>'6437 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:233:in `block (7 levels) in <top (required)>'6438 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:232:in `block (6 levels) in <top (required)>'6439 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'6440 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'6441 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'6442 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'6443 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'6444 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'6445 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'6446 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'6447 # ./spec/support/multiple_databases.rb:16:in `block (3 levels) in <top (required)>'6448 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'6449 # ./spec/support/multiple_databases.rb:15:in `block (2 levels) in <top (required)>'6450 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'6451 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'6452 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'6453 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'6454 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'6455 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'6456 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'6457 # ./spec/support/database/gitlab_schemas_validate_connection.rb:11:in `block (2 levels) in <top (required)>'6459RSpec::Retry: 2nd try ./spec/lib/gitlab/database/tables_truncate_spec.rb:2316460 when one of the attached partitions happened to be locked for writes6461WARNING: Active Record does not support composite primary key.6462_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6463WARNING: Active Record does not support composite primary key.6464gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6465WARNING: Active Record does not support composite primary key.6466_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6467WARNING: Active Record does not support composite primary key.6468gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6469WARNING: Active Record does not support composite primary key.6470_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6471WARNING: Active Record does not support composite primary key.6472gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6473WARNING: Active Record does not support composite primary key.6474_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6475WARNING: Active Record does not support composite primary key.6476gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6477 truncates the locked partition successfully (FAILED - 10)64791st Try error in ./spec/lib/gitlab/database/tables_truncate_spec.rb:251:6480Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first6482RSpec::Retry: 2nd try ./spec/lib/gitlab/database/tables_truncate_spec.rb:2516483 with geo configured6484WARNING: Active Record does not support composite primary key.6485_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6486WARNING: Active Record does not support composite primary key.6487gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6488WARNING: Active Record does not support composite primary key.6489_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.6490WARNING: Active Record does not support composite primary key.6491gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.6492 does not truncate gitlab_geo tables (PENDING: No reason given)6493 when running in a single database mode6494 raises an error when truncating the main database that it is a single database setup (PENDING: Skipping because some of the extra databases [:ci] are setup)6495 raises an error when truncating the ci database that it is a single database setup (PENDING: Skipping because some of the extra databases [:ci] are setup)6496Gitlab::Database::Transaction::Context6497 #set_start_time6498 sets start_time6499 #increment_savepoints6500 is expected to eq 26501 #increment_rollbacks6502 is expected to eq 36503 #increment_releases6504 is expected to eq 46505 #set_depth6506 is expected to eq 26507 #track_sql6508 is expected to eq ["SELECT 1", "SELECT * FROM users"]6509 #track_backtrace6510 is expected to be a kind of Array6511 is expected to all be a kind of Array6512 is expected to eq 16513 is expected to be a kind of String6514 appends the backtrace6515 #duration6516 is expected to be >= 06517 when savepoints count exceeds threshold6518 behaves like logs transaction data6519 logs once upon COMMIT6520 logs once upon ROLLBACK6521 logs again when log throttle duration passes6522 #should_log? returns true6523 when duration exceeds threshold6524 behaves like logs transaction data6525 logs once upon COMMIT6526 logs once upon ROLLBACK6527 logs again when log throttle duration passes6528 #should_log? returns true6529 when there are too many external HTTP requests6530 behaves like logs transaction data6531 logs once upon COMMIT6532 logs once upon ROLLBACK6533 logs again when log throttle duration passes6534 #should_log? returns true6535 when there are too many too long external HTTP requests6536 behaves like logs transaction data6537 logs once upon COMMIT6538 logs once upon ROLLBACK6539 logs again when log throttle duration passes6540 #should_log? returns true6541Gitlab::Database::Transaction::Observer6542 .instrument_transactions6543 tracks transaction data6544 tracking external network requests6545 tracks external requests6546 when external HTTP requests duration has been exceeded6547 logs transaction details including exceeding thresholds6548 when external HTTP requests count has been exceeded6549 logs transaction details including exceeding thresholds6550 .extract_sql_command6551 sql: "SELECT 1", expected: "SELECT 1"6552 is expected to eq "SELECT 1"6553 sql: "/* test comment */ SELECT 1", expected: "SELECT 1"6554 is expected to eq "SELECT 1"6555 sql: "/* test comment */ ROLLBACK TO SAVEPOINT point1", expected: "ROLLBACK TO SAVEPOINT "6556 is expected to eq "ROLLBACK TO SAVEPOINT "6557 sql: "SELECT 1 /* trailing comment */", expected: "SELECT 1 /* trailing comment */"6558 is expected to eq "SELECT 1 /* trailing comment */"6559Gitlab::Database::TransactionTimeoutSettings6560 # order random6561 #disable_timeouts6562 sets timeouts to 06563 #restore_timeouts6564 resets value6565Gitlab::Database::Type::Color6566 serializes by calling #to_s6567 serializes nil to nil6568 casts by calling Color::new6569 accepts colors as arguments to cast6570 allows nil database values6571 tells us what is serializable6572 tells us what is not serializable6573Gitlab::Database::Type::IndifferentJsonb6574 # order random6575 #deserialize6576 json: nil, value: nil6577 is expected to match nil6578 is expected to match nil6579 json: "{\"key\":\"value\"}", value: {:key=>"value"}6580 is expected to match {:key=>"value"}6581 is expected to match {"key"=>"value"}6582 json: "{\"key\":[1,2,3]}", value: {:key=>[1, 2, 3]}6583 is expected to match {:key=>[1, 2, 3]}6584 is expected to match {"key"=>[1, 2, 3]}6585 json: "{\"key\":{\"subkey\":\"value\"}}", value: {:key=>{:subkey=>"value"}}6586 is expected to match {:key=>{:subkey=>"value"}}6587 is expected to match {"key"=>{"subkey"=>"value"}}6588 json: "{\"key\":{\"a\":[{\"b\":\"c\"},{\"d\":\"e\"}]}}", value: {:key=>{:a=>[{:b=>"c"}, {:d=>"e"}]}}6589 is expected to match {:key=>{:a=>[{:b=>"c"}, {:d=>"e"}]}}6590 is expected to match {"key"=>{"a"=>[{"b"=>"c"}, {"d"=>"e"}]}}6591 when used by a model6592 is expected to match {:key=>"value"}6593 is expected to match {"key"=>"value"}6594 ignores changes to other attributes6595 tracks changes to options6596Gitlab::Database::Type::JsonPgSafe6597 #serialize6598 value: nil, json: nil6599 is expected to eq nil6600 value: 1, json: "1"6601 is expected to eq "1"6602 value: 1.0, json: "1.0"6603 is expected to eq "1.0"6604 value: "str\u0000ing\u0000", json: "\"string\""6605 is expected to eq "\"string\""6606 value: ["\u0000arr", "a\u0000y"], json: "[\"arr\",\"ay\"]"6607 is expected to eq "[\"arr\",\"ay\"]"6608 value: {"key\u0000"=>"value\u0000\u0000"}, json: "{\"key\":\"value\"}"6609 is expected to eq "{\"key\":\"value\"}"6610Gitlab::Database::Type::SymbolizedJsonb6611 # order random6612 #deserialize6613 json: nil, value: nil6614 is expected to match nil6615 json: "{\"key\":\"value\"}", value: {:key=>"value"}6616 is expected to match {:key=>"value"}6617 json: "{\"key\":[1,2,3]}", value: {:key=>[1, 2, 3]}6618 is expected to match {:key=>[1, 2, 3]}6619 json: "{\"key\":{\"subkey\":\"value\"}}", value: {:key=>{:subkey=>"value"}}6620 is expected to match {:key=>{:subkey=>"value"}}6621 json: "{\"key\":{\"a\":[{\"b\":\"c\"},{\"d\":\"e\"}]}}", value: {:key=>{:a=>[{:b=>"c"}, {:d=>"e"}]}}6622 is expected to match {:key=>{:a=>[{:b=>"c"}, {:d=>"e"}]}}6623 when used by a model6624 is expected to match {:key=>"value"}6625 ignores changes to other attributes6626 tracks changes to options6627Gitlab::Database::UnidirectionalCopyTrigger6628 #name6629 when a single column name is given6630 returns the trigger name6631 when multiple column names are given6632 returns the trigger name6633 when a different number of new and old column names are given6634 raises an error6635 #create6636 when a single column name is given6637 creates the trigger and function6638 properly copies the column data using the trigger function6639 when multiple column names are given6640 creates the trigger and function to set all the columns6641 properly copies the columns using the trigger function6642 when a custom trigger name is given6643 creates the trigger and function with the custom name6644 when the trigger function already exists6645 does not raise an error6646 when a different number of new and old column names are given6647 raises an error6648 #drop6649 drops the trigger and function for the given arguments6650 when the trigger does not exist6651 does not raise an error6652Gitlab::Database::WithLockRetriesOutsideTransaction6653 #run6654 requires block6655 when DISABLE_LOCK_RETRIES is set6656 executes the passed block without retrying6657 when lock retry is enabled6658 lock_fiber6659 acquires lock successfully6660 after 3 iterations6661 behaves like retriable exclusive lock on `projects`6662 succeeds executing the given block6663 setting the idle transaction timeout6664 when there is no outer transaction: disable_ddl_transaction! is set in the migration6665 does not disable the idle transaction timeout6666 when there is outer transaction: disable_ddl_transaction! is not set in the migration6667 disables the idle transaction timeout so the code can sleep and retry6668 after the retries are exhausted6669 disables the lock_timeout6670 after the retries, without setting lock_timeout6671 behaves like retriable exclusive lock on `projects`6672 succeeds executing the given block6673 after the retries, when requested to raise an error6674 raises an error instead of waiting indefinitely for the lock6675 when statement timeout is reached6676 raises StatementInvalid error6677 restore local database variables6678 is expected not to change `connection.execute("SHOW lock_timeout").to_a`6679 is expected not to change `connection.execute("SHOW idle_in_transaction_session_timeout").to_a`6680 casting durations correctly6681 executes `SET lock_timeout` using the configured timeout value in milliseconds6682 calls `sleep` after the first iteration fails, using the configured sleep time6683Gitlab::Database::WithLockRetries6684 #run6685 requires block6686 when DISABLE_LOCK_RETRIES is set6687 executes the passed block without retrying6688 when lock retry is enabled6689 lock_fiber6690 acquires lock successfully6691 after 3 iterations6692 behaves like retriable exclusive lock on `projects`6693 succeeds executing the given block6694 setting the idle transaction timeout6695 when there is no outer transaction: disable_ddl_transaction! is set in the migration6696 does not disable the idle transaction timeout6697 when there is outer transaction: disable_ddl_transaction! is not set in the migration6698 disables the idle transaction timeout so the code can sleep and retry6699 after the retries are exhausted6700 when there is no outer transaction: disable_ddl_transaction! is set in the migration6701 does not disable the lock_timeout6702 when there is outer transaction: disable_ddl_transaction! is not set in the migration6703 disables the lock_timeout6704 after the retries, without setting lock_timeout6705 behaves like retriable exclusive lock on `projects`6706 succeeds executing the given block6707 after the retries, when requested to raise an error6708 raises an error instead of waiting indefinitely for the lock6709 when statement timeout is reached6710 raises QueryCanceled error6711 restore local database variables6712 is expected not to change `connection.execute("SHOW lock_timeout").to_a`6713 is expected not to change `connection.execute("SHOW idle_in_transaction_session_timeout").to_a`6714 casting durations correctly6715 executes `SET LOCAL lock_timeout` using the configured timeout value in milliseconds6716 calls `sleep` after the first iteration fails, using the configured sleep time6717 Stop using subtransactions - allow_savepoints: false6718 prevents running inside already open transaction6719 does not raise the error if not inside open transaction6720Pending: (Failures listed here are expected and do not affect your suite's status)6721 1) Gitlab::Database::MigrationHelpers::AutomaticLockWritesOnTables when reversing drop_table migrations when single database does not lock any newly created tables6722 # Skipping because database ci exists6723 # ./spec/lib/gitlab/database/migration_helpers/automatic_lock_writes_on_tables_spec.rb:3196724 2) Gitlab::Database::MigrationHelpers::AutomaticLockWritesOnTables when executing create_table migrations when single database does not lock any newly created tables6725 # Skipping because database ci exists6726 # ./spec/lib/gitlab/database/migration_helpers/automatic_lock_writes_on_tables_spec.rb:1026727 3) Gitlab::Database::MigrationHelpers::AutomaticLockWritesOnTables when executing create_table migrations when multiple databases for creating a gitlab_geo table behaves like does not lock writes on table allows deleting records from the table6728 # No reason given6729 # ./spec/lib/gitlab/database/migration_helpers/automatic_lock_writes_on_tables_spec.rb:436730 4) Gitlab::Database::MigrationHelpers::V2#truncate_tables! with single database executes a TRUNCATE statement6731 # Skipping because database ci exists6732 # ./spec/lib/gitlab/database/migration_helpers/v2_spec.rb:4916733 5) Gitlab::Database::Partitioning.sync_partitions without ci database only creates partitions for main database6734 # Skipping because database ci exists6735 # ./spec/lib/gitlab/database/partitioning_spec.rb:1166736 6) Gitlab::Database::PgDepend.from_pg_extension when having views as dependency returns pg_stat_statements6737 # Skipping ./spec/lib/gitlab/database/pg_depend_spec.rb[1:1:1:1] because it's been fast-quarantined.6738 Failure/Error: skip "Skipping #{example.id} because it's been fast-quarantined."6739 RSpec::Core::Pending::SkipDeclaredInExample6740 # ./spec/support/fast_quarantine.rb:21:in `block (2 levels) in <top (required)>'6741 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'6742 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'6743 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'6744 7) Gitlab::Database::TablesLocker when geo database is configured does not lock table in geo database6745 # Geo database is not configured6746 # ./spec/lib/gitlab/database/tables_locker_spec.rb:3296747 8) Gitlab::Database::TablesLocker when running on single database #lock_writes does not lock any table6748 # Skipping because database ci exists6749 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1756750 9) Gitlab::Database::TablesLocker when running on single database #lock_writes behaves like unlock tables unlocks table in schema gitlab_main and database main6751 # Skipping because database ci exists6752 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1026753 10) Gitlab::Database::TablesLocker when running on single database #lock_writes behaves like unlock tables returns list of actions6754 # Skipping because database ci exists6755 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1226756 11) Gitlab::Database::TablesLocker when running on single database #lock_writes behaves like unlock tables unlocks table in schema gitlab_ci and database main6757 # Skipping because database ci exists6758 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1026759 12) Gitlab::Database::TablesLocker when running on single database #lock_writes behaves like unlock tables returns list of actions6760 # Skipping because database ci exists6761 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1226762 13) Gitlab::Database::TablesLocker when running on single database #lock_writes behaves like unlock tables unlocks table in schema gitlab_main_clusterwide and database main6763 # Skipping because database ci exists6764 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1026765 14) Gitlab::Database::TablesLocker when running on single database #lock_writes behaves like unlock tables returns list of actions6766 # Skipping because database ci exists6767 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1226768 15) Gitlab::Database::TablesLocker when running on single database #lock_writes behaves like unlock tables unlocks table in schema gitlab_shared and database main6769 # Skipping because database ci exists6770 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1026771 16) Gitlab::Database::TablesLocker when running on single database #lock_writes behaves like unlock tables returns list of actions6772 # Skipping because database ci exists6773 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1226774 17) Gitlab::Database::TablesLocker when running on single database #lock_writes behaves like unlock tables unlocks table in schema gitlab_internal and database main6775 # Skipping because database ci exists6776 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1026777 18) Gitlab::Database::TablesLocker when running on single database #lock_writes behaves like unlock tables returns list of actions6778 # Skipping because database ci exists6779 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1226780 19) Gitlab::Database::TablesLocker when running on single database #unlock_writes does call Gitlab::Database::LockWritesManager.unlock_writes6781 # Skipping because database ci exists6782 # ./spec/lib/gitlab/database/tables_locker_spec.rb:1936783 20) Gitlab::Database::TablesTruncate when truncating gitlab_ci tables on the main database behaves like truncating legacy tables on a database when the truncated tables are locked for writes when one of the attached partitions happened to be locked for writes truncates the locked partition successfully6784 # No reason given6785 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:2516786 21) Gitlab::Database::TablesTruncate when truncating gitlab_ci tables on the main database behaves like truncating legacy tables on a database when the truncated tables are locked for writes with geo configured does not truncate gitlab_geo tables6787 # No reason given6788 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:2676789 22) Gitlab::Database::TablesTruncate when running with multiple shared databases raises an error when truncating the main database that it is a single database setup6790 # Skipping because database ci exists6791 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:3196792 23) Gitlab::Database::TablesTruncate when running with multiple shared databases raises an error when truncating the ci database that it is a single database setup6793 # Skipping because database ci exists6794 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:3256795 24) Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes with geo configured does not truncate gitlab_geo tables6796 # No reason given6797 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:2676798 25) Gitlab::Database::TablesTruncate when running in a single database mode raises an error when truncating the main database that it is a single database setup6799 # Skipping because some of the extra databases [:ci] are setup6800 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:3376801 26) Gitlab::Database::TablesTruncate when running in a single database mode raises an error when truncating the ci database that it is a single database setup6802 # Skipping because some of the extra databases [:ci] are setup6803 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:3436804Failures:6805 1) Gitlab::Database::MigrationHelpers::RestrictGitlabSchema when executing migrations does raise exception when accessing feature flags for db_config_name=main while restrict_gitlab_migration=gitlab_schema_gitlab_shared does run migrate :up and :down6806 Failure/Error: expect { migration_class.migrate(:up) }.to raise_error(Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError)6807 expected Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError but nothing was raised6808 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:580:in `block (8 levels) in <top (required)>'6809 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:540:in `block (7 levels) in <top (required)>'6810 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'6811 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:537:in `block (6 levels) in <top (required)>'6812 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:12:in `block (3 levels) in <top (required)>'6813 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'6814 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:11:in `block (2 levels) in <top (required)>'6815 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'6816 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'6817 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'6818 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'6819 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'6820 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'6821 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'6822 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'6823 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'6824 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'6825 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'6826 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'6827 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'6828 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'6829 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'6830 # ./spec/support/database/gitlab_schemas_validate_connection.rb:15:in `block (2 levels) in <top (required)>'6831 2) Gitlab::Database::MigrationHelpers::RestrictGitlabSchema when executing migrations does raise exception when accessing feature flags for db_config_name=ci while restrict_gitlab_migration=no_gitlab_schema does run migrate :up and :down6832 Failure/Error: expect { migration_class.migrate(:up) }.to raise_error(Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLNotAllowedError)6833 expected Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLNotAllowedError but nothing was raised6834 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:576:in `block (8 levels) in <top (required)>'6835 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:540:in `block (7 levels) in <top (required)>'6836 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'6837 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:537:in `block (6 levels) in <top (required)>'6838 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:12:in `block (3 levels) in <top (required)>'6839 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'6840 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:11:in `block (2 levels) in <top (required)>'6841 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'6842 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'6843 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'6844 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'6845 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'6846 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'6847 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'6848 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'6849 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'6850 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'6851 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'6852 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'6853 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'6854 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'6855 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'6856 # ./spec/support/database/gitlab_schemas_validate_connection.rb:15:in `block (2 levels) in <top (required)>'6857 3) Gitlab::Database::MigrationHelpers::RestrictGitlabSchema when executing migrations does raise exception when accessing feature flags for db_config_name=ci while restrict_gitlab_migration=gitlab_schema_gitlab_shared does run migrate :up and :down6858 Failure/Error: expect { migration_class.migrate(:up) }.to raise_error(Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError)6859 expected Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError but nothing was raised6860 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:580:in `block (8 levels) in <top (required)>'6861 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:540:in `block (7 levels) in <top (required)>'6862 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'6863 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:537:in `block (6 levels) in <top (required)>'6864 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:12:in `block (3 levels) in <top (required)>'6865 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'6866 # ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:11:in `block (2 levels) in <top (required)>'6867 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'6868 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'6869 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'6870 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'6871 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'6872 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'6873 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'6874 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'6875 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'6876 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'6877 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'6878 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'6879 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'6880 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'6881 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'6882 # ./spec/support/database/gitlab_schemas_validate_connection.rb:15:in `block (2 levels) in <top (required)>'6883 4) Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes truncates the legacy tables6884 Failure/Error: raise "Table '#{table_name}' is not locked for writes. Run the rake task gitlab:db:lock_writes first"6885 RuntimeError:6886 Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first6887 Shared Example Group: "truncating legacy tables on a database" called from ./spec/lib/gitlab/database/tables_truncate_spec.rb:3106888 # ./lib/gitlab/database/tables_truncate.rb:49:in `block in execute'6889 # ./lib/gitlab/database/tables_truncate.rb:38:in `each'6890 # ./lib/gitlab/database/tables_truncate.rb:38:in `execute'6891 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:47:in `block (3 levels) in <top (required)>'6892 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:187:in `block (5 levels) in <top (required)>'6893 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:186:in `block (4 levels) in <top (required)>'6894 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'6895 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'6896 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'6897 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'6898 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'6899 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'6900 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'6901 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'6902 # ./spec/support/multiple_databases.rb:16:in `block (3 levels) in <top (required)>'6903 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'6904 # ./spec/support/multiple_databases.rb:15:in `block (2 levels) in <top (required)>'6905 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'6906 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'6907 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'6908 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'6909 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'6910 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'6911 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'6912 # ./spec/support/database/gitlab_schemas_validate_connection.rb:11:in `block (2 levels) in <top (required)>'6913 5) Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes does not affect the other tables6914 Failure/Error: raise "Table '#{table_name}' is not locked for writes. Run the rake task gitlab:db:lock_writes first"6915 RuntimeError:6916 Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first6917 Shared Example Group: "truncating legacy tables on a database" called from ./spec/lib/gitlab/database/tables_truncate_spec.rb:3106918 # ./lib/gitlab/database/tables_truncate.rb:49:in `block in execute'6919 # ./lib/gitlab/database/tables_truncate.rb:38:in `each'6920 # ./lib/gitlab/database/tables_truncate.rb:38:in `execute'6921 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:47:in `block (3 levels) in <top (required)>'6922 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:193:in `block (5 levels) in <top (required)>'6923 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:192:in `block (4 levels) in <top (required)>'6924 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'6925 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'6926 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'6927 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'6928 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'6929 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'6930 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'6931 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'6932 # ./spec/support/multiple_databases.rb:16:in `block (3 levels) in <top (required)>'6933 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'6934 # ./spec/support/multiple_databases.rb:15:in `block (2 levels) in <top (required)>'6935 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'6936 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'6937 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'6938 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'6939 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'6940 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'6941 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'6942 # ./spec/support/database/gitlab_schemas_validate_connection.rb:11:in `block (2 levels) in <top (required)>'6943 6) Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes logs the sql statements to the logger6944 Failure/Error: raise "Table '#{table_name}' is not locked for writes. Run the rake task gitlab:db:lock_writes first"6945 RuntimeError:6946 Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first6947 Shared Example Group: "truncating legacy tables on a database" called from ./spec/lib/gitlab/database/tables_truncate_spec.rb:3106948 # ./lib/gitlab/database/tables_truncate.rb:49:in `block in execute'6949 # ./lib/gitlab/database/tables_truncate.rb:38:in `each'6950 # ./lib/gitlab/database/tables_truncate.rb:38:in `execute'6951 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:47:in `block (3 levels) in <top (required)>'6952 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:202:in `block (4 levels) in <top (required)>'6953 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'6954 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'6955 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'6956 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'6957 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'6958 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'6959 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'6960 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'6961 # ./spec/support/multiple_databases.rb:16:in `block (3 levels) in <top (required)>'6962 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'6963 # ./spec/support/multiple_databases.rb:15:in `block (2 levels) in <top (required)>'6964 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'6965 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'6966 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'6967 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'6968 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'6969 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'6970 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'6971 # ./spec/support/database/gitlab_schemas_validate_connection.rb:11:in `block (2 levels) in <top (required)>'6972 7) Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes when running in dry_run mode does not truncate the legacy tables if running in dry run mode6973 Failure/Error: raise "Table '#{table_name}' is not locked for writes. Run the rake task gitlab:db:lock_writes first"6974 RuntimeError:6975 Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first6976 Shared Example Group: "truncating legacy tables on a database" called from ./spec/lib/gitlab/database/tables_truncate_spec.rb:3106977 # ./lib/gitlab/database/tables_truncate.rb:49:in `block in execute'6978 # ./lib/gitlab/database/tables_truncate.rb:38:in `each'6979 # ./lib/gitlab/database/tables_truncate.rb:38:in `execute'6980 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:47:in `block (3 levels) in <top (required)>'6981 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:211:in `block (6 levels) in <top (required)>'6982 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:210:in `block (5 levels) in <top (required)>'6983 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'6984 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'6985 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'6986 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'6987 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'6988 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'6989 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'6990 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'6991 # ./spec/support/multiple_databases.rb:16:in `block (3 levels) in <top (required)>'6992 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'6993 # ./spec/support/multiple_databases.rb:15:in `block (2 levels) in <top (required)>'6994 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'6995 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'6996 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'6997 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'6998 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'6999 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'7000 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'7001 # ./spec/support/database/gitlab_schemas_validate_connection.rb:11:in `block (2 levels) in <top (required)>'7002 8) Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes when passing until_table parameter with a table that exists only truncates until the table specified7003 Failure/Error: raise "Table '#{table_name}' is not locked for writes. Run the rake task gitlab:db:lock_writes first"7004 RuntimeError:7005 Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first7006 Shared Example Group: "truncating legacy tables on a database" called from ./spec/lib/gitlab/database/tables_truncate_spec.rb:3107007 # ./lib/gitlab/database/tables_truncate.rb:49:in `block in execute'7008 # ./lib/gitlab/database/tables_truncate.rb:38:in `each'7009 # ./lib/gitlab/database/tables_truncate.rb:38:in `execute'7010 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:47:in `block (3 levels) in <top (required)>'7011 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:222:in `block (7 levels) in <top (required)>'7012 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:221:in `block (6 levels) in <top (required)>'7013 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'7014 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'7015 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'7016 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'7017 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'7018 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'7019 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'7020 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'7021 # ./spec/support/multiple_databases.rb:16:in `block (3 levels) in <top (required)>'7022 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'7023 # ./spec/support/multiple_databases.rb:15:in `block (2 levels) in <top (required)>'7024 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'7025 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'7026 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'7027 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'7028 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'7029 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'7030 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'7031 # ./spec/support/database/gitlab_schemas_validate_connection.rb:11:in `block (2 levels) in <top (required)>'7032 9) Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes when passing until_table parameter with a table that does not exist raises an error if the specified table does not exist7033 Failure/Error:7034 expect do7035 truncate_legacy_tables7036 end.to raise_error(/The table 'foobar' is not within the truncated tables/)7037 expected /The table 'foobar' is not within the truncated tables/, got #<RuntimeError: Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first> with backtrace:7038 # ./lib/gitlab/database/tables_truncate.rb:49:in `block in execute'7039 # ./lib/gitlab/database/tables_truncate.rb:38:in `each'7040 # ./lib/gitlab/database/tables_truncate.rb:38:in `execute'7041 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:47:in `block (3 levels) in <top (required)>'7042 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:233:in `block (7 levels) in <top (required)>'7043 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:232:in `block (6 levels) in <top (required)>'7044 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'7045 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'7046 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'7047 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'7048 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'7049 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'7050 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'7051 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'7052 # ./spec/support/multiple_databases.rb:16:in `block (3 levels) in <top (required)>'7053 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'7054 # ./spec/support/multiple_databases.rb:15:in `block (2 levels) in <top (required)>'7055 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'7056 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'7057 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'7058 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'7059 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'7060 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'7061 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'7062 # ./spec/support/database/gitlab_schemas_validate_connection.rb:11:in `block (2 levels) in <top (required)>'7063 Shared Example Group: "truncating legacy tables on a database" called from ./spec/lib/gitlab/database/tables_truncate_spec.rb:3107064 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:232:in `block (6 levels) in <top (required)>'7065 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'7066 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'7067 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'7068 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'7069 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'7070 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'7071 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'7072 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'7073 # ./spec/support/multiple_databases.rb:16:in `block (3 levels) in <top (required)>'7074 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'7075 # ./spec/support/multiple_databases.rb:15:in `block (2 levels) in <top (required)>'7076 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'7077 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'7078 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'7079 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'7080 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'7081 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'7082 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'7083 # ./spec/support/database/gitlab_schemas_validate_connection.rb:11:in `block (2 levels) in <top (required)>'7084 10) Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes when one of the attached partitions happened to be locked for writes truncates the locked partition successfully7085 Failure/Error: raise "Table '#{table_name}' is not locked for writes. Run the rake task gitlab:db:lock_writes first"7086 RuntimeError:7087 Table 'gitlab_partitions_dynamic._test_gitlab_main_part_20220101' is not locked for writes. Run the rake task gitlab:db:lock_writes first7088 Shared Example Group: "truncating legacy tables on a database" called from ./spec/lib/gitlab/database/tables_truncate_spec.rb:3107089 # ./lib/gitlab/database/tables_truncate.rb:49:in `block in execute'7090 # ./lib/gitlab/database/tables_truncate.rb:38:in `each'7091 # ./lib/gitlab/database/tables_truncate.rb:38:in `execute'7092 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:47:in `block (3 levels) in <top (required)>'7093 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:253:in `block (6 levels) in <top (required)>'7094 # ./spec/lib/gitlab/database/tables_truncate_spec.rb:252:in `block (5 levels) in <top (required)>'7095 # ./spec/spec_helper.rb:442:in `block (3 levels) in <top (required)>'7096 # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'7097 # ./spec/spec_helper.rb:433:in `block (2 levels) in <top (required)>'7098 # ./spec/spec_helper.rb:429:in `block (3 levels) in <top (required)>'7099 # ./lib/gitlab/application_context.rb:66:in `with_raw_context'7100 # ./spec/spec_helper.rb:429:in `block (2 levels) in <top (required)>'7101 # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'7102 # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'7103 # ./spec/support/multiple_databases.rb:16:in `block (3 levels) in <top (required)>'7104 # ./spec/support/helpers/database/multiple_databases_helpers.rb:107:in `with_reestablished_active_record_base'7105 # ./spec/support/multiple_databases.rb:15:in `block (2 levels) in <top (required)>'7106 # ./spec/support/fast_quarantine.rb:23:in `block (2 levels) in <top (required)>'7107 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'7108 # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'7109 # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'7110 # ./spec/support/database/gitlab_schemas_validate_connection.rb:6:in `block in with_gitlab_schemas_validate_connection_prevented'7111 # ./lib/gitlab/database/query_analyzers/base.rb:39:in `with_suppressed'7112 # ./spec/support/database/gitlab_schemas_validate_connection.rb:5:in `with_gitlab_schemas_validate_connection_prevented'7113 # ./spec/support/database/gitlab_schemas_validate_connection.rb:11:in `block (2 levels) in <top (required)>'7114Finished in 19 minutes 21 seconds (files took 1 minute 3.43 seconds to load)71152886 examples, 10 failures, 26 pending7116Failed examples:7117rspec './spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb[1:2:17:1:3:1]' # Gitlab::Database::MigrationHelpers::RestrictGitlabSchema when executing migrations does raise exception when accessing feature flags for db_config_name=main while restrict_gitlab_migration=gitlab_schema_gitlab_shared does run migrate :up and :down7118rspec './spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb[1:2:17:2:1:1]' # Gitlab::Database::MigrationHelpers::RestrictGitlabSchema when executing migrations does raise exception when accessing feature flags for db_config_name=ci while restrict_gitlab_migration=no_gitlab_schema does run migrate :up and :down7119rspec './spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb[1:2:17:2:3:1]' # Gitlab::Database::MigrationHelpers::RestrictGitlabSchema when executing migrations does raise exception when accessing feature flags for db_config_name=ci while restrict_gitlab_migration=gitlab_schema_gitlab_shared does run migrate :up and :down7120rspec './spec/lib/gitlab/database/tables_truncate_spec.rb[1:2:1:2:1]' # Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes truncates the legacy tables7121rspec './spec/lib/gitlab/database/tables_truncate_spec.rb[1:2:1:2:2]' # Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes does not affect the other tables7122rspec './spec/lib/gitlab/database/tables_truncate_spec.rb[1:2:1:2:3]' # Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes logs the sql statements to the logger7123rspec './spec/lib/gitlab/database/tables_truncate_spec.rb[1:2:1:2:4:1]' # Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes when running in dry_run mode does not truncate the legacy tables if running in dry run mode7124rspec './spec/lib/gitlab/database/tables_truncate_spec.rb[1:2:1:2:5:1:1]' # Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes when passing until_table parameter with a table that exists only truncates until the table specified7125rspec './spec/lib/gitlab/database/tables_truncate_spec.rb[1:2:1:2:5:2:1]' # Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes when passing until_table parameter with a table that does not exist raises an error if the specified table does not exist7126rspec './spec/lib/gitlab/database/tables_truncate_spec.rb[1:2:1:2:6:1]' # Gitlab::Database::TablesTruncate when truncating gitlab_main tables on the ci database behaves like truncating legacy tables on a database when the truncated tables are locked for writes when one of the attached partitions happened to be locked for writes truncates the locked partition successfully7127Randomized with seed 429267128[TEST PROF INFO] Time spent in factories: 02:34.241 (13.23% of total time)7129Stopped processing SimpleCov as a previous error not related to SimpleCov has been detected7130RETRIED_TESTS_REPORT_PATH: rspec/flaky/retried_tests_rspec_db-library-code_pg13_report.txt7131Retrying the failing examples in a new RSpec process...7132$ gem install junit_merge --no-document --version 0.1.27133Successfully installed nokogiri-1.15.3-x86_64-linux7134Successfully installed junit_merge-0.1.271352 gems installed7136==> 'gem install junit_merge --no-document --version 0.1.2' succeeded in 2 seconds.7137Running RSpec command: bin/rspec -Ispec -rspec_helper --color --failure-exit-code 1 --error-exit-code 2 --format documentation --format Support::Formatters::JsonFormatter --out rspec/rspec-retry-4749214737.json --format RspecJunitFormatter --out rspec/rspec-retry-4749214737.xml --only-failures --pattern "{,ee/,jh/}spec/{,**/}*_spec.rb"7138/builds/gitlab-org/gitlab/ee/app/services/remote_development/service_response_factory.rb:41: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7139/builds/gitlab-org/gitlab/ee/app/services/remote_development/workspaces/create_service.rb:28: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7140/builds/gitlab-org/gitlab/ee/app/services/remote_development/workspaces/update_service.rb:28: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7141/builds/gitlab-org/gitlab/ee/lib/remote_development/agent_config/main.rb:32: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7142/builds/gitlab-org/gitlab/ee/lib/remote_development/agent_config/main.rb:35: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7143/builds/gitlab-org/gitlab/ee/lib/remote_development/agent_config/updater.rb:11: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7144/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/authorizer.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7145/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/authorizer.rb:13: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7146/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/creator.rb:17: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7147/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/creator.rb:24: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7148/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/creator.rb:25: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7149/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/creator.rb:28: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7150/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/devfile_fetcher.rb:15: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7151/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/devfile_fetcher.rb:16: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7152/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/devfile_flattener.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7153/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/editor_component_injector.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7154/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/editor_component_injector.rb:17: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7155/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/editor_component_injector.rb:18: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7156/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/main.rb:48: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7157/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:43: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7158/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:54: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7159/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:102: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7160/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:126: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7161/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:159: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7162/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:202: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7163/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb:235: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7164/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb:24: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7165/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb:52: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7166/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7167/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb:17: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7168/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb:18: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7169/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb:23: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7170/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/volume_component_injector.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7171/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/volume_component_injector.rb:13: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7172/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/create/volume_component_injector.rb:14: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7173/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/update/authorizer.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7174/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/update/main.rb:28: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7175/builds/gitlab-org/gitlab/ee/lib/remote_development/workspaces/update/updater.rb:12: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!7176Run options: include {:last_run_status=>"failed"}7177Test environment set up in 0.536140651 seconds7178Gitlab::Database::MigrationHelpers::RestrictGitlabSchema7179 when executing migrations7180 does raise exception when accessing feature flags7181 for db_config_name=main7182 while restrict_gitlab_migration=gitlab_schema_gitlab_shared7183 does run migrate :up and :down71851st Try error in ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:554:7186expected Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas::DMLAccessDeniedError but nothing was raised7188RSpec::Retry: 2nd try ./spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb:5547189 for db_config_name=ci7190 while restrict_gitlab_migration=no_gitlab_schema7191 does run migrate :up and :down7192 while restrict_gitlab_migration=gitlab_schema_gitlab_shared7193 does run migrate :up and :down7194Gitlab::Database::TablesTruncate7195 # order random7196 when truncating gitlab_main tables on the ci database7197 behaves like truncating legacy tables on a database7198 when the truncated tables are locked for writes7199WARNING: Active Record does not support composite primary key.7200_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7201WARNING: Active Record does not support composite primary key.7202gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7203WARNING: Active Record does not support composite primary key.7204_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7205WARNING: Active Record does not support composite primary key.7206gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7207 truncates the legacy tables7208WARNING: Active Record does not support composite primary key.7209_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7210WARNING: Active Record does not support composite primary key.7211gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7212WARNING: Active Record does not support composite primary key.7213_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7214WARNING: Active Record does not support composite primary key.7215gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7216 does not affect the other tables7217WARNING: Active Record does not support composite primary key.7218_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7219WARNING: Active Record does not support composite primary key.7220gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7221WARNING: Active Record does not support composite primary key.7222_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7223WARNING: Active Record does not support composite primary key.7224gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7225 logs the sql statements to the logger7226 when running in dry_run mode7227WARNING: Active Record does not support composite primary key.7228_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7229WARNING: Active Record does not support composite primary key.7230gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7231WARNING: Active Record does not support composite primary key.7232_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7233WARNING: Active Record does not support composite primary key.7234gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7235 does not truncate the legacy tables if running in dry run mode7236 when passing until_table parameter7237 with a table that exists7238WARNING: Active Record does not support composite primary key.7239_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7240WARNING: Active Record does not support composite primary key.7241gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7242WARNING: Active Record does not support composite primary key.7243_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7244WARNING: Active Record does not support composite primary key.7245gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7246 only truncates until the table specified7247 with a table that does not exist7248WARNING: Active Record does not support composite primary key.7249_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7250WARNING: Active Record does not support composite primary key.7251gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7252WARNING: Active Record does not support composite primary key.7253_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7254WARNING: Active Record does not support composite primary key.7255gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7256 raises an error if the specified table does not exist7257 when one of the attached partitions happened to be locked for writes7258WARNING: Active Record does not support composite primary key.7259_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7260WARNING: Active Record does not support composite primary key.7261gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7262WARNING: Active Record does not support composite primary key.7263_test_gitlab_hook_logs has composite primary key. Composite primary key is ignored.7264WARNING: Active Record does not support composite primary key.7265gitlab_partitions_dynamic._test_gitlab_hook_logs_202201 has composite primary key. Composite primary key is ignored.7266 truncates the locked partition successfully7267Finished in 9.22 seconds (files took 48.76 seconds to load)726810 examples, 0 failures7269Randomized with seed 343257270[TEST PROF INFO] Time spent in factories: 00:00.034 (0.28% of total time)7271Loading rspec/rspec-4749214737.json...7272Merged rspec/rspec-retry-4749214737.json adding 5 results.7273Saved rspec/rspec-4749214737.json.7274A test was flaky and succeeded after being retried. Checking to see if flaky test is part of this MR...7275Flaky test was not part of this MR.7277Running after script...7278$ echo -e "\e[0Ksection_start:`date +%s`:report_results_section[collapsed=true]\r\e[0KReport results"7290Not uploading cache ruby-gems-debian-bullseye-ruby-3.0-16 due to policy7292Uploading artifacts...7293WARNING: auto_explain/: no matching files. Ensure that the artifact path is relative to the working directory (/builds/gitlab-org/gitlab) 7294coverage/: found 4 matching artifact files and directories 7295crystalball/: found 2 matching artifact files and directories 7296WARNING: deprecations/: no matching files. Ensure that the artifact path is relative to the working directory (/builds/gitlab-org/gitlab) 7297knapsack/: found 2 matching artifact files and directories 7298rspec/: found 12 matching artifact files and directories 7299WARNING: tmp/capybara/: no matching files. Ensure that the artifact path is relative to the working directory (/builds/gitlab-org/gitlab) 7300log/*.log: found 14 matching artifact files and directories 7301WARNING: Upload request redirected location=https://gitlab.com/api/v4/jobs/4749214737/artifacts?artifact_format=zip&artifact_type=archive&expire_in=31d new-url=https://gitlab.com7302WARNING: Retrying... context=artifacts-uploader error=request redirected7303Uploading artifacts as "archive" to coordinator... 201 Created id=4749214737 responseStatus=201 Created token=64_tyMkd7304Uploading artifacts...7305rspec/rspec-*.xml: found 2 matching artifact files and directories 7306WARNING: Upload request redirected location=https://gitlab.com/api/v4/jobs/4749214737/artifacts?artifact_format=gzip&artifact_type=junit&expire_in=31d new-url=https://gitlab.com7307WARNING: Retrying... context=artifacts-uploader error=request redirected7308Uploading artifacts as "junit" to coordinator... 201 Created id=4749214737 responseStatus=201 Created token=64_tyMkd7310Job succeeded