develop icon indicating copy to clipboard operation
develop copied to clipboard

Fix gp_repack docker-compose command

Open yegorLitvinov opened this issue 3 years ago • 7 comments

run command will fail with Can't connect to socket.. error for pg_repack

yegorLitvinov avatar Mar 12 '22 10:03 yegorLitvinov

@yegorLitvinov is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Mar 12 '22 10:03 vercel[bot]

@chendo @BYK Could you please review this pr. Related PR is https://github.com/getsentry/develop/pull/388

yegorLitvinov avatar May 02 '22 07:05 yegorLitvinov

@yegorLitvinov looks good. exec is what I have in my own scripts, not sure how that became run here, my bad

chendo avatar May 02 '22 07:05 chendo

Presumably because if you run, it doesn't run Postgres and thus it can't connect to the postgres socket. We run ours in a cronjob while Sentry is running. pg_repack is designed to be run online

chendo avatar May 02 '22 12:05 chendo

Presumably because if you run, it doesn't run Postgres and thus it can't connect to the postgres socket.

Ahh, right as we are overriding the default CMD for Postgres. I think all we need is a postgres or postgres & call in that run line and we don't need exec or the system being up. Would you mind trying that?

BYK avatar May 02 '22 13:05 BYK

@BYK the run command you advised is working well, but I can't check the result as there is not enough space on my disk for pg_repack. @chendo Could you test it?

yegorLitvinov avatar May 04 '22 22:05 yegorLitvinov

@yegorLitvinov while this PR fixes the pg_repack command, you still need to install the extension in the database, if it was not installed previously. Here is the full list of commands that I executed and that I would propose documenting instead:

  1. Go inside the postgres container: docker compose exec postgres bash
  2. Install packages apt update && apt install -y --no-install-recommends postgresql-14-repack
  3. Create extension: psql -c "CREATE EXTENSION pg_repack" -d <DB_NAME> -U <DB_USERNAME>
  4. Run pg_repack: pg_repack -E info -t nodestore_node -d <DB_NAME> -U <DB_USERNAME>
  5. Optionally, drop the extension: psql -c "DROP EXTENSION pg_repack" -d <DB_NAME> -U <DB_USERNAME>

gdalmau avatar Jun 10 '24 11:06 gdalmau