Required actions when updating the operating system

Updating the server operating system requires reindexing PostgreSQL databases.

Reason: due to the way PostgreSQL works, when the OS is updated, the version of the glibc system library, which is responsible for the Collation sorting settings in PostgreSQL, changes. This may result in duplicate values on unique indexes. Duplicates violate the integrity of the data and can cause errors in the server’s operation - for example, the spooler freezes due to the accumulation of messages about duplicates in the logs.

Solution: When upgrading your OS, upgrade Collation for PostgreSQL 15 and reindex the database for all versions of PostgreSQL.

Procedure for updating the OS:

  1. Stop iBatyr Monitor.

sudo ibatyr stop
sudo systemctl disable ibatyr
  1. Update your operating system according to your process.

  2. PostgreSQL 15 only: Update Collation collation settings.

echo "ALTER DATABASE postgres REFRESH COLLATION VERSION;" | sudo -u postgres psql -d postgres
echo "ALTER DATABASE template1 REFRESH COLLATION VERSION;" | sudo -u postgres psql -d template1
echo "ALTER DATABASE ibatyr REFRESH COLLATION VERSION;" | sudo -u postgres psql -d ibatyr
  1. For all PostgreSQL versions: Reindex the database.

echo "REINDEX (VERBOSE) DATABASE postgres" | sudo -u postgres psql -d postgres
echo "REINDEX (VERBOSE) DATABASE template1" | sudo -u postgres psql -d template1
echo "REINDEX (VERBOSE) DATABASE ibatyr" | sudo -u postgres psql -d ibatyr
  1. Launch iBatyr Monitor.

sudo systemctl enable ibatyr
sudo ibatyr start
  1. Ready!