Skip to content

Make insertRangeFrom() more exception safe - #43338

Merged
nickitat merged 2 commits into
ClickHouse:masterfrom
azat:insertRangeFrom-safety
Nov 23, 2022
Merged

nickitat merged 2 commits into
ClickHouse:masterfrom
azat:insertRangeFrom-safety

Conversation

@azat

@azat azat commented Nov 17, 2022

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

While I was on #43336 I got String offsets has data inconsistent with chars array error, so here are some patches, but note, this may decrease the performance (I want to see at the perf tests):

  • Make ColumnArray::insertRangeFrom() more safe (avoid possible offsets_column has data inconsistent with nested_column. LOGICAL_ERROR)
  • Make ColumnString::insertRangeFrom() more exception safe (avoid possible String offsets has data inconsistent with chars array LOGICAL_ERROR)

@robot-clickhouse robot-clickhouse added the pr-not-for-changelog This PR should not be mentioned in the changelog label Nov 17, 2022
Comment thread src/Columns/ColumnArray.cpp Resolved
@nickitat nickitat self-assigned this Nov 18, 2022
azat added 2 commits November 18, 2022 13:09
This should avoid possible out of sync and LOGICAL_ERROR exception
'offsets_column has data inconsistent with nested_column.'

Signed-off-by: Azat Khuzhin <[email protected]>
Otherwise it is possible for offsets and chars go out of sync and
eventually you will get LOGICAL_ERROR exception
'String offsets has data inconsistent with chars array'

Signed-off-by: Azat Khuzhin <[email protected]>
@azat
azat force-pushed the insertRangeFrom-safety branch from 17647ec to 0c84d8b Compare November 18, 2022 12:09
@azat azat changed the title RFC: Make insertRangeFrom() more exception safe Make insertRangeFrom() more exception safe Nov 18, 2022
@nickitat

Copy link
Copy Markdown
Member

could you pls double check locally queries reported by perf tests? just in case.

@azat

azat commented Nov 22, 2022 •

Copy link
Copy Markdown
Member Author

This does not looks related to me:

Performance Comparison [1/4] — 5 slower

  • select a from t_lz4_uncomp format Null - something lz4 related in flamegraph diff
  • select a from t_lz4 format Null - something lz4 related in flamegraph diff
  • SELECT UserID, SearchPhrase, count() FROM hits_10m_single GROUP BY UserID, SearchPhrase LIMIT 10 - something lz4 related in flamegraph diff
  • SELECT sum(u64) FROM test_sparse_1000 GROUP BY id % 11 FORMAT Null - this code hadn't touched here.
  • SELECT lower(str) FROM test_full_100 FORMAT Null - it has PODArray (but not reserve) in flamegraph diff, but this particular test has failures before (link to play), also, just in case, I've re-run it locally with server from this PR and upstream, and do not see such difference

@nickitat
nickitat merged commit eea32a3 into ClickHouse:master Nov 23, 2022
@azat
azat deleted the insertRangeFrom-safety branch November 24, 2022 04:56
mdelapenya added a commit to mdelapenya/ClickHouse that referenced this pull request Nov 25, 2022
* master: (331 commits)
  Revert "Fix endian issue in integer hex string conversion"
  Update sparse-primary-indexes.md to correct typo
  to MaterializeMySQL_support_drop_mulit_table-change ParserIdentifier
  to MaterializeMySQL_support_drop_mulit_table-clean up unnecessary code
  Make insertRangeFrom() more exception safe (ClickHouse#43338)
  Update docs/en/sql-reference/statements/create/view.md
  Update docs/en/sql-reference/statements/alter/projection.md
  Analyzer table functions untuple fix
  Revert "Add table_uuid to system.parts"
  Update 00176_bson_parallel_parsing.sh
  Update test.py
  doc fix
  bump lib for diag
  Update kafka.md
  check ast limits for create_parser_fuzzer
  Disable compressed marks and index in stress tests
  add a test with weird strings
  Update .reference
  Add information about written rows in progress indicator
  Avoid possible DROP hung due to attached web disk
  ...
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants