Skip to content

Commit 7cb3e6e

Browse files
committed
chore: stop patching wrappers
1 parent ed36aa1 commit 7cb3e6e

File tree

1 file changed

+0
-54
lines changed
  • ansible/files/admin_api_scripts/pg_upgrade_scripts

1 file changed

+0
-54
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -181,58 +181,6 @@ EOF
181181
done
182182
}
183183

184-
function patch_wrappers {
185-
local IS_NIX_UPGRADE=$1
186-
187-
WRAPPERS_ENABLED=$(run_sql -A -t -c "SELECT EXISTS(SELECT 1 FROM pg_extension WHERE extname = 'wrappers');")
188-
if [ "$WRAPPERS_ENABLED" = "f" ]; then
189-
echo "Wrappers extension not enabled. Skipping."
190-
return
191-
fi
192-
193-
# This is a workaround for older versions of wrappers which don't have the expected
194-
# naming scheme, containing the version in their library's file name
195-
# e.g. wrappers-0.1.16.so, rather than wrappers.so
196-
# pg_upgrade errors out when it doesn't find an equivalent file in the new PG version's
197-
# library directory, so we're making sure the new version has the expected (old version's)
198-
# file name.
199-
# After the upgrade completes, the new version's library file is used.
200-
# i.e.
201-
# - old version: wrappers-0.1.16.so
202-
# - new version: wrappers-0.1.18.so
203-
# - workaround to make pg_upgrade happy: copy wrappers-0.1.18.so to wrappers-0.1.16.so
204-
if [ "$IS_NIX_UPGRADE" = "true" ]; then
205-
if [ -d "$PGLIBOLD" ]; then
206-
OLD_WRAPPER_LIB_PATH=$(find "$PGLIBOLD" -name "wrappers*so" -print -quit)
207-
OLD_LIB_FILE_NAME=$(basename "$OLD_WRAPPER_LIB_PATH")
208-
209-
find /nix/store/ -name "wrappers*so" -print0 | while read -r -d $'\0' WRAPPERS_LIB_PATH; do
210-
if [ -f "$WRAPPERS_LIB_PATH" ]; then
211-
WRAPPERS_LIB_PATH_DIR=$(dirname "$WRAPPERS_LIB_PATH")
212-
if [ "$WRAPPERS_LIB_PATH" != "$WRAPPERS_LIB_PATH_DIR/${OLD_LIB_FILE_NAME}" ]; then
213-
echo "Copying $WRAPPERS_LIB_PATH to $WRAPPERS_LIB_PATH_DIR/${OLD_LIB_FILE_NAME}"
214-
cp "$WRAPPERS_LIB_PATH" "$WRAPPERS_LIB_PATH_DIR/${OLD_LIB_FILE_NAME}" || true
215-
fi
216-
fi
217-
done
218-
fi
219-
else
220-
if [ -d "$PGLIBOLD" ]; then
221-
WRAPPERS_LIB_PATH=$(find "$PGLIBNEW" -name "wrappers*so" -print -quit)
222-
if [ -f "$WRAPPERS_LIB_PATH" ]; then
223-
OLD_WRAPPER_LIB_PATH=$(find "$PGLIBOLD" -name "wrappers*so" -print -quit)
224-
if [ -f "$OLD_WRAPPER_LIB_PATH" ]; then
225-
LIB_FILE_NAME=$(basename "$OLD_WRAPPER_LIB_PATH")
226-
if [ "$WRAPPERS_LIB_PATH" != "$PGLIBNEW/${LIB_FILE_NAME}" ]; then
227-
echo "Copying $WRAPPERS_LIB_PATH to $PGLIBNEW/${LIB_FILE_NAME}"
228-
cp "$WRAPPERS_LIB_PATH" "$PGLIBNEW/${LIB_FILE_NAME}" || true
229-
fi
230-
fi
231-
fi
232-
fi
233-
fi
234-
}
235-
236184
function initiate_upgrade {
237185
mkdir -p "$MOUNT_POINT"
238186
SHARED_PRELOAD_LIBRARIES=$(cat "$POSTGRES_CONFIG_PATH" | grep shared_preload_libraries | sed "s/shared_preload_libraries =\s\{0,1\}'\(.*\)'.*/\1/")
@@ -409,8 +357,6 @@ function initiate_upgrade {
409357
export LD_LIBRARY_PATH="${PGLIBNEW}"
410358
fi
411359

412-
patch_wrappers "$IS_NIX_UPGRADE"
413-
414360
echo "9. Creating new data directory, initializing database"
415361
chown -R postgres:postgres "$MOUNT_POINT/"
416362
rm -rf "${PGDATANEW:?}/"

0 commit comments

Comments
 (0)