-
Notifications
You must be signed in to change notification settings - Fork 11
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
Too much parrallelism creates issues with Grant: tuple concurrently updated #126
Comments
Hi @awoimbee Please can you try and give us some minimal reproducible code that will help us here? Paul |
Hi @stack72, docker run --rm --name postgres -e POSTGRES_PASSWORD=toto -p 5432:5432 -d postgres
export PULUMI_CONFIG_PASSPHRASE=""
pulumi new typescript -y -s poc-tuples-concurrent
cat package.json | jq '.dependencies *= {"@pulumi/postgresql": "^3.1.0"}' > p2 && mv p2 package.json
npm i
pulumi config set postgresql:sslmode disable
pulumi config set postgresql:password toto Contents of import * as pg from "@pulumi/postgresql";
const NB_SCHEMAS = 1;
const NB_GRANTS = 2;
let roles: pg.Role[] = [];
for (let i = 0; i < NB_GRANTS + 1; i += 1) {
roles.push(new pg.Role(`r-${i}`));
}
let schemas: pg.Schema[] = [];
for (let i = 0; i < NB_SCHEMAS; i += 1) {
schemas.push(
new pg.Schema(
`s${i}`,
{
database: "postgres",
name: `s${i}`,
owner: roles[0].name
}
)
);
}
schemas.forEach((s, i) => {
for (let grant = 0; grant < NB_GRANTS; grant += 1) {
new pg.Grant(
`r${grant+1}-${i}`,
{
database: "postgres",
schema: s.name,
objectType: "schema",
privileges: ["USAGE"],
role: roles[grant + 1].name
}
);
}
}); On my machine, 3 roles, 1 schema and 2 grants are enough to trigger the error: import * as pg from "@pulumi/postgresql";
const r0 = new pg.Role("r0");
const r1 = new pg.Role("r1");
const r2 = new pg.Role("r2");
const s = new pg.Schema(`s0`, {
database: "postgres",
name: `s0`,
owner: r0.name
});
const baseGrant = {
database: "postgres",
schema: s.name,
objectType: "schema",
privileges: ["USAGE"]
};
new pg.Grant("g0", {...baseGrant, role: r1.name});
new pg.Grant("g1", {...baseGrant, role: r2.name}); Then, to be 100% sure to trigger the bug, use: |
Looks like this issue still hasn't been resolved downstream: cyrilgdn/terraform-provider-postgresql#178 |
It looks like there is an upstream fix: However it breaks compatibility with CockroachDB, one of our partners: I've requested advice from Cockroach here: |
I just tested against a local PG DB, a case where I would get tons of failures, it's working great ! Thanks ! |
I'm using my pulumi to configure a local postgreSQL instance, it's really fast !
Maybe it's a bit too fast. I get
error: could not execute revoke query: pq: tuple concurrently updated
.To fix the issue, I need to run pulumi with low parallelism (e.g.
pulumi up -p 2
).Steps to reproduce
My stack is quite complex, it seems like is happens when it creates multiple
Grant
(one for a database, another for a schema, ...) to oneRole
. (to improve)Expected: everything works
Actual: error is created, pulumi stops creating resources
Environment
pulumi
:v3.28.0
@pulumi/postgresql
:3.4.0
=> upstream issue: cyrilgdn/terraform-provider-postgresql#178
The text was updated successfully, but these errors were encountered: