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

Add support for DROP SCHEMA on multi-node #3949

Merged
merged 1 commit into from
Dec 23, 2021

Conversation

pmwkaa
Copy link
Contributor

@pmwkaa pmwkaa commented Dec 22, 2021

This PR changes logic and allows DROP SCHEMA command to be executed
on each data node, even if the schema being dropped has no distributed
hypertables in it.

Fix: #3909

@pmwkaa pmwkaa requested a review from a team as a code owner December 22, 2021 11:28
@pmwkaa pmwkaa requested review from berkley, mkindahl and svenklemm and removed request for a team December 22, 2021 11:28
@pmwkaa pmwkaa self-assigned this Dec 22, 2021
@codecov
Copy link

codecov bot commented Dec 22, 2021

Codecov Report

Merging #3949 (894c004) into master (a7dedf8) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3949      +/-   ##
==========================================
- Coverage   90.74%   90.73%   -0.01%     
==========================================
  Files         213      213              
  Lines       38459    38466       +7     
==========================================
+ Hits        34898    34904       +6     
- Misses       3561     3562       +1     
Impacted Files Coverage Δ
tsl/src/remote/dist_ddl.c 96.45% <100.00%> (+0.06%) ⬆️
tsl/src/nodes/data_node_dispatch.c 97.10% <0.00%> (-0.25%) ⬇️
tsl/src/bgw_policy/job.c 88.01% <0.00%> (-0.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7dedf8...894c004. Read the comment docs.

Comment on lines +371 to 373
/* For DROP TABLE and DROP SCHEMA operations hypertable_list will be empty */
if (list_length(args->hypertable_list) == 0)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the hypertable_list is not empty, and removeType == OBJECT_TABLE, what would that mean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or what does the default branch in the following switch/case means... looks like this needs more assertions/comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe hypertable can't be added into the hypertable list, because drop operation is already happened by PostgreSQL standard hook (src/process_utility.c) at this point and it can't be resolved

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be an Assert then, with this explanation as a comment?

Comment on lines +381 to +382
/* Forward DROP SCHEMA command to all data nodes, following
* sql_drop events will be ignored */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A completely clueless question: why do we have to execute DROP SCHEMA immediately, in contrast to DROP TABLE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we did not support CREATE SCHEMA explicitly on data nodes and whenDROP SCHEMA CASCADE was executed, we only shipped it by analyzing distributed hypertables which we part of that schema. No it is much simpler, we assume schema exists on all data nodes and we can drop it right away.

Copy link
Member

@akuzm akuzm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand the code but the tests make sense.

This PR changes logic and allows DROP SCHEMA command to be executed
on each data node, even if the schema being dropped has no distributed
hypertables in it.

Fix: timescale#3909
@pmwkaa pmwkaa merged commit 24d9243 into timescale:master Dec 23, 2021
akuzm added a commit to akuzm/timescaledb that referenced this pull request Feb 17, 2022
This release is medium priority for upgrade. We recommend that you
upgrade at the next available opportunity.

This release adds major new features since the 2.5.2 release,
including:

Compression in continuous aggregates Experimental support for timezones
in continuous aggregates Experimental support for monthly buckets in
continuous aggregates It also includes several bug fixes. Telemetry
reports are switched to a new format, and now include more detailed
statistics on compression, distributed hypertables and indexes.

**Features**

* timescale#3768 Allow ALTER TABLE ADD COLUMN with DEFAULT on compressed
hypertable
* timescale#3769 Allow ALTER TABLE DROP COLUMN on compressed hypertable
* timescale#3943 Optimize first/last
* timescale#3945 Add support for ALTER SCHEMA on multi-node
* timescale#3949 Add support for DROP SCHEMA on multi-node

**Bugfixes**

* timescale#3808 Properly handle max_retries option
* timescale#3863 Fix remote transaction heal logic
* timescale#3869 Fix ALTER SET/DROP NULL contstraint on distributed hypertable
* timescale#3944 Fix segfault in add_compression_policy
* timescale#3961 Fix crash in EXPLAIN VERBOSE on distributed hypertable
* timescale#4015 Eliminate float rounding instabilities in interpolate
* timescale#4019 Update ts_extension_oid in transitioning state
* timescale#4073 Fix buffer overflow in partition scheme

**Improvements**

Query planning performance is improved for hypertables with a large
number of chunks.

**Thanks**

* @fvannee for reporting a first/last memory leak
* @mmouterde for reporting an issue with floats and interpolate
akuzm added a commit that referenced this pull request Feb 17, 2022
This release is medium priority for upgrade. We recommend that you
upgrade at the next available opportunity.

This release adds major new features since the 2.5.2 release,
including:

Compression in continuous aggregates Experimental support for timezones
in continuous aggregates Experimental support for monthly buckets in
continuous aggregates It also includes several bug fixes. Telemetry
reports are switched to a new format, and now include more detailed
statistics on compression, distributed hypertables and indexes.

**Features**

* #3768 Allow ALTER TABLE ADD COLUMN with DEFAULT on compressed
hypertable
* #3769 Allow ALTER TABLE DROP COLUMN on compressed hypertable
* #3943 Optimize first/last
* #3945 Add support for ALTER SCHEMA on multi-node
* #3949 Add support for DROP SCHEMA on multi-node

**Bugfixes**

* #3808 Properly handle max_retries option
* #3863 Fix remote transaction heal logic
* #3869 Fix ALTER SET/DROP NULL contstraint on distributed hypertable
* #3944 Fix segfault in add_compression_policy
* #3961 Fix crash in EXPLAIN VERBOSE on distributed hypertable
* #4015 Eliminate float rounding instabilities in interpolate
* #4019 Update ts_extension_oid in transitioning state
* #4073 Fix buffer overflow in partition scheme

**Improvements**

Query planning performance is improved for hypertables with a large
number of chunks.

**Thanks**

* @fvannee for reporting a first/last memory leak
* @mmouterde for reporting an issue with floats and interpolate
svenklemm pushed a commit that referenced this pull request Feb 17, 2022
This release is medium priority for upgrade. We recommend that you
upgrade at the next available opportunity.

This release adds major new features since the 2.5.2 release,
including:

Compression in continuous aggregates Experimental support for timezones
in continuous aggregates Experimental support for monthly buckets in
continuous aggregates It also includes several bug fixes. Telemetry
reports are switched to a new format, and now include more detailed
statistics on compression, distributed hypertables and indexes.

**Features**

* #3768 Allow ALTER TABLE ADD COLUMN with DEFAULT on compressed
hypertable
* #3769 Allow ALTER TABLE DROP COLUMN on compressed hypertable
* #3943 Optimize first/last
* #3945 Add support for ALTER SCHEMA on multi-node
* #3949 Add support for DROP SCHEMA on multi-node

**Bugfixes**

* #3808 Properly handle max_retries option
* #3863 Fix remote transaction heal logic
* #3869 Fix ALTER SET/DROP NULL contstraint on distributed hypertable
* #3944 Fix segfault in add_compression_policy
* #3961 Fix crash in EXPLAIN VERBOSE on distributed hypertable
* #4015 Eliminate float rounding instabilities in interpolate
* #4019 Update ts_extension_oid in transitioning state
* #4073 Fix buffer overflow in partition scheme

**Improvements**

Query planning performance is improved for hypertables with a large
number of chunks.

**Thanks**

* @fvannee for reporting a first/last memory leak
* @mmouterde for reporting an issue with floats and interpolate
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.

[Enhancement]: Distribute ALTER and DROP SCHEMA to data nodes
4 participants