Ran into a database issue with the migration scrip...
# fleet
j
Ran into a database issue with the migration script upgrading from 4.30.1 > fleet-v4.32.0
Copy code
#   Missing migrations: tables=[20230411102858 20230421155932 20230425082126 20230425105727 20230501154913 20230503101418 20230515144206 20230517140952 20230517152807 20230518114155 20230520153236], data=[].
2023/06/06 14:01:00 FAIL 20230320133602_AddResetRequestedToHostDiskEncryptionKeys.go (Error 1060: Duplicate column name 'reset_requested'), quitting migration.
k
Hi @Jason Roberts! Is there any chance that you have multiple instances trying to run migrations at the same time?
j
it's very possible
as its a bunch of instances in a managed instance group. If there is not a database lock of some sort they could all try to run migrations at the same time
k
That sounds like it's likely the culprit. That instance us trying to run a migration that already ran through. Ideally, you'd have one instance running migrations (I'll get an FAQ entry up about that!). As long as one of the instances made it through the process, you should be golden.
j
i don't think any made it all the way though
they all try to run migrations and fail
k
Can you try bringing your instances down to zero and then bringing one up to run migrations?
j
i can but at this point i think i have to drop that table
or column
k
I was hoping that if you did, that migration would register as complete and skip. If not, yes, some database surgery may need to happen.
j
lol can i feature request some kind of lock that prevents db migrations from running from more than one node at a time
k
Absolutely. I'll bring it to the team and see what the challenges might be on that!
j
well that turned out to be a bunch of surgery
Copy code
ALTER TABLE `host_disk_encryption_keys` DROP COLUMN `reset_requested`;
ALTER TABLE `software_cpe` DROP INDEX `unq_software_id`;
DROP TABLE `mdm_apple_bootstrap_packages`;
ALTER TABLE `host_mdm_apple_profiles` DROP COLUMN `checksum`;
ALTER TABLE `mdm_apple_configuration_profiles` DROP COLUMN `checksum`;
k
All good now?
j
yea
its happy now
lol i should have just restored from backup when i broke this last week
k
Great! Sorry you ran into trouble there, I'll see what we can do on our end to keep that from happening.