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

Prevent from using non-deterministic functions in mutations of replicated tables #7247

Merged
merged 8 commits into from
Oct 10, 2019

Conversation

Akazz
Copy link
Contributor

@Akazz Akazz commented Oct 9, 2019

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

Category (leave one):

  • Improvement

Short description (up to few sentences):
Using non-deterministic functions in mutations of Replicated* will result in inconsistencies between replicas.

Fixes #7097

@Akazz Akazz added the pr-improvement Pull request with some product improvements label Oct 9, 2019
@Akazz
Copy link
Contributor Author

Akazz commented Oct 10, 2019

Failing test 00212_shard_aggregate_function_uniq is irrelevant - it is broken in the master

@Akazz Akazz changed the title Prohibit using non-deterministic functions in mutations of replicated tables Prevent from using non-deterministic functions in mutations of replicated tables Oct 10, 2019
@Akazz Akazz merged commit 03c7b7f into ClickHouse:master Oct 10, 2019
@BayoNet
Copy link
Contributor

BayoNet commented Oct 25, 2019

Should we document it?

@akuzm akuzm mentioned this pull request Nov 8, 2019
@den-crane
Copy link
Contributor

den-crane commented Mar 31, 2020

Говорят непонятно как теперь апдейты делать.

Здравствуйте! Вы мне както подсказывали как в кликхаусе делаете мутации с условиями через словари:

Denny Crane [not a Yandex bot], [22.01.20 04:27]
такие запросы нельзя делать, alter для каждой строки xxx проверить where.

Я готовлю таблицу ReplicatedMergeTree c id-шками которые надо удалить, она обязательно должна создержать одинаковые записи на всех репликах, чтобы мутации на репликах получили один и тот же результат мутации.

Создаю словарь который смотрит на ReplicatedMergeTree на всех репликах

Выясняю какие парты содержат записи которые надо удалить

Выполняю alter table xxx delete where date between парты and dictHas(словарь)

у меня это прекрасно работало когда кх был сингл инстанс, а сейчас когда появилась реплика, ругается на то, что :

DB::Exception: ALTER UPDATE/ALTER DELETE statements must use only deterministic functions! Function 'dictHas' is non-deterministic (version 19.17.6.36 (official build))

создал все как вы советовали таблицы и словари синхронизированы на обоих репликах и имеют одинаковое кол-во записей

не могли бы вы подсказать в чем может быть проблема?

Я тоже делаю все мутации через словари. К счастью в 18.14.18 такой проблемы нет.

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.

Forbid non-deterministic functions in mutations
5 participants