Hello community, here is the log from the commit of package pg_cron for openSUSE:Factory checked in at 2019-04-22 12:26:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/pg_cron (Old) and /work/SRC/openSUSE:Factory/.pg_cron.new.5536 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pg_cron" Mon Apr 22 12:26:55 2019 rev:2 rq:696495 version:1.1.4 Changes: -------- --- /work/SRC/openSUSE:Factory/pg_cron/pg_cron.changes 2019-03-13 09:11:42.279408569 +0100 +++ /work/SRC/openSUSE:Factory/.pg_cron.new.5536/pg_cron.changes 2019-04-22 12:26:58.844948016 +0200 @@ -1,0 +2,7 @@ +Sun Apr 21 17:55:20 UTC 2019 - Andrey Karepin <[email protected]> + +- update to 1.1.4 + * Adds a cron.host setting to make the postgres host configurable + * Fixes a bug that could cause segmentation fault after cron.unschedule + +------------------------------------------------------------------- Old: ---- pg_cron-1.1.3.tar.gz New: ---- pg_cron-1.1.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pg_cron.spec ++++++ --- /var/tmp/diff_new_pack.rs5lvM/_old 2019-04-22 12:26:59.380947807 +0200 +++ /var/tmp/diff_new_pack.rs5lvM/_new 2019-04-22 12:26:59.380947807 +0200 @@ -27,7 +27,7 @@ %bcond_with llvm %endif Name: %{pgversion}-%{sname} -Version: 1.1.3 +Version: 1.1.4 Release: 0 Summary: PostgreSQL module for simple job schedule License: PostgreSQL ++++++ pg_cron-1.1.3.tar.gz -> pg_cron-1.1.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pg_cron-1.1.3/CHANGELOG.md new/pg_cron-1.1.4/CHANGELOG.md --- old/pg_cron-1.1.3/CHANGELOG.md 2018-11-15 06:30:35.000000000 +0100 +++ new/pg_cron-1.1.4/CHANGELOG.md 2019-03-31 12:16:20.000000000 +0200 @@ -1,3 +1,8 @@ +### pg_cron v1.1.4 (April 4, 2019) ### + +* Adds a cron.host setting to make the postgres host configurable +* Fixes a bug that could cause segmentation fault after cron.unschedule + ### pg_cron v1.1.3 (November 15, 2018) ### * Fixes a bug that causes pg_cron to run during pg_upgrade diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pg_cron-1.1.3/README.md new/pg_cron-1.1.4/README.md --- old/pg_cron-1.1.3/README.md 2018-11-15 06:30:35.000000000 +0100 +++ new/pg_cron-1.1.4/README.md 2019-03-31 12:16:20.000000000 +0200 @@ -18,7 +18,7 @@ schedule ---------- 43 - + -- Stop scheduling a job SELECT cron.unschedule(43); unschedule @@ -48,21 +48,21 @@ ## Installing pg_cron -Install on Red Hat, CentOS, Fedora, Amazon Linux with PostgreSQL 10: +Install on Red Hat, CentOS, Fedora, Amazon Linux with PostgreSQL 11: ```bash # Add Citus Data package repository curl https://install.citusdata.com/community/rpm.sh | sudo bash # Install the pg_cron extension -sudo yum install -y pg_cron_10 +sudo yum install -y pg_cron_11 ``` -Install on Debian, Ubuntu with PostgreSQL 10 using [apt.postgresql.org](https://wiki.postgresql.org/wiki/Apt): +Install on Debian, Ubuntu with PostgreSQL 11 using [apt.postgresql.org](https://wiki.postgresql.org/wiki/Apt): ```bash # Install the pg_cron extension -sudo apt-get -y install postgresql-10-cron +sudo apt-get -y install postgresql-11-cron ``` You can also install pg_cron by building it from source: @@ -71,7 +71,7 @@ git clone https://github.com/citusdata/pg_cron.git cd pg_cron # Ensure pg_config is in your path, e.g. -export PATH=/usr/pgsql-10/bin:$PATH +export PATH=/usr/pgsql-11/bin:$PATH make && sudo PATH=$PATH make install ``` @@ -87,7 +87,7 @@ cron.database_name = 'postgres' ``` -After restarting PostgreSQL, you can create the pg_cron functions and metadata tables using `CREATE EXTENSION pg_cron`. +After restarting PostgreSQL, you can create the pg_cron functions and metadata tables using `CREATE EXTENSION pg_cron`. ```sql -- run as superuser: @@ -106,7 +106,7 @@ Articles showing possible ways of using pg_cron: * [Auto-partitioning using pg_partman](https://www.citusdata.com/blog/2017/12/27/real-time-analytics-dashboards-with-citus/) -* [Computing rollups in an anlytical dashboard](https://www.citusdata.com/blog/2017/12/27/real-time-analytics-dashboards-with-citus/) +* [Computing rollups in an analytical dashboard](https://www.citusdata.com/blog/2017/12/27/real-time-analytics-dashboards-with-citus/) * [Deleting old data, vacuum](https://www.citusdata.com/blog/2016/09/09/pgcron-run-periodic-jobs-in-postgres/) * [Feeding cats](http://bonesmoses.org/2016/09/09/pg-phriday-irrelevant-inclinations/) @@ -123,7 +123,7 @@ ## Managed services -The following table keeps track of which of the major managed Postgres services support pg_cron. +The following table keeps track of which of the major managed Postgres services support pg_cron. | Service | Supported | Version | | ------------- |:-------------:| --------:| diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pg_cron-1.1.3/include/job_metadata.h new/pg_cron-1.1.4/include/job_metadata.h --- old/pg_cron-1.1.3/include/job_metadata.h 2018-11-15 06:30:35.000000000 +0100 +++ new/pg_cron-1.1.4/include/job_metadata.h 2019-03-31 12:16:20.000000000 +0200 @@ -31,6 +31,7 @@ /* global settings */ +extern char *CronHost; extern bool CronJobCacheValid; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pg_cron-1.1.3/src/job_metadata.c new/pg_cron-1.1.4/src/job_metadata.c --- old/pg_cron-1.1.3/src/job_metadata.c 2018-11-15 06:30:35.000000000 +0100 +++ new/pg_cron-1.1.4/src/job_metadata.c 2019-03-31 12:16:20.000000000 +0200 @@ -78,6 +78,7 @@ static HTAB *CronJobHash = NULL; static Oid CachedCronJobRelationId = InvalidOid; bool CronJobCacheValid = false; +char *CronHost = "localhost"; /* @@ -199,7 +200,7 @@ values[Anum_cron_job_jobid - 1] = jobIdDatum; values[Anum_cron_job_schedule - 1] = CStringGetTextDatum(schedule); values[Anum_cron_job_command - 1] = CStringGetTextDatum(command); - values[Anum_cron_job_nodename - 1] = CStringGetTextDatum("localhost"); + values[Anum_cron_job_nodename - 1] = CStringGetTextDatum(CronHost); values[Anum_cron_job_nodeport - 1] = Int32GetDatum(PostPortNumber); values[Anum_cron_job_database - 1] = CStringGetTextDatum(CronTableDatabaseName); values[Anum_cron_job_username - 1] = CStringGetTextDatum(userName); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pg_cron-1.1.3/src/pg_cron.c new/pg_cron-1.1.4/src/pg_cron.c --- old/pg_cron-1.1.3/src/pg_cron.c 2018-11-15 06:30:35.000000000 +0100 +++ new/pg_cron-1.1.4/src/pg_cron.c 2019-03-31 12:16:20.000000000 +0200 @@ -174,6 +174,15 @@ GUC_SUPERUSER_ONLY, NULL, NULL, NULL); + DefineCustomStringVariable( + "cron.host", + gettext_noop("Hostname to connect to postgres."), + NULL, + &CronHost, + "localhost", + PGC_POSTMASTER, + GUC_SUPERUSER_ONLY, + NULL, NULL, NULL); /* set up common data for all our workers */ worker.bgw_flags = BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION; @@ -395,6 +404,16 @@ { CronTask *task = (CronTask *) lfirst(taskCell); + if (!task->isActive) + { + /* + * The job has been unscheduled, so we should not schedule + * new runs. The task will be safely removed on the next call + * to ManageCronTask. + */ + continue; + } + StartPendingRuns(task, clockProgress, lastMinute, currentTime); } @@ -424,7 +443,6 @@ TimestampTz virtualTime = lastMinute; TimestampTz currentMinute = TimestampMinuteStart(currentTime); - switch (clockProgress) { case CLOCK_PROGRESSED:
