pgcentralfoundation / pgrx

Build Postgres Extensions with Rust!
Other
3.55k stars 237 forks source link

Parallel `cargo pgrx package` errors #1798

Open owenthereal opened 1 month ago

owenthereal commented 1 month ago

I'm trying to run multiple pgrx builds against different Postgres versions in parallel with the following (For example for both pg 14 & pg 15):

cargo pgrx init --pg${PG_VERSION} ${PG_CONFIG}
cargo pgrx package --pg-config ${PG_CONFIG} --out-dir ${DESTDIR}

And I got errors like Error: Postgres pg15 is not managed by pgrx. If I run pgrx build once at a time for a pg version, things work fine.

Related: https://github.com/pgxman/pgxman/pull/216 Build logs: https://github.com/pgxman/buildkit/actions/runs/10356208551/job/28665586672

eeeebbbbrrrr commented 1 month ago

You might want to give each job its own $PGRX_HOME as well.

Otherwise, do the init job first, you can specify multiple --pg${PG_VERSION=${PG_CONFIG} paths.

eeeebbbbrrrr commented 1 month ago

I should have explained that if each job shares the same $PGRX_HOME, then they share the same config.toml file, which is created new by each call to cargo pgrx init ....

owenthereal commented 1 month ago

Ah, cool, I didn't know config.toml can be shared for multiple jobs. Thanks for clarifying. Yeah, it would be nice to document this behaviour to avoid multiple parallel jobs sharing the same $PGRX_HOME.

workingjubilee commented 1 month ago

We need to document, diagnose, or change cargo-pgrx to support this without exploding.