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

Use regrole for job owner #5558

Merged
merged 1 commit into from
Apr 18, 2023
Merged

Conversation

mkindahl
Copy link
Contributor

@mkindahl mkindahl commented Apr 12, 2023

Instead of using a user name to register the owner of a job, we use
regrole. This allows renames to work properly since the underlying OID
does not change when the owner name changes.

We add a check when calling DROP ROLE that there is no job with that
owner and generate an error if there is.

Fixes #5511
Fixes #5574

@mkindahl mkindahl force-pushed the rename-job-owner branch 4 times, most recently from d858c87 to 80e78c8 Compare April 13, 2023 11:44
@codecov
Copy link

codecov bot commented Apr 13, 2023

Codecov Report

Merging #5558 (fed894c) into main (20db884) will decrease coverage by 0.21%.
The diff coverage is 95.23%.

@@            Coverage Diff             @@
##             main    #5558      +/-   ##
==========================================
- Coverage   90.58%   90.37%   -0.21%     
==========================================
  Files         229      229              
  Lines       47474    53993    +6519     
==========================================
+ Hits        43004    48797    +5793     
- Misses       4470     5196     +726     
Impacted Files Coverage Δ
src/ts_catalog/catalog.h 100.00% <ø> (ø)
src/process_utility.c 94.39% <93.75%> (-0.36%) ⬇️
src/bgw/job.c 93.54% <100.00%> (-0.31%) ⬇️
src/bgw/scheduler.c 85.64% <100.00%> (-3.25%) ⬇️
tsl/src/bgw_policy/compression_api.c 83.47% <100.00%> (-2.85%) ⬇️
tsl/src/bgw_policy/continuous_aggregate_api.c 93.07% <100.00%> (-0.42%) ⬇️
tsl/src/bgw_policy/job_api.c 97.67% <100.00%> (+0.19%) ⬆️
tsl/src/bgw_policy/reorder_api.c 93.93% <100.00%> (-0.94%) ⬇️
tsl/src/bgw_policy/retention_api.c 92.51% <100.00%> (-1.65%) ⬇️

... and 196 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mkindahl mkindahl force-pushed the rename-job-owner branch 18 times, most recently from 17aaaf2 to f6bf130 Compare April 14, 2023 12:00
@mkindahl mkindahl marked this pull request as ready for review April 14, 2023 13:34
@github-actions
Copy link

@mahipv, @lkshminarayanan: please review this pull request.

Powered by pull-review

@mkindahl mkindahl force-pushed the rename-job-owner branch 4 times, most recently from 3fecab0 to 637ff8d Compare April 15, 2023 10:07
Instead of using a user name to register the owner of a job, we use
regrole. This allows renames to work properly since the underlying OID
does not change when the owner name changes.

We add a check when calling `DROP ROLE` that there is no job with that
owner and generate an error if there is.
@mkindahl mkindahl added bug bgw The background worker subsystem, including the scheduler labels Apr 18, 2023
@mkindahl mkindahl merged commit 9a64385 into timescale:main Apr 18, 2023
@mkindahl mkindahl deleted the rename-job-owner branch April 18, 2023 06:58
@timescale-automation
Copy link

Automated backport to 2.10.x not done: cherry-pick failed.

Git status

HEAD detached at origin/2.10.x
You are currently cherry-picking commit 9a64385f.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   CHANGELOG.md
	modified:   sql/job_error_log_retention.sql
	modified:   sql/pre_install/tables.sql
	modified:   sql/with_telemetry.sql
	modified:   src/bgw/job.c
	modified:   src/bgw/job.h
	modified:   src/bgw/scheduler.c
	modified:   src/process_utility.c
	modified:   src/ts_catalog/catalog.h
	modified:   test/expected/telemetry.out
	modified:   tsl/src/bgw_policy/compression_api.c
	modified:   tsl/src/bgw_policy/continuous_aggregate_api.c
	modified:   tsl/src/bgw_policy/job_api.c
	modified:   tsl/src/bgw_policy/reorder_api.c
	modified:   tsl/src/bgw_policy/retention_api.c
	modified:   tsl/test/expected/bgw_custom.out
	modified:   tsl/test/expected/bgw_db_scheduler.out
	modified:   tsl/test/expected/bgw_db_scheduler_fixed.out
	modified:   tsl/test/sql/bgw_custom.sql
	modified:   tsl/test/sql/bgw_db_scheduler.sql
	modified:   tsl/test/sql/bgw_db_scheduler_fixed.sql

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   sql/updates/latest-dev.sql
	both modified:   sql/updates/reverse-dev.sql


Job log

@timescale-automation timescale-automation added the auto-backport-not-done Automated backport of this PR has failed non-retriably (e.g. conflicts) label Apr 19, 2023
akuzm added a commit to akuzm/timescaledb that referenced this pull request Apr 19, 2023
 ## 2.10.2 (2023-04-20)

**Bugfixes**
* timescale#5410 Fix file trailer handling in the COPY fetcher
* timescale#5446 Add checks for malloc failure in libpq calls
* timescale#5233 Out of on_proc_exit slots on guc license change
* timescale#5428 Use consistent snapshots when scanning metadata
* timescale#5499 Do not segfault on large histogram() parameters
* timescale#5470 Ensure superuser perms during copy/move chunk
* timescale#5500 Fix when no FROM clause in continuous aggregate definition
* timescale#5433 Fix join rte in CAggs with joins
* timescale#5556 Fix duplicated entries on timescaledb_experimental.policies view
* timescale#5462 Fix segfault after column drop on compressed table
* timescale#5543 Copy scheduled_jobs list before sorting it
* timescale#5497 Allow named time_bucket arguments in Cagg definition
* timescale#5544 Fix refresh from beginning of Continuous Aggregate with variable time bucket
* timescale#5558 Use regrole for job owner
* timescale#5542 Enable indexscan on uncompressed part of partially compressed chunks

**Thanks**
* @nikolaps for reporting an issue with the COPY fetcher
* @S-imo-n for reporting the issue on Background Worker Scheduler crash
* @geezhu for reporting issue on segfault in historgram()
* @mwahlhuetter for reporting the issue with joins in CAggs
* @mwahlhuetter for reporting issue with duplicated entries on timescaledb_experimental.policies view
* @H25E for reporting error refreshing from beginning of a Continuous Aggregate with variable time bucket
akuzm added a commit that referenced this pull request Apr 19, 2023
 ## 2.10.2 (2023-04-20)

**Bugfixes**
* #5410 Fix file trailer handling in the COPY fetcher
* #5446 Add checks for malloc failure in libpq calls
* #5233 Out of on_proc_exit slots on guc license change
* #5428 Use consistent snapshots when scanning metadata
* #5499 Do not segfault on large histogram() parameters
* #5470 Ensure superuser perms during copy/move chunk
* #5500 Fix when no FROM clause in continuous aggregate definition
* #5433 Fix join rte in CAggs with joins
* #5556 Fix duplicated entries on timescaledb_experimental.policies view
* #5462 Fix segfault after column drop on compressed table
* #5543 Copy scheduled_jobs list before sorting it
* #5497 Allow named time_bucket arguments in Cagg definition
* #5544 Fix refresh from beginning of Continuous Aggregate with variable time bucket
* #5558 Use regrole for job owner
* #5542 Enable indexscan on uncompressed part of partially compressed chunks

**Thanks**
* @nikolaps for reporting an issue with the COPY fetcher
* @S-imo-n for reporting the issue on Background Worker Scheduler crash
* @geezhu for reporting issue on segfault in historgram()
* @mwahlhuetter for reporting the issue with joins in CAggs
* @mwahlhuetter for reporting issue with duplicated entries on timescaledb_experimental.policies view
* @H25E for reporting error refreshing from beginning of a Continuous Aggregate with variable time bucket
akuzm added a commit that referenced this pull request Apr 19, 2023
 ## 2.10.2 (2023-04-20)

**Bugfixes**
* #5410 Fix file trailer handling in the COPY fetcher
* #5446 Add checks for malloc failure in libpq calls
* #5233 Out of on_proc_exit slots on guc license change
* #5428 Use consistent snapshots when scanning metadata
* #5499 Do not segfault on large histogram() parameters
* #5470 Ensure superuser perms during copy/move chunk
* #5500 Fix when no FROM clause in continuous aggregate definition
* #5433 Fix join rte in CAggs with joins
* #5556 Fix duplicated entries on timescaledb_experimental.policies view
* #5462 Fix segfault after column drop on compressed table
* #5543 Copy scheduled_jobs list before sorting it
* #5497 Allow named time_bucket arguments in Cagg definition
* #5544 Fix refresh from beginning of Continuous Aggregate with variable time bucket
* #5558 Use regrole for job owner
* #5542 Enable indexscan on uncompressed part of partially compressed chunks

**Thanks**
* @nikolaps for reporting an issue with the COPY fetcher
* @S-imo-n for reporting the issue on Background Worker Scheduler crash
* @geezhu for reporting issue on segfault in historgram()
* @mwahlhuetter for reporting the issue with joins in CAggs
* @mwahlhuetter for reporting issue with duplicated entries on timescaledb_experimental.policies view
* @H25E for reporting error refreshing from beginning of a Continuous Aggregate with variable time bucket
akuzm added a commit that referenced this pull request Apr 19, 2023
 ## 2.10.2 (2023-04-20)

**Bugfixes**
* #5410 Fix file trailer handling in the COPY fetcher
* #5446 Add checks for malloc failure in libpq calls
* #5233 Out of on_proc_exit slots on guc license change
* #5428 Use consistent snapshots when scanning metadata
* #5499 Do not segfault on large histogram() parameters
* #5470 Ensure superuser perms during copy/move chunk
* #5500 Fix when no FROM clause in continuous aggregate definition
* #5433 Fix join rte in CAggs with joins
* #5556 Fix duplicated entries on timescaledb_experimental.policies view
* #5462 Fix segfault after column drop on compressed table
* #5543 Copy scheduled_jobs list before sorting it
* #5497 Allow named time_bucket arguments in Cagg definition
* #5544 Fix refresh from beginning of Continuous Aggregate with variable time bucket
* #5558 Use regrole for job owner
* #5542 Enable indexscan on uncompressed part of partially compressed chunks

**Thanks**
* @nikolaps for reporting an issue with the COPY fetcher
* @S-imo-n for reporting the issue on Background Worker Scheduler crash
* @geezhu for reporting issue on segfault in historgram()
* @mwahlhuetter for reporting the issue with joins in CAggs
* @mwahlhuetter for reporting issue with duplicated entries on timescaledb_experimental.policies view
* @H25E for reporting error refreshing from beginning of a Continuous Aggregate with variable time bucket
akuzm added a commit to akuzm/timescaledb that referenced this pull request Apr 19, 2023
 ## 2.10.2 (2023-04-20)

**Bugfixes**
* timescale#5410 Fix file trailer handling in the COPY fetcher
* timescale#5446 Add checks for malloc failure in libpq calls
* timescale#5233 Out of on_proc_exit slots on guc license change
* timescale#5428 Use consistent snapshots when scanning metadata
* timescale#5499 Do not segfault on large histogram() parameters
* timescale#5470 Ensure superuser perms during copy/move chunk
* timescale#5500 Fix when no FROM clause in continuous aggregate definition
* timescale#5433 Fix join rte in CAggs with joins
* timescale#5556 Fix duplicated entries on timescaledb_experimental.policies view
* timescale#5462 Fix segfault after column drop on compressed table
* timescale#5543 Copy scheduled_jobs list before sorting it
* timescale#5497 Allow named time_bucket arguments in Cagg definition
* timescale#5544 Fix refresh from beginning of Continuous Aggregate with variable time bucket
* timescale#5558 Use regrole for job owner
* timescale#5542 Enable indexscan on uncompressed part of partially compressed chunks

**Thanks**
* @nikolaps for reporting an issue with the COPY fetcher
* @S-imo-n for reporting the issue on Background Worker Scheduler crash
* @geezhu for reporting issue on segfault in historgram()
* @mwahlhuetter for reporting the issue with joins in CAggs
* @mwahlhuetter for reporting issue with duplicated entries on timescaledb_experimental.policies view
* @H25E for reporting error refreshing from beginning of a Continuous Aggregate with variable time bucket
akuzm added a commit that referenced this pull request Apr 20, 2023
 ## 2.10.2 (2023-04-20)

**Bugfixes**
* #5410 Fix file trailer handling in the COPY fetcher
* #5446 Add checks for malloc failure in libpq calls
* #5233 Out of on_proc_exit slots on guc license change
* #5428 Use consistent snapshots when scanning metadata
* #5499 Do not segfault on large histogram() parameters
* #5470 Ensure superuser perms during copy/move chunk
* #5500 Fix when no FROM clause in continuous aggregate definition
* #5433 Fix join rte in CAggs with joins
* #5556 Fix duplicated entries on timescaledb_experimental.policies view
* #5462 Fix segfault after column drop on compressed table
* #5543 Copy scheduled_jobs list before sorting it
* #5497 Allow named time_bucket arguments in Cagg definition
* #5544 Fix refresh from beginning of Continuous Aggregate with variable time bucket
* #5558 Use regrole for job owner
* #5542 Enable indexscan on uncompressed part of partially compressed chunks

**Thanks**
* @nikolaps for reporting an issue with the COPY fetcher
* @S-imo-n for reporting the issue on Background Worker Scheduler crash
* @geezhu for reporting issue on segfault in historgram()
* @mwahlhuetter for reporting the issue with joins in CAggs
* @mwahlhuetter for reporting issue with duplicated entries on timescaledb_experimental.policies view
* @H25E for reporting error refreshing from beginning of a Continuous Aggregate with variable time bucket
akuzm added a commit that referenced this pull request Apr 20, 2023
 ## 2.10.2 (2023-04-20)

**Bugfixes**
* #5410 Fix file trailer handling in the COPY fetcher
* #5446 Add checks for malloc failure in libpq calls
* #5233 Out of on_proc_exit slots on guc license change
* #5428 Use consistent snapshots when scanning metadata
* #5499 Do not segfault on large histogram() parameters
* #5470 Ensure superuser perms during copy/move chunk
* #5500 Fix when no FROM clause in continuous aggregate definition
* #5433 Fix join rte in CAggs with joins
* #5556 Fix duplicated entries on timescaledb_experimental.policies view
* #5462 Fix segfault after column drop on compressed table
* #5543 Copy scheduled_jobs list before sorting it
* #5497 Allow named time_bucket arguments in Cagg definition
* #5544 Fix refresh from beginning of Continuous Aggregate with variable time bucket
* #5558 Use regrole for job owner
* #5542 Enable indexscan on uncompressed part of partially compressed chunks

**Thanks**
* @nikolaps for reporting an issue with the COPY fetcher
* @S-imo-n for reporting the issue on Background Worker Scheduler crash
* @geezhu for reporting issue on segfault in historgram()
* @mwahlhuetter for reporting the issue with joins in CAggs
* @mwahlhuetter for reporting issue with duplicated entries on timescaledb_experimental.policies view
* @H25E for reporting error refreshing from beginning of a Continuous Aggregate with variable time bucket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport-not-done Automated backport of this PR has failed non-retriably (e.g. conflicts) backported-2.10.x bgw The background worker subsystem, including the scheduler bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Scheduler stops working if owner is dropped [Bug]: Scheduler stops working if a job owner is renamed
4 participants