Skip to content

Commit bb39d81

Browse files
retain multiple minor versions of timescaledb (#1087)
Co-authored-by: Polina Bungina <27892524+hughcapet@users.noreply.github.com>
1 parent 0517b88 commit bb39d81

File tree

1 file changed

+8
-9
lines changed
  • postgres-appliance/build_scripts

1 file changed

+8
-9
lines changed

postgres-appliance/build_scripts/base.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,15 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do
121121
"postgresql-${version}-pg-stat-kcache" \
122122
"${EXTRAS[@]}"
123123

124-
# Clean up timescaledb versions except the highest compatible and transition version
124+
# Clean up timescaledb versions except the last 5 minor versions
125125
exclude_patterns=()
126-
prev_highest_ver="$ts_highest_ver"
127-
ts_highest_ver=$(find "/usr/lib/postgresql/$version/lib/" -name 'timescaledb-2.*.so' | sed -rn 's/.*timescaledb-([1-9]+\.[0-9]+\.[0-9]+)\.so$/\1/p' | sort -rV | head -n1)
128-
if [ "$prev_highest_ver" != "$ts_highest_ver" ]; then
129-
ts_transition_version="$prev_highest_ver"
130-
fi
131-
for ts_version in "$ts_transition_version" "$ts_highest_ver"; do
132-
exclude_patterns+=(! -name timescaledb-"${ts_version}".so)
133-
exclude_patterns+=(! -name timescaledb-tsl-"${ts_version}".so)
126+
versions=$(find "/usr/lib/postgresql/$version/lib/" -name 'timescaledb-2.*.so' | sed -rn 's/.*timescaledb-([1-9]+\.[0-9]+\.[0-9]+)\.so$/\1/p' | sort -rV)
127+
latest_minor_versions=$(echo "$versions" | awk -F. '{print $1"."$2}' | uniq | head -n 5)
128+
for minor in $latest_minor_versions; do
129+
for full_version in $(echo "$versions" | grep "^$minor"); do
130+
exclude_patterns+=(! -name timescaledb-"${full_version}".so)
131+
exclude_patterns+=(! -name timescaledb-tsl-"${full_version}".so)
132+
done
134133
done
135134
find "/usr/lib/postgresql/$version/lib/" \( -name 'timescaledb-2.*.so' -o -name 'timescaledb-tsl-2.*.so' \) "${exclude_patterns[@]}" -delete
136135

0 commit comments

Comments
 (0)