"Failed to initialize repository handler..." error and Autoscaler errand failure because of unknown migration in database
search cancel

"Failed to initialize repository handler..." error and Autoscaler errand failure because of unknown migration in database

book

Article ID: 297411

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

While upgrading to Tanzu Application Service (TAS) v2.12.3+ and v2.11.9+, Apply Changes fail with Autoscaler errand due to the following error:
"Failed to initialize repository handlerUnable to create migration plan because of 50_add_scale_up_factor_to_service_bindings.sql: unknown migration in database"


Depending on the state of the Autoscaler database, you may also present itself with the following error:

"Failed to initialize repository handlerError 1060: Duplicate column name 'scale_up_factor' handling 50_add_scale_up_factor_to_service_bindings.sql"


The unknown migration error can also occur when downgrading Autoscaler to v241 after having upgraded it to v242 (ie. when upgrading from TAS 2.11.9+ to TAS 2.12.0-2.12.2).


Resolution

Tanzu Application Service (TAS) v2.12.3 introduced Autoscaler v242, which implements a new SQL migration. 

To work around this issue, manually modify the records in the Autoscaling database. To manually modify the records in the Autoscaling database, follow these steps:

1. SSH into the MySQL VM for the TAS deployment:

bosh -d <TAS_DEPLOYMENT> ssh mysql/0


2. Connect to MySQL client

mysql --defaults-file=/var/vcap/jobs/pxc-mysql/config/mylogin.cnf


3. Execute the following queries in order to  bring the database back to an operational state:

USE autoscaling;
DELETE FROM gorp_migrations WHERE id='50_add_scale_up_factor_to_service_bindings.sql';
ALTER TABLE service_bindings DROP scale_up_factor;

4. Verify that these changes are successful.