Skip to content
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

Fix bug with invalidation of CachedCronJobRelationId #346

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

CyberDem0n
Copy link
Contributor

@CyberDem0n CyberDem0n commented Aug 9, 2024

The callback was registered only for bgworker and as a result client backends were failing to unschedule jobs if the extension was droped and recreated in the same session:

CREATE EXTENSION pg_cron;
SELECT cron.schedule('0 10 * * *', 'VACUUM');
SELECT cron.unschedule(1);
DROP EXTENSION pg_cron;
CREATE EXTENSION pg_cron;
SELECT cron.schedule('0 10 * * *', 'VACUUM');
SELECT cron.unschedule(1);
ERROR:  could not open relation with OID 16388

Update, just found out that this issue is already discovered (#344) and there is a fix (#345) that takes different approach.

The callback was registered only for bgworker and as a result client
backends were failing to unschedule jobs if the extension was droped and
recreated in the same session:
```
CREATE EXTENSION pg_cron;
SELECT cron.schedule('0 10 * * *', 'VACUUM');
SELECT cron.unschedule(1);
DROP EXTENSION pg_cron;
CREATE EXTENSION pg_cron;
SELECT cron.schedule('0 10 * * *', 'VACUUM');
SELECT cron.unschedule(1);
ERROR:  could not open relation with OID 16388
```
@marcoslot
Copy link
Collaborator

Thanks!

@marcoslot marcoslot merged commit e5eb77e into main Aug 9, 2024
1 check passed
@marcoslot marcoslot deleted the bugfix/job-cache-invalidation branch August 9, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants