-
Notifications
You must be signed in to change notification settings - Fork 217
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
Upgrade flow for images RHEL/CentOS 8+ #562
Conversation
[test] |
@@ -297,7 +297,7 @@ function wait_for_postgresql_master() { | |||
run_pgupgrade () | |||
( | |||
# Remove .pid file if the file persists after ugly shut down | |||
if [ -f "$PGDATA/postmaster.pid" ] && ! pgrep -f "postgres" > /dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you removing the condition? We do not want to remove .pid
file of the running process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I removed it because I had some issues when I was testing the upgrade. I will look into it deeper.
we should check if the PID is up first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this is from a running container I added a stop before the line
seem that the service is not running, also there isn't any open socket
I'm assuming the it is partially match run-postgresql
bash-4.4$ pgrep -f "postgres"
1
17
ps -ef
UID PID PPID C STIME TTY TIME CMD
postgres 1 0 0 12:18 pts/0 00:00:00 /bin/bash /usr/bin/run-postgresql
postgres 17 1 0 12:18 pts/0 00:00:00 /bin/bash /usr/bin/run-postgresql
postgres 18 17 0 12:18 pts/0 00:00:00 /usr/bin/coreutils --coreutils-prog-shebang
postgres 19 0 0 12:19 pts/1 00:00:00 bash
postgres 27 19 0 12:22 pts/1 00:00:00 ps -ef
how about
if [ -f "$PGDATA/postmaster.pid" ] && ! pgrep -f "postgres" > /dev/null; then | |
if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense +1
@@ -352,7 +352,6 @@ run_pgupgrade () | |||
info_msg "Starting old postgresql once again for a clean shutdown..." | |||
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h ''" | |||
info_msg "Waiting for postgresql to be ready for shutdown again..." | |||
"${old_pgengine}/pg_isready" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you removing this safety procedure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my testing it returned exit code 2 - I did manual checks the socket was up and running but the pg_isready
wasn't catching it.
On the above line we use -w
which is waiting for the DB to be ready. I thought maybe we don't need to double check it unless there is another reason for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after some searching, It seems we start the server as local only -- which mean it doesn't create a TCP port instead it creates a Linux socket.
the 'pg_isready' tries the port and fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
if test "$old_raw_version" = 92; then | ||
old_collection=postgresql92 | ||
else | ||
old_collection=rh-postgresql$old_raw_version | ||
old_collection=postgresql-$old_raw_version | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not correspond with the current state of PostgreSQL rpm names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
Overall, it looks good. Thank you for your contribution. We will need to generalize it and implement it in the master branch. |
13/Dockerfile.c8s
Outdated
@@ -44,7 +44,8 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions | |||
RUN yum -y module enable postgresql:13 && \ | |||
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \ | |||
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \ | |||
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \ | |||
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \ | |||
yum -y --setopt=tsflags=nodocs --setopt=install_weak_deps=false install $INSTALL_PKGS && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What difference in packages is there when using this option? I would rather not introduce it for already built image versions if the change is too disruptive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it not a must, it removes about 100MB of size - those are packages that are extra doesn't change / affect the core application
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the existing images, I would choose the more defensive approach. I would just add the necessary packages.
I've issue fixes for all the remarks |
@@ -311,8 +311,8 @@ run_pgupgrade () | |||
old_collection=rh-postgresql$old_raw_version | |||
fi | |||
|
|||
old_pgengine=/opt/rh/$old_collection/root/usr/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be changed only for RHEL8+ images. The general change would cause problems in rhel7/centos7 containers. Condition needed in distgen source files.
@@ -312,7 +312,7 @@ run_pgupgrade () | |||
old_collection=rh-postgresql$old_raw_version | |||
fi | |||
|
|||
old_pgengine=/opt/rh/$old_collection/root/usr/bin | |||
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin | |||
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/usr/bin
?
It makes a good impression on me. Please implement the changes into |
[test] |
cc @danmanor |
LGTM, but there is dist-gen issue |
@phracek would it be possible to enable this test also for RHEL8+ ? postgresql-container/test/run_test Line 682 in d0cecca
|
[test] |
Hi, Thanks for the PR! I've got a couple of general commentaries about PostgreSQL
|
[test] |
3 similar comments
[test] |
[test] |
[test] |
So this may be an postgresql[1] issue which is present only when using newer openssl (3.2.1) that got into c9s, but not into rhel9 yet. postgresql upstream patch seeems to exist already, more info is in the linked mailing thread[1]. |
sorry for the delay, I was on PTO |
No problem at all. Just note that c8s images will be deprecated on May the 31th. So no need to work further on them I guess. (This PR needs to merged first: #567) |
[test] |
I tested RHEL8 failed cases locally and it works, c9s fails are known issues so I would merge it. @eifrach could you please confirm my observation to be sure before merge? |
yes it works for me - also I've tested the data migration |
Add postgresql16-upgrade package into fedora dockerfile
Creating flow for upgrading postgresSQL
install_weak_deps=false
to installation which reduce the image sizepostgresql-upgrade
package for the upgrade