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

Remove parallel safe from partialize_agg #5172

Conversation

fabriziomello
Copy link
Contributor

Previous PR #4307 mark partialize_agg and finalize_agg as parallel safe but this change is leading to incorrect results in some cases.

Those functions are supposed work in parallel but seems is not the case and it is not evident yet the root cause and how to properly use it in parallel queries so we decided to revert this change and provide correct results to users.

Fixes #4922

@fabriziomello fabriziomello self-assigned this Jan 11, 2023
@codecov
Copy link

codecov bot commented Jan 11, 2023

Codecov Report

Merging #5172 (d733b09) into main (f36db10) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5172      +/-   ##
==========================================
- Coverage   89.27%   89.27%   -0.01%     
==========================================
  Files         225      225              
  Lines       51756    51755       -1     
==========================================
- Hits        46206    46205       -1     
  Misses       5550     5550              
Impacted Files Coverage Δ
tsl/src/nodes/data_node_dispatch.c 93.03% <0.00%> (-0.22%) ⬇️
tsl/src/bgw_policy/job.c 87.28% <0.00%> (-0.05%) ⬇️
src/loader/bgw_message_queue.c 89.20% <0.00%> (+0.56%) ⬆️

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 f36db10...d733b09. Read the comment docs.

@fabriziomello fabriziomello force-pushed the remove_parallel_safe_from_partialize_agg branch from 8de4184 to beaebf6 Compare January 11, 2023 22:05
@fabriziomello fabriziomello marked this pull request as ready for review January 11, 2023 23:07
@github-actions
Copy link

@sb230132, @nikkhils: please review this pull request.

Powered by pull-review

SET parallel_setup_cost = 0;

-- Compare the results (should return NO ROWS)
(SELECT
Copy link
Member

Choose a reason for hiding this comment

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

Slightly confused by this test -- which subselect is the broken one? Maybe we could generate stable pseudo-random data and just show the results of both subselects. For pseudo-random we can use something like this: https://github.com/timescale/timescaledb/blob/main/tsl/test/sql/dist_param.sql#L20-L33

Copy link
Member

Choose a reason for hiding this comment

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

Also might be good to have an explain query so that we are absolutely sure it runs in parallel, because parallel execution is notoriously hard to achieve sometimes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're correct will update the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests updated

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.

OK as a quick fix, but I wonder what's the root cause.

sql/partialize_finalize.sql Outdated Show resolved Hide resolved
@fabriziomello fabriziomello force-pushed the remove_parallel_safe_from_partialize_agg branch 4 times, most recently from 29d902a to 7544b0a Compare January 12, 2023 19:28
Previous PR timescale#4307 mark `partialize_agg` and `finalize_agg` as parallel
safe but this change is leading to incorrect results in some cases.

Those functions are supposed work in parallel but seems is not the case
and it is not evident yet the root cause and how to properly use it in
parallel queries so we decided to revert this change and provide correct
results to users.

Fixes timescale#4922
@fabriziomello fabriziomello force-pushed the remove_parallel_safe_from_partialize_agg branch from 7544b0a to d733b09 Compare January 12, 2023 20:37
@fabriziomello fabriziomello merged commit 4118a72 into timescale:main Jan 13, 2023
@fabriziomello fabriziomello added this to the TimescaleDB 2.9.2 milestone Jan 17, 2023
sb230132 added a commit to sb230132/timescaledb that referenced this pull request Jan 18, 2023
This release contains bug fixes since the 2.9.1 release.
We recommend that you upgrade at the next available opportunity.

**Bugfixes**
* timescale#5180 Fix dist_cagg flaky test
* timescale#5170 Fix CAgg on CAgg variable bucket size validation
* timescale#5114 Fix issue with deleting data node and dropping database
* timescale#5172 Remove parallel safe from partialize_agg
* timescale#5162 Fix telemetry_stats test in PG15
* timescale#5130 Fix CAgg on CAgg variable bucket size validation
* timescale#5133 Fix CAgg on CAgg different column order
* timescale#5152 Fix adding column with NULL constraint
* timescale#5136 Fix SELECT from partial compressed chunks
* timescale#5181 Fix ChunkAppend, ConstraintAwareAppend child subplan
@sb230132 sb230132 mentioned this pull request Jan 18, 2023
sb230132 added a commit to sb230132/timescaledb that referenced this pull request Jan 18, 2023
This release contains bug fixes since the 2.9.1 release.
We recommend that you upgrade at the next available opportunity.

**Bugfixes**
* timescale#5180 Fix dist_cagg flaky test
* timescale#5170 Fix CAgg on CAgg variable bucket size validation
* timescale#5114 Fix issue with deleting data node and dropping database
* timescale#5172 Remove parallel safe from partialize_agg
* timescale#5162 Fix telemetry_stats test in PG15
* timescale#5133 Fix CAgg on CAgg different column order on the original hypertable
* timescale#5152 Fix adding column with NULL constraint to compressed hypertable
* timescale#5136 Fix SELECT from partial compressed chunks
* timescale#5181 Fix ChunkAppend, ConstraintAwareAppend child subplan
sb230132 added a commit to sb230132/timescaledb that referenced this pull request Jan 19, 2023
This release contains bug fixes since the 2.9.1 release.
We recommend that you upgrade at the next available opportunity.

**Bugfixes**
* timescale#5180 Fix dist_cagg flaky test
* timescale#5170 Fix CAgg on CAgg variable bucket size validation
* timescale#5114 Fix issue with deleting data node and dropping database
* timescale#5172 Remove parallel safe from partialize_agg
* timescale#5162 Fix telemetry_stats test in PG15
* timescale#5133 Fix CAgg on CAgg different column order on the original hypertable
* timescale#5152 Fix adding column with NULL constraint to compressed hypertable
* timescale#5136 Fix SELECT from partial compressed chunks
* timescale#5181 Fix ChunkAppend, ConstraintAwareAppend child subplan
* timescale#5193 Fix repartition behavior when attaching data node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Inconsistent and Incorrect Aggregations
3 participants