Skip to content

merge tree sink cancel delayed_chunk#66279

Merged
CheSema merged 12 commits intomasterfrom
chesema-processor-onCancel
Aug 7, 2024
Merged

merge tree sink cancel delayed_chunk#66279
CheSema merged 12 commits intomasterfrom
chesema-processor-onCancel

Conversation

@CheSema
Copy link
Copy Markdown
Member

@CheSema CheSema commented Jul 9, 2024

Motivation and context are here #66144 (comment)

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

[Replicated]MergeTreeSink has to properly cancel its delayed_chunk on onCancel() method.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Information about CI checks: https://clickhouse.com/docs/en/development/continuous-integration/

CI Settings (Only check the boxes if you know what you are doing):

  • Allow: All Required Checks
  • Allow: Stateless tests
  • Allow: Stateful tests
  • Allow: Integration Tests
  • Allow: Performance tests
  • Allow: All Builds
  • Allow: batch 1, 2 for multi-batch jobs
  • Allow: batch 3, 4, 5, 6 for multi-batch jobs

  • Exclude: Style check
  • Exclude: Fast test
  • Exclude: All with ASAN
  • Exclude: All with TSAN, MSAN, UBSAN, Coverage
  • Exclude: All with aarch64, release, debug

  • Do not test
  • Woolen Wolfdog
  • Upload binaries for special builds
  • Disable merge-commit
  • Disable CI cache

@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-improvement Pull request with some product improvements label Jul 9, 2024
@robot-ch-test-poll1
Copy link
Copy Markdown
Contributor

robot-ch-test-poll1 commented Jul 9, 2024

This is an automated comment for commit 0eb6a41 with description of existing statuses. It's updated for the latest CI running

✅ Click here to open a full report in a separate page

Successful checks
Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help✅ success
BuildsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe check to build and optionally push the mentioned image to docker hub✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integration tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors✅ success
Style checkRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts✅ success

@CheSema CheSema force-pushed the chesema-processor-onCancel branch from e7d6bfa to 246f421 Compare July 9, 2024 20:38
@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 10, 2024

We have a problem. onCancel() is called concurrently. There should be synchronisation.

@CheSema CheSema force-pushed the chesema-processor-onCancel branch from ebbd97f to 614e899 Compare July 10, 2024 17:13
@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 12, 2024

I didn't fully understand how onCancel and onException should work in ExceptionKeepingTransform.
Now I think I do. Here is the explanation:

There is no need to do anything in that methods. Because if you have an onException call then graph execution would ether mute that exception or cancel the hole graph later. If exception is muted that you have to only properly finish your processor as canceled which observed that exception. Other processor might have newer seen any errors, they have to be finished as successful processors. In any case there is an invariant: if processor is finished as successful then method onFinish is called. Otherwise there is no onFinish method, just destructor.

relation to exception / final decision exception is muted exception is propagated
processor trows/observes exception onException + d-tor onException + onCancel + d-tor.
processor is unaware of exception onFinish + d-tor onCancel + d-tor.

So, we could just look at isCanceled on d-tor to understand what we should do with the resources: either cancel them or commit.

Note that onCancel is called concurrently with onConsume or onGenerate in order to make a chance to stop them earlier. So the synchronisation is required.
Therefore, it is make cense to ether raise some thread-safe flag or periodically look at isCanceled in your onConsume or onGenerate methods (also in successor: consume) to prevent making excess work.

@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 15, 2024

Integration Tests (asan, Old Analyzer) [1/6]
test_broken_ignored_replicated -- flaks still even after some fix #61932

Stateless Tests (coverage) [2/5]
03030_system_flush_distributed_settings -- flaks in master

Stateless Tests (debug) [1/2]
01632_tinylog_read_write -- assertion in jemalloc #66193


~MessageQueueSink() override
{
onFinish();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That is not cleat if it could throw an exception. Will revert changes in that class.

@CheSema CheSema marked this pull request as ready for review July 16, 2024 10:58
@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 16, 2024

Stress test (msan)
use-of-uninitialized-value -- #66525

binary_tidy -- #66552

@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 23, 2024

At previous build:
02884_async_insert_skip_settings -- should be fixed now by #66771

@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 25, 2024

@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 25, 2024

Stress Test (tsan)
Hung check failed
https://s3.amazonaws.com/clickhouse-test-reports/66279/20f22278bd4bbbf85cff4012fb12c20a03257b13/stress_test__tsan_.html

This is an issue.
it belongs to the test 02967_parallel_replicas_join_algo_and_analyzer.sh
initial query 09b0e14d-2a0a-4530-8620-04319e2b52fa,
dependent 6222aab4-8ac3-49cf-a9a5-4da98152593f failed due to exception CANNOT_SCHEDULE_TASK
second dependent e2d5632a-116f-4070-a9fd-2556d734d34d hanged.
It looks like #66351

@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Aug 6, 2024

Integration Tests Flaky Check all tests has been fixed by Michael Stetsyuk

@CheSema CheSema added this pull request to the merge queue Aug 7, 2024
Merged via the queue into master with commit 2729410 Aug 7, 2024
@CheSema CheSema deleted the chesema-processor-onCancel branch August 7, 2024 12:13
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 7, 2024
baibaichen added a commit to Kyligence/gluten that referenced this pull request Aug 8, 2024
baibaichen added a commit to Kyligence/gluten that referenced this pull request Aug 8, 2024
baibaichen added a commit to apache/gluten that referenced this pull request Aug 8, 2024
* [GLUTEN-1632][CH]Daily Update Clickhouse Version (20240808)

* Fix build due to ClickHouse/ClickHouse#66279

* Revert "[GLUTEN-6262][CH]Json input format ignore key case #6263" due to ClickHouse/ClickHouse#67484 revert ClickHouse/ClickHouse#61750

This reverts commit 2be6c86.

* fix gtest due to #6722

---------

Co-authored-by: kyligence-git <[email protected]>
Co-authored-by: Chang Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants