Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ services:
postgres:
<<: *restart_policy
# Using the same postgres version as Sentry dev for consistency purposes
image: "postgres:14.24-bookworm"
image: "postgres:14.24-trixie"
Comment thread
aminvakil marked this conversation as resolved.
healthcheck:
<<: *healthcheck_defaults
# Using default user "postgres" from sentry/sentry.conf.example.py or value of POSTGRES_USER if provided
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ source install/ensure-relay-credentials.sh
source install/generate-secret-key.sh
source install/build-docker-images.sh
source install/migrate-seaweedfs-kek.sh
source install/upgrade-postgres.sh
source install/bootstrap-s3-nodestore.sh
source install/bootstrap-snuba.sh
source install/upgrade-postgres.sh
source install/ensure-correct-permissions-profiles-dir.sh
source install/bootstrap-s3-profiles.sh
source install/set-up-and-migrate-database.sh
Expand Down
14 changes: 14 additions & 0 deletions install/upgrade-postgres.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
echo "${_group}Ensuring proper PostgreSQL version ..."

postgres_version=$($CONTAINER_ENGINE run --rm -v sentry-postgres:/db busybox sh -c 'if [ -f /db/PG_VERSION ]; then cat /db/PG_VERSION; fi')

if [[ -n "$($CONTAINER_ENGINE volume ls -q --filter name=sentry-postgres)" && "$($CONTAINER_ENGINE run --rm -v sentry-postgres:/db busybox cat /db/PG_VERSION 2>/dev/null)" == "9.6" ]]; then
$CONTAINER_ENGINE volume rm sentry-postgres-new || true
# If this is Postgres 9.6 data, start upgrading it to 14.0 in a new volume
Expand Down Expand Up @@ -41,4 +43,16 @@ if [[ -n "$($CONTAINER_ENGINE volume ls -q --filter name=sentry-postgres)" && "$
$dc stop postgres
fi

# Reindex existing PostgreSQL 14 data once for the glibc 2.36 (Bookworm) -> 2.41 (Trixie) change.
if [[ "$postgres_version" == "14" || -z "$postgres_version" ]]; then
Comment thread
aminvakil marked this conversation as resolved.
needs_reindex=$($CONTAINER_ENGINE run --rm -v sentry-postgres:/db busybox sh -c 'if [ -f /db/PG_VERSION ] && [ ! -f /db/14-trixie-reindexed ]; then echo yes; fi')

start_service_and_wait_ready postgres
if [[ "$needs_reindex" == "yes" ]]; then
echo "Re-indexing due to glibc change, this may take a while..."
$dc exec postgres psql -U postgres -v ON_ERROR_STOP=1 -c "REINDEX DATABASE postgres;"
fi
Comment thread
aminvakil marked this conversation as resolved.
$dc exec postgres sh -c 'touch "$PGDATA/14-trixie-reindexed"'
fi

echo "${_endgroup}"
Loading