Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sqitch does not work after homebrew upgrade (Mac OS X) #38

Closed
tiguchi opened this issue Mar 9, 2021 · 17 comments
Closed

Sqitch does not work after homebrew upgrade (Mac OS X) #38

tiguchi opened this issue Mar 9, 2021 · 17 comments

Comments

@tiguchi
Copy link

tiguchi commented Mar 9, 2021

Problem

When Perl is updated via brew upgrade, sqitch usually stops working with an error message as follows:

/usr/local/bin/sqitch: /usr/local/Cellar/perl/5.32.1/bin/perl: bad interpreter: No such file or directory

Reproduction Steps

For Mac OS X

  1. Install sqitch via brew install sqitch
  2. Upgrade Perl via brew upgrade
  3. Run sqitch

Workaround

The only fix to my knowledge is reinstalling sqitch via brew reinstall sqitch.

Troubleshooting

I guess this is caused by sqitch referencing the previous Perl binary before the upgrade.

Homebrew unfortunately installs minor and patch version updates in new directories, causing problems like this also for other applications.

I'm not sure if this is entirely a homebrew defect or whether there is something that could be done right in the sqitch launcher script or the Homebrew installation script. Maybe there is an upgrade hook for Homebrew packages that could be used for relinking with the correct Perl installation.

Maybe there is also a better way for finding the correct Perl binary such as:

#!/usr/bin/env perl
@theory theory transferred this issue from sqitchers/sqitch Mar 9, 2021
@theory
Copy link
Contributor

theory commented Mar 9, 2021

If we switched it to use #!/usr/bin/env/perl, I wonder if it would then fail spectacularly on a major version upgrade that breaks binary compatibility. Would be better if there was a major-version-specific symlink to rely on or something.

@tiguchi
Copy link
Author

tiguchi commented Mar 9, 2021

I just found the following Homebrew ticket, and it looks like pre- and post-install hooks are not a wanted feature: Homebrew/brew#2202

It seems Homebrew does symlink the latest installed versions of all packages in the following base directory:

/usr/local/var/homebrew/linked/

My local installation contains a perl directory with its bin, lib and share sub-directories. No version number in that file path. This doesn't guard against the binary compatibility problem you mention. What would be the worst that could happen in that case? Would sqitch just crash or produce an error message?

@theory
Copy link
Contributor

theory commented Mar 9, 2021

Yes, probably. But it would happen to folks once a year at most (at major version releases).

@bhawnatyagi
Copy link

I am facing the same issue after homebrew upgrade (Mac OS X). I can see this issue is in open status but is there any way to fix this issue? This is a blocker for our production deployment. I tried reinstalling sqitch and currently I have sqitch v1.3.1 on my mac.

@theory
Copy link
Contributor

theory commented Nov 29, 2022

Have you tried removing and re-installing Sqitch?

@bhawnatyagi
Copy link

bhawnatyagi commented Nov 29, 2022

Yes, I didn't remove but reinstalled sqitch using brew reinstall sqitch.

@theory
Copy link
Contributor

theory commented Nov 29, 2022

I have updated my Mac, so tried to run Sqitch, and yeah, it failed due to an upgraded Perl. Reinstall didn't fix it, but removing it then installing it again fixed it.

brew remove sqitch
brew install sqitch --with-postgres-support --with-sqlite-support

I don't think there is anything to do about this: when there is a major Perl upgrade, none of the modules can be considered binary compatible, so Sqitch must be completely reinstalled.

@bhawnatyagi
Copy link

bhawnatyagi commented Nov 29, 2022

I need the reinstallation for snowflake. Does the below command look right to you?
brew install sqitch --with-snowflake-support

@theory
Copy link
Contributor

theory commented Nov 29, 2022

Yep, documented here

@bhawnatyagi
Copy link

Hi, I am getting below error while running sqitch status command. Its complaining about tag that has been used to tag one of the change.

sqitch status 'db:snowflake://username:[email protected]/db?Driver=Snowflake;warehouse=wh'
Syntax error in sqitch.plan at line 111: Tag "public/procedures/alter_datalake_to_prelanding_insert" contains illegal character /

Could you please help in resolving this issue? What does this error mean?

@theory
Copy link
Contributor

theory commented Mar 27, 2023

Slashes are not allowed in tags, as of v1.3.1. You will need to remove the slashes from the tag, make it something like public-procedures-alter_datalake_to_prelanding_insert. If you already have deployed this tag to production on an earlier version of Sqitch, you can continue to use that earlier version until you have the chance to fix it, something like:

  • With Sqitch 1.3.0 and a release of your project with the slashes in the tag, run `revert --log-only --to-change public/procedures/alter_datalake_to_prelanding_insert^
  • Upgrade Sqitch to 1.3.1 or higher and grab an updated version of your project with the slashes removed from the tag
  • Run sqitch deploy --log-only

The --log-only option tells Sqitch to do the revert and deploy without actually running the scripts, so no changes will be made to your database, only to the registry.

@bhawnatyagi
Copy link

bhawnatyagi commented Mar 27, 2023

Thanks, how can I downgrade the sqitch version? I tried using version specifically to downgrade while installing sqitch but it didn't work. Also, how to grab the latest version of sqitch?

We are also trying to do deployment using sqitch docker. However, we are getting below error when we tried running sqitch status command:

output=Database db:snowflake://<account-name>/<db_name>?Driver=Snowflake;warehouse=<wh>;pwd=<pwd>;UID=<user>;role=<Role> has not been initialized for Sqitch. What does this error mean? How can we resolve this issue?

@theory
Copy link
Contributor

theory commented Mar 27, 2023

It means you haven't deployed a change to that database before, so it does not yet have a registry schema.

@bhawnatyagi
Copy link

Oh but we have deployed changes to this database before. The database that we are using is production database. Any idea what could be wrong or how can I debug this issue?

@theory
Copy link
Contributor

theory commented Mar 27, 2023

My guess is you're not connecting to the database you think you are, or else that the user or role you're using does not have the necessary access.

@theory theory closed this as completed Jun 19, 2023
@pchilds
Copy link

pchilds commented Nov 29, 2023

Why is this considered completed? Instead of making breaking changes every major version upgrade it is currently still breaking every version upgrade.

@theory
Copy link
Contributor

theory commented Dec 2, 2023

Mainly because this repository is for the Docker image, not the Homebrew formula. Does sqitchers/homebrew-sqitch#61 correspond to the problem you're seeing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants