ClickHouse / homebrew-clickhouse

ClickHouse Homebrew tap (old repository, unused)
57 stars 7 forks source link

Issues while upgrading 22.1 to 22.2 #37

Closed dbackeus closed 2 years ago

dbackeus commented 2 years ago

As suggested in https://github.com/Altinity/homebrew-clickhouse/issues/29 I embarked on upgrading my 22.1 install to 22.2.

I had originally installed with brew install clickhouse and used brew services stop/start clickhouse, ie. I had never explicitly used clickhouse@22.1. After running brew update and brew upgrade I had expected to automatically upgrade to 22.2 but instead it upgraded to the latest 22.1 build. However after this running brew services stop/start clickhouse would complain that clickhouse@22.2was not installed.

This was quite confusing and I would suggest following the path that other databases like postgres / redis have taken and always install the latest major/minor version unless an @ has been used explicitly.

Now to upgrade to 22.2 I ran brew stop clickhouse@22.1 and then ran brew install clickhouse. This installed 22.2 but failed the postinstall step with:

/opt/homebrew/var/run/clickhouse-server/clickhouse-server.pid file exists and contains pid = 25089.
The process with pid = 25089 is already running.
Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall altinity/clickhouse/clickhouse@22.2

Not sure why, but subsequently manually running the postinstall command completed successfully.

traceon commented 2 years ago

Seems like a clickhouse process is still running.

Try:

brew update

brew services stop clickhouse
brew services stop clickhouse@22.1
brew services stop clickhouse@22.2

brew remove clickhouse
brew remove clickhouse@22.1
brew remove clickhouse@22.2

brew cleanup

killall -TERM clickhouse
sleep 15
killall -KILL clickhouse

brew install clickhouse      # expect postinstall to pass without problems
brew start clickhouse
dbackeus commented 2 years ago

subsequently manually running the postinstall command completed successfully

So that issue got resolved, however it's unclear why it complained in the first place since I had already done brew stop clickhouse@22.1 so shouldn't have had any process still running. I posted the issue to encourage improving the behaviour of the brew formula in general.

Eg. ensure that brew upgrade clickhouse without @ specification always uses the latest version. And possibly ensure that brew stop ... fully terminates clickhouse before reporting it's successfully stopped.

traceon commented 2 years ago

Thanks for reporting this. This could be caused by the behavior of the clickhouse start/stop command, which is used in formula's postinstal action. Maybe some transient issue with that code in clickhouse itself...