Skip to content

Skip mutations of unrelated partitions in StorageMergeTree#21326

Merged
alesapin merged 16 commits intoClickHouse:masterfrom
excitoon-favorites:flexiblemutations2
Nov 30, 2021
Merged

Skip mutations of unrelated partitions in StorageMergeTree#21326
alesapin merged 16 commits intoClickHouse:masterfrom
excitoon-favorites:flexiblemutations2

Conversation

@excitoon
Copy link
Copy Markdown
Contributor

@excitoon excitoon commented Mar 1, 2021

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category (leave one):

  • Improvement

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

Skipping mutations of different partitions in StorageMergeTree.

@robot-clickhouse robot-clickhouse added the pr-improvement Pull request with some product improvements label Mar 1, 2021
@excitoon excitoon marked this pull request as ready for review March 22, 2021 07:38
@excitoon excitoon changed the title Attempt to skip mutations of different partitions in StorageMergeTree. Attempt to skip mutations of different partitions in StorageMergeTree Mar 29, 2021
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.

Worth a comment

Copy link
Copy Markdown
Contributor

@filimonov filimonov Nov 30, 2021

Choose a reason for hiding this comment

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

^^^

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.

Is this a problem? I mean why it tagged with FIXME?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is no longer a problem.

Copy link
Copy Markdown
Member

@azat azat Apr 5, 2021

Choose a reason for hiding this comment

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

Worth checking system.parts to verify that parts wasn't cloned?
And also block_numbers.number/parts_to_do_names from the system.mutations?

Copy link
Copy Markdown
Member

@azat azat Apr 5, 2021

Choose a reason for hiding this comment

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

Why this is required? Ok, I see, but worth a comment (and also describe why it should not be persistent on disk)

Copy link
Copy Markdown
Member

@azat azat Apr 5, 2021

Choose a reason for hiding this comment

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

BTW worth adding a test for ReplicatedMergeTree?

@azat
Copy link
Copy Markdown
Member

azat commented Apr 6, 2021

Also with this patch the mutations will hang for non existing parts (since it will return nothing from selectPartsToMutate() and so nothing will be notified), i.e.:

CREATE TABLE test_mutations_in_partitions
(
    `date` Date,
    `a` UInt64,
    `b` String
)
ENGINE = MergeTree
PARTITION BY a
ORDER BY tuple();

INSERT INTO test_mutations_in_partitions SELECT
    '2019-07-29' AS date,
    number,
    toString(number)
FROM numbers(100);

ALTER TABLE test_mutations_in_partitions
    DELETE IN PARTITION 1000 WHERE 1
SETTINGS mutations_sync = 1;

Query id: cc447d87-d3df-4c9d-a53a-c3f58ea69a49

Timeout exceeded while receiving data from server. Waited for 300 seconds, timeout is 300 seconds.
Cancelling query.

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.

BTW how about adding simple stateless test instead of integration test?
For mutations_sync it can be even .sql file, while for non-sync it can be .sh

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.

Also this place looks a little bit unsafe, maybe it worth moving commands into the for loop scope?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@excitoon excitoon force-pushed the flexiblemutations2 branch from b2851fa to 0064b91 Compare April 22, 2021 07:59
@excitoon excitoon force-pushed the flexiblemutations2 branch from d5a44c8 to dbbe1bc Compare May 17, 2021 07:36
@excitoon excitoon force-pushed the flexiblemutations2 branch 2 times, most recently from df5e6ef to c7978d2 Compare June 10, 2021 07:14
@excitoon excitoon changed the title Attempt to skip mutations of different partitions in StorageMergeTree Skip mutations of different partitions in StorageMergeTree Jun 10, 2021
@excitoon excitoon changed the title Skip mutations of different partitions in StorageMergeTree Skip mutations of unrelated partitions in StorageMergeTree Jun 10, 2021
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.

Maybe this triggering can this be done unconditionally?
Since if some parts was affected then it will not hit this section anyway, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I intentionally made that in order to not degrade performance on mutex each merge attempt for those who don't use this feature (who mutate always all data). Do you think it worth making unconditionally?

@excitoon
Copy link
Copy Markdown
Contributor Author

Why did you send it to draft?

@excitoon excitoon force-pushed the flexiblemutations2 branch from 121dada to 8472eb5 Compare July 26, 2021 02:58
@excitoon excitoon requested a review from azat July 26, 2021 02:58
@excitoon excitoon marked this pull request as ready for review July 26, 2021 02:58
@excitoon excitoon force-pushed the flexiblemutations2 branch from 8472eb5 to feafbd4 Compare July 27, 2021 12:33
@excitoon
Copy link
Copy Markdown
Contributor Author

Hi @azat. Can you approve a PR?

@azat
Copy link
Copy Markdown
Member

azat commented Jul 27, 2021

@Mergifyio update

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jul 27, 2021

@azat is not allowed to run commands

@azat
Copy link
Copy Markdown
Member

azat commented Jul 27, 2021

@excitoon I will take a look during this weak, in the mean time can you rebase the PR against master? (There are lots of tests failures, yes they seems unrelated, since server got KILLed, but checks should be passed before someone will merge it I guess)

P.S. Also I can't download binary since none of builds had been finished (even fasttest).

@alesapin
Copy link
Copy Markdown
Member

@Mergifyio update

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Oct 26, 2021

update

❌ Pull request can't be updated with latest base branch changes

Details

Mergify needs the author permission to update the base branch of the pull request.
excitoon-favorites needs to authorize modification on its head branch.
err-code: 9A53F

@excitoon excitoon force-pushed the flexiblemutations2 branch 3 times, most recently from 4128aad to 6b0b2b9 Compare October 29, 2021 08:42
@excitoon
Copy link
Copy Markdown
Contributor Author

@alesapin Can you please look at it?

@excitoon excitoon requested a review from alesapin November 18, 2021 07:56
@alesapin
Copy link
Copy Markdown
Member

Ok, let's merge.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants