Skip to content

Revert "Fix index granularity calculation on block borders"#17918

Merged
alesapin merged 1 commit intomasterfrom
revert-17120-fix_granularity_on_block_borders
Dec 9, 2020
Merged

Revert "Fix index granularity calculation on block borders"#17918
alesapin merged 1 commit intomasterfrom
revert-17120-fix_granularity_on_block_borders

Conversation

@alesapin
Copy link
Copy Markdown
Member

@alesapin alesapin commented Dec 9, 2020

Reverts #17120

Contains an awful bug which can lead to Can't adjust last granule because it has 1024 rows, but try to subtract 1589 rows.: While executing MergeTreeThread.

@alesapin alesapin added the pr-bugfix Pull request with bugfix, not backported by default label Dec 9, 2020
@KochetovNicolai
Copy link
Copy Markdown
Member

It actually does not loose any data. Wrong information is in marks. It is likely to be fixed by merge.

@alesapin
Copy link
Copy Markdown
Member Author

alesapin commented Dec 9, 2020

Fast test OK

@alesapin alesapin merged commit 4d1f528 into master Dec 9, 2020
@alesapin alesapin deleted the revert-17120-fix_granularity_on_block_borders branch December 9, 2020 11:46
alesapin added a commit that referenced this pull request Dec 9, 2020
…y_on_block_borders

Revert "Fix index granularity calculation on block borders"

(cherry picked from commit 4d1f528)
azat added a commit to azat/ClickHouse that referenced this pull request Jan 5, 2021
In ClickHouse#17120 (that was reverted in ClickHouse#17918 already) marks adjustemnt was
introduced, but it may lead to corruption of marks files, that may cause
two things:
1) Incorrect marks files, which lead to reading more rows than there are
   (can be reproduced with `max_threads`>1 or/and `PREWHERE`, and
    `optimize_move_to_prewhere`)
2) Can't adjust last granule because it has X rows, but try to subtract Y
   rows (ClickHouse#9260)

And 1) is pretty hard to diagnosis, since it does not throw any error,
it just may return wrong result.

Fortunately both problems can be fixed with `OPTIMIZE TABLE ... [ FINAL]`.

Cc: @alesapin
Refs: ClickHouse#17943
Refs: ClickHouse#18223
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants