Skip to content

Revert "Revert "insertion deduplication on retries for materialized views""#66144

Merged
CheSema merged 14 commits intomasterfrom
revert-66134-revert-61601-chesema-dedup-matview
Jul 17, 2024
Merged

Revert "Revert "insertion deduplication on retries for materialized views""#66144
CheSema merged 14 commits intomasterfrom
revert-66134-revert-61601-chesema-dedup-matview

Conversation

@CheSema
Copy link
Copy Markdown
Member

@CheSema CheSema commented Jul 5, 2024

Reverts #66134

Here I look at the tests more accurate and fix bugs in stress tests, like #66122


Implements ideas from #60008
Docs in progress ClickHouse/clickhouse-docs#2394

I improved deduplication by enhancing annotation of chunks on a pipeline level.
Now, each chunk could have several attached structures with base class ChunkInfo which are differ by the derived type. That annotation is passing with the chunks through the Processors. See Chunk::ChunkInfoCollection, CollectionOfDerivedItems<ChunkInfo>.

The deduplication token for each chunk is written as TokenInfo (derived class from ChunkInfo) with SetInitialTokenTransform. After that token could be updated. See DeduplicationToken::TokenInfo::BuildingStage.

Initial value for TokenInfo is taken either from insert_deduplication_token setting or it is calculated as a hash from inserted data.
In order to distinguish equal blocks which should not be deduplicated, TokenInfo is update with more detailed information about the source of the data, like the names of MV on the way to the table.

Changelog category (leave one):

  • Improvement

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

This PR changes how deduplication for MV works.
Fixed a lot of cases like:

  • on destination table: data is split for 2 or more blocks and that blocks is considered as duplicate when that block is inserted in parallel.
  • on MV destination table: the equal blocks are deduplicated, that happens when MV often produces equal data as a result for different input data due to performing aggregation.
  • on MV destination table: the equal blocks which comes from different MV are deduplicated

Settings update_insert_deduplication_token_in_dependent_materialized_views is depricated. The deduplicated token for inserted blocks in MV is calculated based on source data. Always.

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-2 robot-clickhouse-ci-2 added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 5, 2024
@robot-ch-test-poll
Copy link
Copy Markdown
Contributor

robot-ch-test-poll commented Jul 5, 2024

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

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

Check nameDescriptionStatus
BuildsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS❌ failure
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests❌ failure
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ error
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
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
Docs checkBuilds and tests the documentation✅ 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
Stateful testsRuns stateful 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

Copy link
Copy Markdown
Member Author

@CheSema CheSema Jul 5, 2024

Choose a reason for hiding this comment

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

I have added that chassert(aggr_chunk) in oreder to check that Squashing produces chunks which converts to bool as true.
This has to be valid always, otherwise chunk might dropped in some processor. But that chunk not empty, chunkinfo contains the data.
Also chunk has to have the same columns as the processor header. This why we have tp set columns from header.

BUT. Sometime there are chunks with 0 columns passing through pipeline. And it is valid situation. This is why we have to set size when there is no columns.

@CheSema CheSema force-pushed the revert-66134-revert-61601-chesema-dedup-matview branch 4 times, most recently from 14873e5 to 121cd55 Compare July 5, 2024 23:06
@alexey-milovidov alexey-milovidov changed the title Revert "Revert "insertion deduplication on retries for materialised views"" Revert "Revert "insertion deduplication on retries for materialized views"" Jul 6, 2024
@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 6, 2024

01275_parallel_mv -- related flacks. It flack only on aarch64.
#66116

@CheSema CheSema mentioned this pull request Jul 6, 2024
@CheSema CheSema force-pushed the revert-66134-revert-61601-chesema-dedup-matview branch from 121cd55 to cb3d0e7 Compare July 6, 2024 12:20
@CheSema CheSema force-pushed the revert-66134-revert-61601-chesema-dedup-matview branch from cb3d0e7 to 376472c Compare July 6, 2024 13:34
@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 6, 2024

@kssenii kssenii self-assigned this Jul 7, 2024
@CheSema CheSema marked this pull request as draft July 8, 2024 16:57
@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 9, 2024

Before that changes all parts were written and committed in consume() method. This was not intentionally. By design the written parts could be delayed and be committed later at the next call consume() method or at the onFinish(). But a very sophisticated dirty code about deduplication made this impossible. I fixed it, now committing a part could be delayed.

That means such parts should be able to be canceled properly. I will address it here #66279
regardless this changes this is good to fix separately.

@CheSema CheSema mentioned this pull request Jul 9, 2024
19 tasks
@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 12, 2024

Stateless tests (debug) [1/2], Stateless Tests (debug, S3 Storage) [1/2] --
Server crashed on assertion in DDLLoadingDependencyVisitor::extractTableNameFromArgument, already fixed: #66390

Stateless Tests (tsan) [2/2], Stateless Tests (tsan, S3 Storage) [3/3]
02834_apache_arrow_abort -- #66181

@CheSema CheSema marked this pull request as ready for review July 12, 2024 10:04
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Tags: long, no-fasttest, no-parallel
# Tags: long, no-fasttest, no-parallel, no-asan
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could this necessity to mark some tests as slow indicate that code slowed down noticeably? these tests seem to be good to have with asan though

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.

I do not know how to mark them as 'slover_than_600_sec'.
As I wrote before: combination Asan + Azure works 10-11 minutes. I do not know how to exclude only it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we already have no-s3-storage, then we should also have (or add) no-azure-storage.

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.

Cool. there is no-azure-blob-storage already.

elif tags and ("no-azure-blob-storage" in tags) and args.azure_blob_storage:

It just undocumented. I found it when tried to implement it. I will change tags in separate PR.

@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 15, 2024

PullRequestCI / Builds_2 (pull_request) Skipped -- I need it, so wait one more round of CI.

@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 15, 2024

I see tidy build is broken -- #66552

@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 15, 2024

Stateless tests (debug, s3 storage) [2/2]
02480_s3_support_wildcard -- #66180

Copy link
Copy Markdown
Member

@kssenii kssenii left a comment

Choose a reason for hiding this comment

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

LGTM, but please check #66144 (comment), may be change this in a separate PR?

@CheSema CheSema added this pull request to the merge queue Jul 17, 2024
Merged via the queue into master with commit 762593e Jul 17, 2024
@CheSema CheSema deleted the revert-66134-revert-61601-chesema-dedup-matview branch July 17, 2024 11:27
@tavplubix
Copy link
Copy Markdown
Member

Cloud fork sync has failed

@den-crane
Copy link
Copy Markdown
Contributor

baibaichen added a commit to Kyligence/gluten that referenced this pull request Jul 18, 2024
baibaichen added a commit to Kyligence/gluten that referenced this pull request Jul 18, 2024
baibaichen added a commit to apache/gluten that referenced this pull request Jul 18, 2024
* [GLUTEN-1632][CH]Daily Update Clickhouse Version (20240718)

* Fix build due to ClickHouse/ClickHouse#66144

---------

Co-authored-by: kyligence-git <[email protected]>
Co-authored-by: Chang Chen <[email protected]>
@CheSema
Copy link
Copy Markdown
Member Author

CheSema commented Jul 18, 2024

BTW does it fix:

Yes. It does.
I will write a specific tests for the cases in task to fix the behaviour and explanation and after close it.

PS: there is already the test tests/queries/0_stateless/02912_ingestion_mv_deduplication.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog 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.

8 participants