timescale / homebrew-tap

TimescaleDB Homebrew tap, containing formulas for the database, tools, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

upgrading brew breaks 12 to 13

taf2 opened this issue · comments

commented

now that brew randomly decided to upgrade postgresql again from 12 to 13 this time - timescale is once again broken...

brew postgresql-upgrade-database --verbose --debug
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/postgresql.rb
==> Upgrading postgresql data from 12 to 13...
/usr/local/Cellar/postgresql@12/12.7/bin/pg_ctl -w -D /usr/local/var/postgres start
waiting for server to start....2021-06-13 12:07:09.777 EDT [67953] FATAL:  could not access file "timescaledb": No such file or directory
2021-06-13 12:07:09.777 EDT [67953] LOG:  database system is shut down
 stopped waiting
pg_ctl: could not start server
Examine the log output.
==> Moving postgresql data from /usr/local/var/postgres to /usr/local/var/postgres.old...
==> Creating database...
/usr/local/opt/postgresql/bin/initdb /usr/local/var/postgres
The files belonging to this database system will be owned by user "taf2".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /usr/local/var/postgres ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... America/New_York
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/local/opt/postgresql/bin/pg_ctl -D /usr/local/var/postgres -l logfile start

==> Migrating and upgrading data...
/usr/local/opt/postgresql/bin/pg_upgrade -r -b /usr/local/Cellar/postgresql@12/12.7/bin -B /usr/local/opt/postgresql/bin -d /usr/local/var/postgres.old -D /usr/local/var/postgres -j 16
Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok

The source cluster was not shut down cleanly.
Failure, exiting
Error: Upgrading postgresql data from 12 to 13 failed!
==> Removing empty postgresql initdb database...
==> Moving postgresql data back from /usr/local/var/postgres.old to /usr/local/var/postgres...
Error: Failure while executing; `/usr/local/opt/postgresql/bin/pg_upgrade -r -b /usr/local/Cellar/postgresql@12/12.7/bin -B /usr/local/opt/postgresql/bin -d /usr/local/var/postgres.old -D /usr/local/var/postgres -j 16` exited with 1.
/usr/local/Homebrew/Library/Homebrew/utils.rb:322:in `safe_system'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/cmd/postgresql-upgrade-database.rb:126:in `block in postgresql_upgrade_database'
/usr/local/Homebrew/Library/Homebrew/extend/pathname.rb:303:in `block in cd'
/usr/local/Homebrew/Library/Homebrew/extend/pathname.rb:303:in `chdir'
/usr/local/Homebrew/Library/Homebrew/extend/pathname.rb:303:in `cd'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/cmd/postgresql-upgrade-database.rb:125:in `postgresql_upgrade_database'
/usr/local/Homebrew/Library/Homebrew/brew.rb:122:in `<main>'
commented

Trying to maybe keep things on 12 to avoid just deleting the database like normal so running:

/usr/local/opt/postgresql@12/bin/pg_ctl -D /usr/local/var/postgresql@12/ -l logfile start
/usr/bin/install -c -m 755 $(find /usr/local/Cellar/timescaledb/2.3.0/lib -name timescaledb*.so) /usr/local/Cellar/postgresql@12/12.7/lib/postgresql/
/usr/bin/install -c -m 644 /usr/local/Cellar/timescaledb/2.3.0/share/timescaledb/* /usr/local/Cellar/postgresql@12/12.7/share/postgresql@12/extension/

a little closer but still just hard fails...

cat logfile

2021-06-13 12:16:13.509 EDT [80231] FATAL:  incompatible library "/usr/local/Cellar/postgresql@12/12.7/lib/postgresql/timescaledb.so": version mismatch
2021-06-13 12:16:13.509 EDT [80231] DETAIL:  Server is version 12, library is version 13.
2021-06-13 12:16:13.509 EDT [80231] LOG:  database system is shut down

A few things:

  • When you perform an upgrade, you need to upgrade Postgres and TimescaleDB independently. So don't try to upgrade both simultaneously, first upgrade TimescaleDB and then PG (or vice versa).

  • Similarly, you need to run the right ecosystem tools on top of Postgres. That includes versions of psql that match your server, and also TimescaleDB. It appears you are trying to run a version of TimescaleDB built against PG13 against your PG12 installation?

commented

Thanks @mfreed the frustrating thing is I didn't request to update timescaledb or postgresql... rather I went to install a package in brew and then all of this happened... so in other-words brew auto updated and now my timescaledb setup is broken...

I was trying to see if I could get things working again by forcing it to use pg12 instead of pg13 but no luck...