Project

General

Profile

Actions

Bug #20074

closed

Int to BigInt migration fails because of statement timeout

Added by Lucas Di Pentima about 1 year ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
API
Target version:
Story points:
0.5
Release relationship:
Auto

Description

Jenkins' deploy-to-tordo pipeline is failing with the following message:

...
20:10:49 api.tordo.playg: Running db:migrate...Defaulting to memory cache, because /var/www/arvados-api/current/tmp/cache owner (uid=33) is not me (uid=0)
20:10:49 api.tordo.playg: == 20221230155924 BigintId: migrating =========================================
20:10:49 api.tordo.playg: -- change_column(:api_client_authorizations, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0070s
20:10:49 api.tordo.playg: -- change_column(:api_client_authorizations, :api_client_id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0023s
20:10:49 api.tordo.playg: -- change_column(:api_client_authorizations, :user_id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0018s
20:10:49 api.tordo.playg: -- change_column(:api_clients, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0029s
20:10:49 api.tordo.playg: -- change_column(:authorized_keys, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0022s
20:10:49 api.tordo.playg: -- change_column(:collections, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0522s
20:10:49 api.tordo.playg: -- change_column(:container_requests, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0028s
20:10:49 api.tordo.playg: -- change_column(:containers, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0027s
20:10:49 api.tordo.playg: -- change_column(:groups, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0025s
20:10:49 api.tordo.playg: -- change_column(:humans, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0024s
20:10:49 api.tordo.playg: -- change_column(:job_tasks, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0028s
20:10:49 api.tordo.playg: -- change_column(:jobs, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0049s
20:10:49 api.tordo.playg: -- change_column(:keep_disks, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0029s
20:10:49 api.tordo.playg: -- change_column(:keep_services, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0037s
20:10:49 api.tordo.playg: -- change_column(:links, :id, :bigint)
20:10:49 api.tordo.playg:    -> 0.0025s
20:10:49 api.tordo.playg: -- change_column(:logs, :id, :bigint)
20:10:49 api.tordo.playg: rake aborted!
20:10:49 api.tordo.playg: StandardError: An error has occurred, all later migrations canceled:
20:10:49 api.tordo.playg: 
20:10:49 api.tordo.playg: PG::QueryCanceled: ERROR:  canceling statement due to statement timeout
20:10:49 api.tordo.playg: : ALTER TABLE "logs" ALTER COLUMN "id" TYPE bigint
...

Probably what we need is modifying the migration to be something like the following example:

class AddIndexOnPatientIDInAppointments < ActiveRecord::Migration[6.0]
  disable_ddl_transaction!

  def change
    old_value = query_value('SHOW statement_timeout')
    execute "SET statement_timeout TO '0s'" 

    add_index :appointments, :patient_id, algorithm: :concurrently
    execute "SET statement_timeout TO '#{quote(old_value)}s'" 
  end
end
Actions #1

Updated by Lucas Di Pentima about 1 year ago

  • Story points set to 0.5
  • Target version changed from Future to 2023-02-15 sprint
  • Assigned To set to Lucas Di Pentima
  • Status changed from New to In Progress
Actions #2

Updated by Lucas Di Pentima about 1 year ago

Updates at cffecc324 - branch 20074-bigint-migration-fix
Test run: developer-run-tests: #3489

  • Disables statement timeout to the latest rails migration.
Actions #3

Updated by Lucas Di Pentima about 1 year ago

Tests succeeded. Merging to test if the deploy-to-tordo pipeline gets fixed.

Actions #4

Updated by Peter Amstutz about 1 year ago

  • Release set to 57
Actions #5

Updated by Lucas Di Pentima about 1 year ago

Pushed e10646b6c to main to fix a time unit handling issue that made deploy-to-tordo: #998 fail.

Actions #6

Updated by Peter Amstutz about 1 year ago

  • Target version changed from 2023-02-15 sprint to 2023-03-01 sprint
Actions #7

Updated by Lucas Di Pentima about 1 year ago

  • Status changed from In Progress to Resolved

deploy-to-tordo passed: deploy-to-tordo: #999 -- closing this as resolved.

Actions

Also available in: Atom PDF