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 incompatible ALTER of projection columns #56948

Merged
merged 3 commits into from Dec 3, 2023

Conversation

amosbird
Copy link
Collaborator

@amosbird amosbird commented Nov 18, 2023

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Now ALTER columns which are incompatible with columns used in some projections will be forbidden. Previously it could result in incorrect data. This fixes #56932. This PR also allows RENAME of index columns, and improves the exception message by providing clear information on the affected indices or projections causing the prevention.

@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-bugfix Pull request with bugfix, not backported by default label Nov 18, 2023
@robot-ch-test-poll2
Copy link
Contributor

robot-ch-test-poll2 commented Nov 18, 2023

This is an automated comment for commit a53e604 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
Bugfix validate checkChecks that either a new test (functional or integration) or there some changed tests that fail with the binary built on master branch✅ success
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker image for serversThe 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. Integrational 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
Mergeable CheckChecks if all other necessary checks are successful✅ 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
Push to DockerhubThe check for building and pushing the CI related docker images to docker hub✅ success
SQLTestThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
SQLancerFuzzing tests that detect logical bugs with SQLancer tool✅ success
SqllogicRun clickhouse on the sqllogic test set against sqlite and checks that all statements are passed✅ 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
Check nameDescriptionStatus
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR⏳ pending
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure

@alexey-milovidov alexey-milovidov added the pr-backward-incompatible Pull request with backwards incompatible changes label Nov 18, 2023
@den-crane
Copy link
Contributor

den-crane commented Nov 18, 2023

Thanks for the PR, you are very fast.

I would add a test for measurements as well https://fiddle.clickhouse.com/14015844-26a7-4dcf-864d-6624398bbda6

@amosbird
Copy link
Collaborator Author

amosbird commented Nov 18, 2023

It seems we should recalculate projections instead of preventing it. Because there are use cases that rely on * projections:

CREATE TABLE x (col1 Int64, col2 Int64, PROJECTION 02691_drop_column_replicated (SELECT * ORDER BY col1 ))

which will adapt to metadata changes. For now let's keep the original DROP column behavior. Coupling projection recalculation with other metadata ALTER is non-trivial.

@amosbird
Copy link
Collaborator Author

amosbird commented Nov 18, 2023

I would add a test for measurements as well https://fiddle.clickhouse.com/14015844-26a7-4dcf-864d-6624398bbda6

We should also allow compatible metadata ALTERs such as String -> LowCardinality(String).

@amosbird amosbird changed the title Prevent ALTER of projection columns Prevent incompatible ALTER of projection columns Nov 18, 2023
@robot-ch-test-poll3 robot-ch-test-poll3 removed the pr-backward-incompatible Pull request with backwards incompatible changes label Nov 18, 2023
@amosbird
Copy link
Collaborator Author

amosbird commented Nov 30, 2023

01280_ttl_where_group_by

Known flaky test:

 ❯ curl "https://play.clickhouse.com?user=play" -d "select toStartOfHour(check_start_time) as d,count(),  groupUniqArray(pull_request_number),  any(report_url) from checks where '2022-06-01' <= check_start_time and test_name like '%01280_ttl_where_group_by%' and test_status in ('FAIL', 'FLAKY') group by d order by d desc"
2023-11-27 15:00:00     1       [57231] https://s3.amazonaws.com/clickhouse-test-reports/57231/96a445d3ac3e9547998ea80d2f29829a4986d426/stateless_tests__debug__s3_storage__[3_6].html
2023-11-26 06:00:00     1       [57205] https://s3.amazonaws.com/clickhouse-test-reports/57205/6b46070e0281c15d97c7918150d3c9f4a5bc0a8a/stateless_tests__debug__s3_storage__[3_6].html
2023-11-26 05:00:00     2       [0,57218]       https://s3.amazonaws.com/clickhouse-test-reports/0/1cc33f34303e6508cc9d63093bafb4585d833158/stateless_tests__tsan__[2_5].html
2023-11-26 02:00:00     1       [56724] https://s3.amazonaws.com/clickhouse-test-reports/56724/92e580997c5fbd436f829de62d7073504380986a/stateless_tests__debug__s3_storage__[3_6].html
2023-11-25 22:00:00     1       [0]     https://s3.amazonaws.com/clickhouse-test-reports/0/4088ec0eacc72867f943ad3a240c134a46fcd63c/stateless_tests__msan__[3_6].html
2023-11-25 19:00:00     1       [57220] https://s3.amazonaws.com/clickhouse-test-reports/57220/c2367016140e9035b21262a137b1e44228565543/stateless_tests__debug__s3_storage__[3_6].html
2023-11-25 14:00:00     2       [0,57003]       https://s3.amazonaws.com/clickhouse-test-reports/0/2e7f314599533b95627cca98608e78cc7b0bbedc/stateless_tests__debug__[2_5].html
2023-11-24 22:00:00     1       [57209] https://s3.amazonaws.com/clickhouse-test-reports/57209/1b623b0e48251303881fd4e56e50021112cf0811/stateless_tests__msan__[3_6].html
2023-11-24 20:00:00     2       [0,56383]       https://s3.amazonaws.com/clickhouse-test-reports/56383/791c01d666b50efa7090da9e5651cd3cc76b9e26/stateless_tests__tsan__s3_storage__[2_5].html
2023-11-24 19:00:00     4       [56864,56342,57076]     https://s3.amazonaws.com/clickhouse-test-reports/57076/0f7b5ebd68d44f1789a9186082a9e8fdfa906b34/stateless_tests__tsan__s3_storage__[2_5].html
2023-11-24 18:00:00     5       [57122,56269,57202,51858,57198] https://s3.amazonaws.com/clickhouse-test-reports/57122/dfba02542dc44ab1e70c81bea0b97cd12ef68c83/stateless_tests__debug__s3_storage__[3_6].

01732_race_condition_storage_join_long

Known flaky test:

 ❯ curl "https://play.clickhouse.com?user=play" -d "select toStartOfHour(check_start_time) as d,count(),  groupUniqArray(pull_request_number),  any(report_url) from checks where '2022-06-01' <= check_start_time and test_name like '%01732_race_condition_storage_join_long%' and test_status in ('FAIL', 'FLAKY') group by d order by d desc"
2023-11-28 10:00:00     1       [57299] https://s3.amazonaws.com/clickhouse-test-reports/57299/889c53eca013f1280ba9b442a98101201074ef00/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-25 20:00:00     1       [49351] https://s3.amazonaws.com/clickhouse-test-reports/49351/6937c0de19e50708445e1a818c3560a92eb2b5d3/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-22 07:00:00     1       [56079] https://s3.amazonaws.com/clickhouse-test-reports/56079/1e0b4f979c90564159f9cd10acfb310ba71c1e79/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-21 12:00:00     1       [57034] https://s3.amazonaws.com/clickhouse-test-reports/57034/fd792a80230c954393bd4720cf46e041d535deef/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-21 10:00:00     1       [57033] https://s3.amazonaws.com/clickhouse-test-reports/57033/f996dac75d017c3c3340b74073288df263feead0/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-21 08:00:00     1       [56948] https://s3.amazonaws.com/clickhouse-test-reports/56948/ee1cec4d38bad32de6dbf0f4c37c99c64a1dffed/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-17 18:00:00     1       [56897] https://s3.amazonaws.com/clickhouse-test-reports/56897/bedec05cccb35938cc0d82e98f59381db90ae5c7/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-17 17:00:00     1       [56619] https://s3.amazonaws.com/clickhouse-test-reports/56619/4d5becb4deff91f4e9675624175f2207ea2d9ccf/stateless_tests__tsan__[5_5].html
2023-11-16 21:00:00     1       [56865] https://s3.amazonaws.com/clickhouse-test-reports/56865/7497495f05beb22c871045b500a8c4ed9e788fda/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-15 12:00:00     1       [56304] https://s3.amazonaws.com/clickhouse-test-reports/56304/12a8a38d3592f92d9c86725a1fea25355478f2e4/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-13 09:00:00     1       [56641] https://s3.amazonaws.com/clickhouse-test-reports/56641/6add71bd414340532a0769b2c16a1ac98aba3d5a/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-11 09:00:00     1       [56485] https://s3.amazonaws.com/clickhouse-test-reports/56485/90f16d67ac63c7e2780027f43866a959ba8fe652/stateless_tests__tsan__s3_storage__[5_5].html
2023-11-06 23:00:00     2       [56394,39507]   https://s3.amazonaws.com/clickhouse-test-reports/39507/e2ca5ae1f711e8cfb8e09715a9d30e5945b5cdbb/stateless_tests__tsan__s3_storage__[5_5].html

test_postgres_schema

#56627

test_storage_rabbitmq/test.py::test_row_based_formats

#56866

test_system_clusters_actual_information/test.py::test

Same as above. #56866

@evillique evillique added pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-cloud labels Dec 2, 2023
@evillique
Copy link
Member

Tests:

@evillique evillique merged commit 2150308 into ClickHouse:master Dec 3, 2023
331 of 335 checks passed
robot-ch-test-poll4 added a commit that referenced this pull request Dec 3, 2023
…7d9b889b14e167398946042b4035c

Cherry pick #56948 to 23.8: Prevent incompatible ALTER of projection columns
robot-ch-test-poll4 added a commit that referenced this pull request Dec 3, 2023
…7d9b889b14e167398946042b4035c

Cherry pick #56948 to 23.9: Prevent incompatible ALTER of projection columns
robot-ch-test-poll4 added a commit that referenced this pull request Dec 3, 2023
…17d9b889b14e167398946042b4035c

Cherry pick #56948 to 23.10: Prevent incompatible ALTER of projection columns
robot-clickhouse-ci-1 added a commit that referenced this pull request Dec 4, 2023
…7d9b889b14e167398946042b4035c

Cherry pick #56948 to 23.3: Prevent incompatible ALTER of projection columns
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Dec 4, 2023
KochetovNicolai added a commit that referenced this pull request Jan 5, 2024
Backport #56948 to 23.3: Prevent incompatible ALTER of projection columns
KochetovNicolai added a commit that referenced this pull request Jan 5, 2024
Backport #56948 to 23.10: Prevent incompatible ALTER of projection columns
KochetovNicolai added a commit that referenced this pull request Jan 5, 2024
Backport #56948 to 23.9: Prevent incompatible ALTER of projection columns
KochetovNicolai added a commit that referenced this pull request Jan 5, 2024
Backport #56948 to 23.8: Prevent incompatible ALTER of projection columns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-backports-created-cloud pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-cloud
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Altering column that is part of a projection may lead to loosing data
9 participants