-
Notifications
You must be signed in to change notification settings - Fork 442
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
experimental support for pg_anon #9706
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -811,33 +811,6 @@ RUN case "${PG_VERSION}" in \ | |||||||||||||
make -j $(getconf _NPROCESSORS_ONLN) && \ | ||||||||||||||
make -j $(getconf _NPROCESSORS_ONLN) install | ||||||||||||||
|
||||||||||||||
######################################################################################### | ||||||||||||||
# | ||||||||||||||
# Layer "pg-anon-pg-build" | ||||||||||||||
# compile anon extension | ||||||||||||||
# | ||||||||||||||
######################################################################################### | ||||||||||||||
FROM build-deps AS pg-anon-pg-build | ||||||||||||||
ARG PG_VERSION | ||||||||||||||
COPY --from=pg-build /usr/local/pgsql/ /usr/local/pgsql/ | ||||||||||||||
|
||||||||||||||
# This is an experimental extension, never got to real production. | ||||||||||||||
# !Do not remove! It can be present in shared_preload_libraries and compute will fail to start if library is not found. | ||||||||||||||
ENV PATH="/usr/local/pgsql/bin/:$PATH" | ||||||||||||||
RUN case "${PG_VERSION}" in "v17") \ | ||||||||||||||
echo "postgresql_anonymizer does not yet support PG17" && exit 0;; \ | ||||||||||||||
esac && \ | ||||||||||||||
wget https://github.com/neondatabase/postgresql_anonymizer/archive/refs/tags/neon_1.1.1.tar.gz -O pg_anon.tar.gz && \ | ||||||||||||||
echo "321ea8d5c1648880aafde850a2c576e4a9e7b9933a34ce272efc839328999fa9 pg_anon.tar.gz" | sha256sum --check && \ | ||||||||||||||
mkdir pg_anon-src && cd pg_anon-src && tar xzf ../pg_anon.tar.gz --strip-components=1 -C . && \ | ||||||||||||||
find /usr/local/pgsql -type f | sed 's|^/usr/local/pgsql/||' > /before.txt &&\ | ||||||||||||||
make -j $(getconf _NPROCESSORS_ONLN) install PG_CONFIG=/usr/local/pgsql/bin/pg_config && \ | ||||||||||||||
echo 'trusted = true' >> /usr/local/pgsql/share/extension/anon.control && \ | ||||||||||||||
find /usr/local/pgsql -type f | sed 's|^/usr/local/pgsql/||' > /after.txt &&\ | ||||||||||||||
mkdir -p /extensions/anon && cp /usr/local/pgsql/share/extension/anon.control /extensions/anon && \ | ||||||||||||||
sort -o /before.txt /before.txt && sort -o /after.txt /after.txt && \ | ||||||||||||||
comm -13 /before.txt /after.txt | tar --directory=/usr/local/pgsql --zstd -cf /extensions/anon.tar.zst -T - | ||||||||||||||
|
||||||||||||||
######################################################################################### | ||||||||||||||
# | ||||||||||||||
# Layer "rust extensions" | ||||||||||||||
|
@@ -1079,6 +1052,31 @@ RUN wget https://github.com/neondatabase/pg_session_jwt/archive/refs/tags/v0.1.2 | |||||||||||||
sed -i 's/pgrx = "0.12.6"/pgrx = { version = "=0.12.6", features = [ "unsafe-postgres" ] }/g' Cargo.toml && \ | ||||||||||||||
cargo pgrx install --release | ||||||||||||||
|
||||||||||||||
######################################################################################### | ||||||||||||||
# | ||||||||||||||
# Layer "pg-anon-pg-build" | ||||||||||||||
# compile anon extension | ||||||||||||||
# | ||||||||||||||
######################################################################################### | ||||||||||||||
FROM rust-extensions-build-pgrx12 AS pg-anon-pg-build | ||||||||||||||
ARG PG_VERSION | ||||||||||||||
COPY --from=pg-build /usr/local/pgsql/ /usr/local/pgsql/ | ||||||||||||||
|
||||||||||||||
# This is an experimental extension, never got to real production. | ||||||||||||||
# !Do not remove! It can be present in shared_preload_libraries and compute will fail to start if library is not found. | ||||||||||||||
ENV PATH="/usr/local/pgsql/bin/:$PATH" | ||||||||||||||
RUN wget https://github.com/luist18/postgresql_anonymizer/archive/refs/heads/add-guc-hook.tar.gz -O pg_anon.tar.gz && \ | ||||||||||||||
mkdir pg_anon-src && cd pg_anon-src && tar xzf ../pg_anon.tar.gz --strip-components=1 -C . && \ | ||||||||||||||
find /usr/local/pgsql -type f | sed 's|^/usr/local/pgsql/||' > /before.txt && \ | ||||||||||||||
sed -i 's/pgrx = "0.12.6"/pgrx = { version = "=0.12.6", features = [ "unsafe-postgres" ] }/g' Cargo.toml && \ | ||||||||||||||
make -j $(getconf _NPROCESSORS_ONLN) extension PG_CONFIG=/usr/local/pgsql/bin/pg_config PGVER=pg$(echo "$PG_VERSION" | sed 's/^v//') && \ | ||||||||||||||
make -j $(getconf _NPROCESSORS_ONLN) install PG_CONFIG=/usr/local/pgsql/bin/pg_config PGVER=pg$(echo "$PG_VERSION" | sed 's/^v//') && \ | ||||||||||||||
echo 'trusted = true' >> /usr/local/pgsql/share/extension/anon.control && \ | ||||||||||||||
find /usr/local/pgsql -type f | sed 's|^/usr/local/pgsql/||' > /after.txt &&\ | ||||||||||||||
mkdir -p /extensions/anon && cp /usr/local/pgsql/share/extension/anon.control /extensions/anon && \ | ||||||||||||||
sort -o /before.txt /before.txt && sort -o /after.txt /after.txt && \ | ||||||||||||||
comm -13 /before.txt /after.txt | tar --directory=/usr/local/pgsql --zstd -cf /extensions/anon.tar.zst -T - | ||||||||||||||
Comment on lines
+1074
to
+1078
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 4 lines are not necessary (they were added to make anon a "custom" extension, which lives in a separate repo; here, it's a no-op); we can remove them.
Suggested change
|
||||||||||||||
|
||||||||||||||
######################################################################################### | ||||||||||||||
# | ||||||||||||||
# Layer "wal2json-build" | ||||||||||||||
|
@@ -1403,8 +1401,7 @@ COPY --from=pg-roaringbitmap-pg-build /pg_roaringbitmap.tar.gz /ext-src | |||||||||||||
COPY --from=pg-semver-pg-build /pg_semver.tar.gz /ext-src | ||||||||||||||
#COPY --from=pg-embedding-pg-build /home/nonroot/pg_embedding-src/ /ext-src | ||||||||||||||
#COPY --from=wal2json-pg-build /wal2json_2_5.tar.gz /ext-src | ||||||||||||||
COPY --from=pg-anon-pg-build /pg_anon.tar.gz /ext-src | ||||||||||||||
COPY compute/patches/pg_anon.patch /ext-src | ||||||||||||||
#COPY --from=pg-anon-pg-build /pg_anon.tar.gz /ext-src | ||||||||||||||
COPY --from=pg-ivm-build /pg_ivm.tar.gz /ext-src | ||||||||||||||
COPY --from=pg-partman-build /pg_partman.tar.gz /ext-src | ||||||||||||||
RUN case "${PG_VERSION}" in "v17") \ | ||||||||||||||
|
@@ -1427,10 +1424,6 @@ RUN case "${PG_VERSION}" in "v17") \ | |||||||||||||
esac && \ | ||||||||||||||
cd /ext-src/pg_hint_plan-src && patch -p1 < /ext-src/pg_hint_plan.patch | ||||||||||||||
COPY --chmod=755 docker-compose/run-tests.sh /run-tests.sh | ||||||||||||||
RUN case "${PG_VERSION}" in "v17") \ | ||||||||||||||
echo "v17 extensions are not supported yet. Quit" && exit 0;; \ | ||||||||||||||
esac && \ | ||||||||||||||
patch -p1 </ext-src/pg_anon.patch | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably can delete the patch as well |
||||||||||||||
RUN case "${PG_VERSION}" in "v17") \ | ||||||||||||||
echo "v17 extensions are not supported yet. Quit" && exit 0;; \ | ||||||||||||||
esac && \ | ||||||||||||||
|
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.
Just a note, that this should be moved to
neondatabase-labs
/neondatabase
before merging (and preferably tagged / used from a commit hash)