Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@PKartaviy
Copy link
Contributor

No description provided.

@PKartaviy PKartaviy merged commit 2696e05 into master Jun 9, 2016
aSealBack pushed a commit to aSealBack/ClickHouse that referenced this pull request Apr 17, 2017
…tory update and merging in 'flush' method without lock [#CLICKHOUSE-2929]
alexey-milovidov pushed a commit that referenced this pull request May 22, 2017
…e and merging in 'flush' method without lock [#CLICKHOUSE-2929]
vadimskipin added a commit to vadimskipin/ClickHouse that referenced this pull request Sep 8, 2017
blinkov referenced this pull request in blinkov/ClickHouse Oct 10, 2017
alexey-milovidov pushed a commit that referenced this pull request Oct 11, 2017
* update presentations

* CLICKHOUSE-2936: redirect from clickhouse.yandex.ru and clickhouse.yandex.com

* update submodule

* lost files

* CLICKHOUSE-2981: prefer sphinx docs over original reference

* CLICKHOUSE-2981: docs styles more similar to main website + add flags to switch language links

* update presentations

* Less confusing directory structure (docs -> doc/reference/)

* Minify sphinx docs too

* Website release script: fail fast + pass docker hash on deploy

* Do not underline links in docs

* shorter

* cleanup docker images

* tune nginx config

* CLICKHOUSE-3043: get rid of habrastorage links

* Lost translation

* CLICKHOUSE-2936: temporary client-side redirect

* behaves weird in test

* put redirect back

* CLICKHOUSE-3047: copy docs txts to public too

* move to proper file

* remove old pages to avoid confusion

* Remove reference redirect warning for now

* Refresh README.md

* Yellow buttons in docs

* Use svg flags instead of unicode ones in docs

* fix test website instance

* Put flags to separate files

* wrong flag

* Copy Yandex.Metrica introduction from main page to docs

* Yet another home page structure change, couple new blocks (CLICKHOUSE-3045)

* Update Contacts section

* CLICKHOUSE-2849: more detailed legal information

* CLICKHOUSE-2978 preparation - split by files

* More changes in Contacts block

* Tune texts on index page

* update presentations

* One more benchmark

* Add usage sections to index page, adapted from slides

* Get the roadmap started, based on slides from last ClickHouse Meetup

* CLICKHOUSE-2977: some rendering tuning

* Get rid of excessive section in the end of getting started

* Make headers linkable

* CLICKHOUSE-2981: links to editing reference - #849

* CLICKHOUSE-2981: fix mobile styles in docs

* Ban crawling of duplicating docs

* Open some external links in new tab

* Ban old docs too

* Lots of trivial fixes in english docs

* Lots of trivial fixes in russian docs

* Remove getting started copies in markdown

* Add Yandex.Webmaster

* Fix some sphinx warnings

* More warnings fixed in english docs

* More sphinx warnings fixed

* Add code-block:: text

* More code-block:: text

* These headers look not that well

* Better switch between documentation languages

* merge use_case.rst into ya_metrika_task.rst

* Edit the agg_functions.rst texts

* Add lost empty lines

* Lost blank lines

* Add new logo sizes

* update presentations

* Next step in migrating to new documentation

* Fix all warnings in en reference

* Fix all warnings in ru reference

* Re-arrange existing reference

* Move operation tips to main reference

* Fix typos noticed by milovidov@

* Get rid of zookeeper.md

* Looks like duplicate of tutorial.html

* Fix some mess with html tags in tutorial

* No idea why nobody noticed this before, but it was completely not clear whet to get the data

* Match code block styling between main and tutorial pages (in favor of the latter)

* Get rid of some copypaste in tutorial

* Normalize header styles

* Move example_datasets to sphinx

* Move presentations submodule to website

* Move and update README.md

* No point in duplicating articles from habrahabr here

* Move development-related docs as is for now

* doc/reference/ -> docs/ (to match the URL on website)

* Adapt links to match the previous commit

* Adapt development docs to rst (still lacks translation and strikethrough support)

* clean on release

* blacklist presentations in gulp

* strikethrough support in sphinx

* just copy development folder for now

* fix weird introduction in style article

* Style guide translation (WIP)

* Finish style guide translation to English

* gulp clean separately

* Update year in LICENSE

* Initial CONTRIBUTING.md

* Fix remaining links to old docs in tutorial

* Some tutorial fixes

* Typo

* Another typo

* Update list of authors from yandex-team accoding to git log

* Fix diff with master

* couple fixes in en what_is_clickhouse.rst

* Try different link to blog in Russian

* Swap words

* Slightly larger line height

* CLICKHOUSE-3089: disable hyphenation in docs

* update presentations

* Fix copying of txt files

* update submodule

* CLICKHOUSE-3108: fix overflow issues in mobile version

* Less weird tutorial header in mobile version

* CLICKHOUSE-3073: skip sourcemaps by default

* CLICKHOUSE-3067: rename item in docs navigation

* fix list markup

* CLICKHOUSE-3067: some documentation style tuning

* CLICKHOUSE-3067: less laggy single page documentation

* update presentations

* YQL-3278: add some links to ClickHouse Meetup in Berlin on October 5, 2017

* Add "time series" keyword

* Switch link to next event

* Switch link to next event #2

* smaller font
alexey-milovidov pushed a commit that referenced this pull request Nov 8, 2017
* update presentations

* CLICKHOUSE-2936: redirect from clickhouse.yandex.ru and clickhouse.yandex.com

* update submodule

* lost files

* CLICKHOUSE-2981: prefer sphinx docs over original reference

* CLICKHOUSE-2981: docs styles more similar to main website + add flags to switch language links

* update presentations

* Less confusing directory structure (docs -> doc/reference/)

* Minify sphinx docs too

* Website release script: fail fast + pass docker hash on deploy

* Do not underline links in docs

* shorter

* cleanup docker images

* tune nginx config

* CLICKHOUSE-3043: get rid of habrastorage links

* Lost translation

* CLICKHOUSE-2936: temporary client-side redirect

* behaves weird in test

* put redirect back

* CLICKHOUSE-3047: copy docs txts to public too

* move to proper file

* remove old pages to avoid confusion

* Remove reference redirect warning for now

* Refresh README.md

* Yellow buttons in docs

* Use svg flags instead of unicode ones in docs

* fix test website instance

* Put flags to separate files

* wrong flag

* Copy Yandex.Metrica introduction from main page to docs

* Yet another home page structure change, couple new blocks (CLICKHOUSE-3045)

* Update Contacts section

* CLICKHOUSE-2849: more detailed legal information

* CLICKHOUSE-2978 preparation - split by files

* More changes in Contacts block

* Tune texts on index page

* update presentations

* One more benchmark

* Add usage sections to index page, adapted from slides

* Get the roadmap started, based on slides from last ClickHouse Meetup

* CLICKHOUSE-2977: some rendering tuning

* Get rid of excessive section in the end of getting started

* Make headers linkable

* CLICKHOUSE-2981: links to editing reference - #849

* CLICKHOUSE-2981: fix mobile styles in docs

* Ban crawling of duplicating docs

* Open some external links in new tab

* Ban old docs too

* Lots of trivial fixes in english docs

* Lots of trivial fixes in russian docs

* Remove getting started copies in markdown

* Add Yandex.Webmaster

* Fix some sphinx warnings

* More warnings fixed in english docs

* More sphinx warnings fixed

* Add code-block:: text

* More code-block:: text

* These headers look not that well

* Better switch between documentation languages

* merge use_case.rst into ya_metrika_task.rst

* Edit the agg_functions.rst texts

* Add lost empty lines

* Lost blank lines

* Add new logo sizes

* update presentations

* Next step in migrating to new documentation

* Fix all warnings in en reference

* Fix all warnings in ru reference

* Re-arrange existing reference

* Move operation tips to main reference

* Fix typos noticed by milovidov@

* Get rid of zookeeper.md

* Looks like duplicate of tutorial.html

* Fix some mess with html tags in tutorial

* No idea why nobody noticed this before, but it was completely not clear whet to get the data

* Match code block styling between main and tutorial pages (in favor of the latter)

* Get rid of some copypaste in tutorial

* Normalize header styles

* Move example_datasets to sphinx

* Move presentations submodule to website

* Move and update README.md

* No point in duplicating articles from habrahabr here

* Move development-related docs as is for now

* doc/reference/ -> docs/ (to match the URL on website)

* Adapt links to match the previous commit

* Adapt development docs to rst (still lacks translation and strikethrough support)

* clean on release

* blacklist presentations in gulp

* strikethrough support in sphinx

* just copy development folder for now

* fix weird introduction in style article

* Style guide translation (WIP)

* Finish style guide translation to English

* gulp clean separately

* Update year in LICENSE

* Initial CONTRIBUTING.md

* Fix remaining links to old docs in tutorial

* Some tutorial fixes

* Typo

* Another typo

* Update list of authors from yandex-team accoding to git log

* Fix diff with master

* couple fixes in en what_is_clickhouse.rst

* Try different link to blog in Russian

* Swap words

* Slightly larger line height

* CLICKHOUSE-3089: disable hyphenation in docs

* update presentations

* Fix copying of txt files

* update submodule

* CLICKHOUSE-3108: fix overflow issues in mobile version

* Less weird tutorial header in mobile version

* CLICKHOUSE-3073: skip sourcemaps by default

* CLICKHOUSE-3067: rename item in docs navigation

* fix list markup

* CLICKHOUSE-3067: some documentation style tuning

* CLICKHOUSE-3067: less laggy single page documentation

* update presentations

* YQL-3278: add some links to ClickHouse Meetup in Berlin on October 5, 2017

* Add "time series" keyword

* Switch link to next event

* Switch link to next event #2

* smaller font

* Remove Palo Alto link

* Add link to Success stories list

* better title

* Update index.html

* Update index.html
@slw slw mentioned this pull request Nov 9, 2017
alexey-milovidov pushed a commit that referenced this pull request Feb 21, 2018
* update presentations

* CLICKHOUSE-2936: redirect from clickhouse.yandex.ru and clickhouse.yandex.com

* update submodule

* lost files

* CLICKHOUSE-2981: prefer sphinx docs over original reference

* CLICKHOUSE-2981: docs styles more similar to main website + add flags to switch language links

* update presentations

* Less confusing directory structure (docs -> doc/reference/)

* Minify sphinx docs too

* Website release script: fail fast + pass docker hash on deploy

* Do not underline links in docs

* shorter

* cleanup docker images

* tune nginx config

* CLICKHOUSE-3043: get rid of habrastorage links

* Lost translation

* CLICKHOUSE-2936: temporary client-side redirect

* behaves weird in test

* put redirect back

* CLICKHOUSE-3047: copy docs txts to public too

* move to proper file

* remove old pages to avoid confusion

* Remove reference redirect warning for now

* Refresh README.md

* Yellow buttons in docs

* Use svg flags instead of unicode ones in docs

* fix test website instance

* Put flags to separate files

* wrong flag

* Copy Yandex.Metrica introduction from main page to docs

* Yet another home page structure change, couple new blocks (CLICKHOUSE-3045)

* Update Contacts section

* CLICKHOUSE-2849: more detailed legal information

* CLICKHOUSE-2978 preparation - split by files

* More changes in Contacts block

* Tune texts on index page

* update presentations

* One more benchmark

* Add usage sections to index page, adapted from slides

* Get the roadmap started, based on slides from last ClickHouse Meetup

* CLICKHOUSE-2977: some rendering tuning

* Get rid of excessive section in the end of getting started

* Make headers linkable

* CLICKHOUSE-2981: links to editing reference - #849

* CLICKHOUSE-2981: fix mobile styles in docs

* Ban crawling of duplicating docs

* Open some external links in new tab

* Ban old docs too

* Lots of trivial fixes in english docs

* Lots of trivial fixes in russian docs

* Remove getting started copies in markdown

* Add Yandex.Webmaster

* Fix some sphinx warnings

* More warnings fixed in english docs

* More sphinx warnings fixed

* Add code-block:: text

* More code-block:: text

* These headers look not that well

* Better switch between documentation languages

* merge use_case.rst into ya_metrika_task.rst

* Edit the agg_functions.rst texts

* Add lost empty lines

* Lost blank lines

* Add new logo sizes

* update presentations

* Next step in migrating to new documentation

* Fix all warnings in en reference

* Fix all warnings in ru reference

* Re-arrange existing reference

* Move operation tips to main reference

* Fix typos noticed by milovidov@

* Get rid of zookeeper.md

* Looks like duplicate of tutorial.html

* Fix some mess with html tags in tutorial

* No idea why nobody noticed this before, but it was completely not clear whet to get the data

* Match code block styling between main and tutorial pages (in favor of the latter)

* Get rid of some copypaste in tutorial

* Normalize header styles

* Move example_datasets to sphinx

* Move presentations submodule to website

* Move and update README.md

* No point in duplicating articles from habrahabr here

* Move development-related docs as is for now

* doc/reference/ -> docs/ (to match the URL on website)

* Adapt links to match the previous commit

* Adapt development docs to rst (still lacks translation and strikethrough support)

* clean on release

* blacklist presentations in gulp

* strikethrough support in sphinx

* just copy development folder for now

* fix weird introduction in style article

* Style guide translation (WIP)

* Finish style guide translation to English

* gulp clean separately

* Update year in LICENSE

* Initial CONTRIBUTING.md

* Fix remaining links to old docs in tutorial

* Some tutorial fixes

* Typo

* Another typo

* Update list of authors from yandex-team accoding to git log

* Fix diff with master

* couple fixes in en what_is_clickhouse.rst

* Try different link to blog in Russian

* Swap words

* Slightly larger line height

* CLICKHOUSE-3089: disable hyphenation in docs

* update presentations

* Fix copying of txt files

* update submodule

* CLICKHOUSE-3108: fix overflow issues in mobile version

* Less weird tutorial header in mobile version

* CLICKHOUSE-3073: skip sourcemaps by default

* CLICKHOUSE-3067: rename item in docs navigation

* fix list markup

* CLICKHOUSE-3067: some documentation style tuning

* CLICKHOUSE-3067: less laggy single page documentation

* update presentations

* YQL-3278: add some links to ClickHouse Meetup in Berlin on October 5, 2017

* Add "time series" keyword

* Switch link to next event

* Switch link to next event #2

* smaller font

* Remove Palo Alto link

* Add link to Success stories list

* better title

* Update index.html

* Update index.html

* Do not expect gulp in $PATH

* Add link to Beijing meetup

* ignore presentations

* introduce requirements.txt

* Apply hacks by bayonet@ using monkey patching

* Simplify and fix patching of "single" docs on Mac OS (it still has a bug on chunk borders though)

* remove hidden symbol

* s/2016–2017/2016–2018/g

* Add some place to put virtualenv

* mkdocs was missing from requirements.txt

* This way it hurts eyes less

* Change header layout + add flags

* yandex_fonts.css -> custom.css

* Larger docs logo

* Shorter link

* Link to home from logo

* Borrow some more styles from main page

* Tune some links

* Remove shadow

* Add header border

* Header font

* Better flag margin

* Improve single page mode

* Fix search results hover

* Fix some MarkDown errors

* Silence useless error

* Get rid of index.html's

* Enable syntax highlight

* Fix link label in ru

* More style fixes in documentation scripts
blinkov referenced this pull request in blinkov/ClickHouse Jul 9, 2018
alexey-milovidov pushed a commit that referenced this pull request Jul 9, 2018
…opypaste (#2616)

* Clean up docs folder by moving all build-related tools to subdirectory

* Remove unused script

* Remove unused script #2

* Some refactoring in concatenate.py

* Rewrite build.sh in Python

- Get rid of half of copypaste in yml files
- Draft of redirects support

* Actually include redirects.conf

* copy conf too

* Keep H1 the same in single page docs

* fix some paths

* Keep only pages index in yaml

* Workaround for missing jQuery

* Delay docs init
blinkov referenced this pull request in blinkov/ClickHouse Jul 11, 2018
alexey-milovidov pushed a commit that referenced this pull request Sep 1, 2018
alexey-milovidov pushed a commit that referenced this pull request Feb 9, 2019
ogorbacheva added a commit to ogorbacheva/ClickHouse that referenced this pull request Mar 14, 2019
ogorbacheva added a commit to ogorbacheva/ClickHouse that referenced this pull request Mar 14, 2019
vitlibar referenced this pull request in vitlibar/ClickHouse Apr 13, 2019
KochetovNicolai pushed a commit that referenced this pull request May 14, 2019
code style AggregateFunctionMLMethod.cpp
azat added a commit to azat/ClickHouse that referenced this pull request May 19, 2019
SimpleAggregateFunction do not pass arena to the
add_function -> getAddressOfAddFunction(), hence next crash happens:
  (gdb) bt
  #0  DB::Arena::alloc (size=64, this=0x0) at ../dbms/src/Common/Arena.h:124
  ClickHouse#1  DB::SingleValueDataString::changeImpl (this=0x7f97424a27d8, value=..., arena=0x0) at ../dbms/src/AggregateFunctions/AggregateFunctionMinMaxAny.h:274
  ClickHouse#2  0x0000000005ea5319 in DB::AggregateFunctionNullUnary<true>::add (arena=<optimized out>, row_num=<optimized out>, columns=<optimized out>, place=<optimized out>, this=<optimized out>) at ../dbms/src/AggregateFunctions/AggregateFunctionNull.h:43
  ClickHouse#3  DB::IAggregateFunctionHelper<DB::AggregateFunctionNullUnary<true> >::addFree (that=<optimized out>, place=<optimized out>, columns=<optimized out>, row_num=<optimized out>, arena=<optimized out>) at ../dbms/src/AggregateFunctions/IAggregateFunction.h:131
  ClickHouse#4  0x000000000679772f in DB::AggregatingSortedBlockInputStream::addRow (this=this@entry=0x7f982de19c00, cursor=...) at ../dbms/src/Common/AlignedBuffer.h:31
  ClickHouse#5  0x0000000006797faa in DB::AggregatingSortedBlockInputStream::merge (this=this@entry=0x7f982de19c00, merged_columns=..., queue=...) at ../dbms/src/DataStreams/AggregatingSortedBlockInputStream.cpp:140
  ClickHouse#6  0x0000000006798979 in DB::AggregatingSortedBlockInputStream::readImpl (this=0x7f982de19c00) at ../dbms/src/DataStreams/AggregatingSortedBlockInputStream.cpp:78
  ClickHouse#7  0x000000000622db55 in DB::IBlockInputStream::read (this=0x7f982de19c00) at ../dbms/src/DataStreams/IBlockInputStream.cpp:56
  ClickHouse#8  0x0000000006613bee in DB::MergeTreeDataMergerMutator::mergePartsToTemporaryPart (this=this@entry=0x7f97ec65e1a0, future_part=..., merge_entry=..., time_of_merge=<optimized out>, disk_reservation=<optimized out>, deduplicate=<optimized out>) at /usr/include/c++/8/bits/shared_ptr_base.h:1018
  ClickHouse#9  0x000000000658f7a4 in DB::StorageReplicatedMergeTree::tryExecuteMerge (this=0x7f97ec65b810, entry=...) at /usr/include/c++/8/bits/unique_ptr.h:342
  ClickHouse#10 0x00000000065940ab in DB::StorageReplicatedMergeTree::executeLogEntry (this=0x7f97ec65b810, entry=...) at ../dbms/src/Storages/StorageReplicatedMergeTree.cpp:910
  <snip>

  (gdb) f 1
  (gdb) p MAX_SMALL_STRING_SIZE
  $1 = 48
  (gdb) p capacity
  $2 = 64
  (gdb) p value
  $3 = {data = 0x7f97242fcbd0 "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH", size = 61}

v2: avoid leaking of allocated by Arena memory on the intermediate step

Fixes: 8f8d2c0 ("Merge pull request ClickHouse#4629 from bgranvea/simple_aggregate_function")
github-merge-queue bot pushed a commit that referenced this pull request Sep 28, 2024
Improve restoring of access entities' dependencies #2
robot-ch-test-poll3 added a commit that referenced this pull request Sep 28, 2024
Backport #69563 to 24.9: Improve restoring of access entities' dependencies #2
github-merge-queue bot pushed a commit that referenced this pull request Nov 14, 2024
…ckup-sync-2

Corrections after reworking backup/restore synchronization #2
github-merge-queue bot pushed a commit that referenced this pull request Nov 25, 2024
…ar-name

Read AWS EKS token from file, attempt #2
robot-ch-test-poll added a commit that referenced this pull request Nov 25, 2024
Cherry pick #72397 to 24.11: Read AWS EKS token from file, attempt #2
thevar1able added a commit that referenced this pull request Nov 25, 2024
Backport #72397 to 24.11: Read AWS EKS token from file, attempt #2
azat added a commit to azat/ClickHouse that referenced this pull request Feb 10, 2025
CI: https://s3.amazonaws.com/clickhouse-test-reports/75848/479ca9b0a40fa32074501bea7d9eb7d369f3ddd4/integration_tests__tsan__2_6_.html

<details>

<summary>Race</summary>

```
E           Exception: Sanitizer assert found for instance ==================
E           WARNING: ThreadSanitizer: data race (pid=8)
E             Write of size 8 at 0x726000005c78 by thread T585 (mutexes: write M0, write M1):
E               #0 std::__1::enable_if<is_move_constructible<DB::SnapshotFileInfo*>::value && is_move_assignable<DB::SnapshotFileInfo*>::value, void>::type std::__1::swap[abi:ne180100]<DB::SnapshotFileInfo*>(DB::SnapshotFileInfo*&, DB::SnapshotFileInfo*&) build_docker/./contrib/llvm-project/libcxx/include/__utility/swap.h:44:7 (clickhouse+0x1dad0fb6) (BuildId: eb398fb9d76a60d418ba7222d10f730fae2208dc)
E               ClickHouse#1 std::__1::shared_ptr<DB::SnapshotFileInfo>::swap[abi:ne180100](std::__1::shared_ptr<DB::SnapshotFileInfo>&) build_docker/./contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:694:5 (clickhouse+0x1dad0fb6)
E               ClickHouse#2 std::__1::shared_ptr<DB::SnapshotFileInfo>::operator=[abi:ne180100](std::__1::shared_ptr<DB::SnapshotFileInfo>&&) build_docker/./contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:663:32 (clickhouse+0x1dad0fb6)
E               ClickHouse#3 DB::KeeperStateMachine<DB::KeeperStorage<DB::SnapshotableHashTable<DB::KeeperMemNode>>>::save_logical_snp_obj(nuraft::snapshot&, unsigned long&, nuraft::buffer&, bool, bool) build_docker/./src/Coordination/KeeperStateMachine.cpp:846:30 (clickhouse+0x1dad0fb6)

E             Previous read of size 8 at 0x726000005c78 by thread T572:
E               #0 std::__1::shared_ptr<DB::SnapshotFileInfo>::shared_ptr[abi:ne180100](std::__1::shared_ptr<DB::SnapshotFileInfo> const&) build_docker/./contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:565:82 (clickhouse+0x1daea9b2) (BuildId: eb398fb9d76a60d418ba7222d10f730fae2208dc)
E               ClickHouse#1 DB::KeeperStateMachine<DB::KeeperStorage<DB::SnapshotableHashTable<DB::KeeperMemNode>>>::create_snapshot(nuraft::snapshot&, std::__1::function<void (bool&, std::__1::shared_ptr<std::exception>&)>&)::'lambda'(std::__1::variant<std::__1::shared_ptr<DB::KeeperStorageSnapshot<DB::KeeperStorage<DB::SnapshotableHashTable<DB::KeeperMemNode>>>>, std::__1::shared_ptr<DB::KeeperStorageSnapshot<DB::KeeperStorage<DB::RocksDBContainer<DB::KeeperRocksNode>>>>>&&, bool)::operator()(std::__1::variant<std::__1::shared_ptr<DB::KeeperStorageSnapshot<DB::KeeperStorage<DB::SnapshotableHashTable<DB::KeeperMemNode>>>>, std::__1::shared_ptr<DB::KeeperStorageSnapshot<DB::KeeperStorage<DB::RocksDBContainer<DB::KeeperRocksNode>>>>>&&, bool) const build_docker/./src/Coordination/KeeperStateMachine.cpp:803:22 (clickhouse+0x1daea9b2)

```

</details>
azat added a commit to azat/ClickHouse that referenced this pull request Feb 11, 2025
CI: https://s3.amazonaws.com/clickhouse-test-reports/75848/479ca9b0a40fa32074501bea7d9eb7d369f3ddd4/integration_tests__tsan__2_6_.html

<details>

<summary>Race</summary>

```
E           Exception: Sanitizer assert found for instance ==================
E           WARNING: ThreadSanitizer: data race (pid=8)
E             Write of size 8 at 0x726000005c78 by thread T585 (mutexes: write M0, write M1):
E               #0 std::__1::enable_if<is_move_constructible<DB::SnapshotFileInfo*>::value && is_move_assignable<DB::SnapshotFileInfo*>::value, void>::type std::__1::swap[abi:ne180100]<DB::SnapshotFileInfo*>(DB::SnapshotFileInfo*&, DB::SnapshotFileInfo*&) build_docker/./contrib/llvm-project/libcxx/include/__utility/swap.h:44:7 (clickhouse+0x1dad0fb6) (BuildId: eb398fb9d76a60d418ba7222d10f730fae2208dc)
E               ClickHouse#1 std::__1::shared_ptr<DB::SnapshotFileInfo>::swap[abi:ne180100](std::__1::shared_ptr<DB::SnapshotFileInfo>&) build_docker/./contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:694:5 (clickhouse+0x1dad0fb6)
E               ClickHouse#2 std::__1::shared_ptr<DB::SnapshotFileInfo>::operator=[abi:ne180100](std::__1::shared_ptr<DB::SnapshotFileInfo>&&) build_docker/./contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:663:32 (clickhouse+0x1dad0fb6)
E               ClickHouse#3 DB::KeeperStateMachine<DB::KeeperStorage<DB::SnapshotableHashTable<DB::KeeperMemNode>>>::save_logical_snp_obj(nuraft::snapshot&, unsigned long&, nuraft::buffer&, bool, bool) build_docker/./src/Coordination/KeeperStateMachine.cpp:846:30 (clickhouse+0x1dad0fb6)

E             Previous read of size 8 at 0x726000005c78 by thread T572:
E               #0 std::__1::shared_ptr<DB::SnapshotFileInfo>::shared_ptr[abi:ne180100](std::__1::shared_ptr<DB::SnapshotFileInfo> const&) build_docker/./contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:565:82 (clickhouse+0x1daea9b2) (BuildId: eb398fb9d76a60d418ba7222d10f730fae2208dc)
E               ClickHouse#1 DB::KeeperStateMachine<DB::KeeperStorage<DB::SnapshotableHashTable<DB::KeeperMemNode>>>::create_snapshot(nuraft::snapshot&, std::__1::function<void (bool&, std::__1::shared_ptr<std::exception>&)>&)::'lambda'(std::__1::variant<std::__1::shared_ptr<DB::KeeperStorageSnapshot<DB::KeeperStorage<DB::SnapshotableHashTable<DB::KeeperMemNode>>>>, std::__1::shared_ptr<DB::KeeperStorageSnapshot<DB::KeeperStorage<DB::RocksDBContainer<DB::KeeperRocksNode>>>>>&&, bool)::operator()(std::__1::variant<std::__1::shared_ptr<DB::KeeperStorageSnapshot<DB::KeeperStorage<DB::SnapshotableHashTable<DB::KeeperMemNode>>>>, std::__1::shared_ptr<DB::KeeperStorageSnapshot<DB::KeeperStorage<DB::RocksDBContainer<DB::KeeperRocksNode>>>>>&&, bool) const build_docker/./src/Coordination/KeeperStateMachine.cpp:803:22 (clickhouse+0x1daea9b2)

```

</details>

v2: guard latest_snapshot_meta and latest_snapshot_buf as well (thanks to @davenger)
azat added a commit to azat/ClickHouse that referenced this pull request Mar 23, 2025
CI found [1] data-race:

    WARNING: ThreadSanitizer: data race (pid=2462)
      Write of size 8 at 0x7250003046d8 by thread T638:
        #0 std::__1::unique_ptr<ThreadFromGlobalPoolImpl<true, true>, std::__1::default_delete<ThreadFromGlobalPoolImpl<true, true>>>::reset[abi:ne190107](ThreadFromGlobalPoolImpl<true, true>*) build_docker/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:290:20 (clickhouse+0x1b7cb690) (BuildId: 4a160c0aae7301fdf3b5d5fc2cec3707e5318bfa)
        ClickHouse#1 std::__1::unique_ptr<ThreadFromGlobalPoolImpl<true, true>, std::__1::default_delete<ThreadFromGlobalPoolImpl<true, true>>>::operator=[abi:ne190107](std::__1::unique_ptr<ThreadFromGlobalPoolImpl<true, true>, std::__1::default_delete<ThreadFromGlobalPoolImpl<true, true>>>&&) build_docker/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:232:5 (clickhouse+0x1b7cb690)
        ClickHouse#2 DB::ObjectStorageQueueMetadata::startup() build_docker/./src/Storages/ObjectStorageQueue/ObjectStorageQueueMetadata.cpp:173:32 (clickhouse+0x1b7cb690)
        ClickHouse#3 DB::StorageObjectStorageQueue::startup() build_docker/./src/Storages/ObjectStorageQueue/StorageObjectStorageQueue.cpp:269:25 (clickhouse+0x1b89f8d6) (BuildId: 4a160c0aae7301fdf3b5d5fc2cec3707e5318bfa)

      Previous read of size 8 at 0x7250003046d8 by thread T659:
        #0 std::__1::unique_ptr<ThreadFromGlobalPoolImpl<true, true>, std::__1::default_delete<ThreadFromGlobalPoolImpl<true, true>>>::operator bool[abi:ne190107]() const build_docker/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:279:19 (clickhouse+0x1b7cb4b8) (BuildId: 4a160c0aae7301fdf3b5d5fc2cec3707e5318bfa)
        ClickHouse#1 DB::ObjectStorageQueueMetadata::startup() build_docker/./src/Storages/ObjectStorageQueue/ObjectStorageQueueMetadata.cpp:172:10 (clickhouse+0x1b7cb4b8)
        ClickHouse#2 DB::StorageObjectStorageQueue::startup() build_docker/./src/Storages/ObjectStorageQueue/StorageObjectStorageQueue.cpp:269:25 (clickhouse+0x1b89f8d6) (BuildId: 4a160c0aae7301fdf3b5d5fc2cec3707e5318bfa)

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=77841&sha=42886968f1af877d77394c74cf07e0bf9dcbda45&name_0=PR&name_1=Integration+tests+%28tsan%2C+6%2F6%29

The reason is pretty obvious, the tables in test_registry shares the
same metadata object and on server restart may try to initialize it
twice, that leads to a data-race above.
azat added a commit to azat/ClickHouse that referenced this pull request May 30, 2025
MSan reports:

  Uninitialized value was stored to memory at
    #0 0xabcb3f7bdd40 in ReservoirSamplerDeterministic<char8_t, (ReservoirSamplerDeterministicOnEmpty)1>::write(DB::WriteBuffer&) const .build-msan/./src/AggregateFunctions/ReservoirSamplerDeterministic.h:198:18
    ClickHouse#1 0xabcb3f7bdd40 in DB::(anonymous namespace)::QuantileReservoirSamplerDeterministic<char8_t>::serialize(DB::WriteBuffer&) const .build-msan/./src/AggregateFunctions/AggregateFunctionQuantileDeterministic.cpp:57:14
    ClickHouse#2 0xabcb3f7bdd40 in DB::AggregateFunctionQuantile<char8_t, DB::(anonymous namespace)::QuantileReservoirSamplerDeterministic<char8_t>, DB::NameQuantileDeterministic, true, double, false, false>::serialize(char const*, DB::WriteBuffer&, std::__1::optional<unsigned long>) const .build-msan/./src/AggregateFunctions/AggregateFunctionQuantile.h:242:57
    ClickHouse#3 0xabcb4ae6e754 in DB::serializeToString(std::__1::shared_ptr<DB::IAggregateFunction const> const&, DB::IColumn const&, unsigned long, unsigned long) .build-msan/./src/DataTypes/Serializations/SerializationAggregateFunction.cpp:102:15
    ClickHouse#4 0xabcb4ae6e47c in DB::SerializationAggregateFunction::serializeText(DB::IColumn const&, unsigned long, DB::WriteBuffer&, DB::FormatSettings const&) const .build-msan/./src/DataTypes/Serializations/SerializationAggregateFunction.cpp:132:17

  Uninitialized value was stored to memory at
    #0 0xabcb3f7bdd40 in ReservoirSamplerDeterministic<char8_t, (ReservoirSamplerDeterministicOnEmpty)1>::write(DB::WriteBuffer&) const .build-msan/./src/AggregateFunctions/ReservoirSamplerDeterministic.h:198:18
    ClickHouse#1 0xabcb3f7bdd40 in DB::(anonymous namespace)::QuantileReservoirSamplerDeterministic<char8_t>::serialize(DB::WriteBuffer&) const .build-msan/./src/AggregateFunctions/AggregateFunctionQuantileDeterministic.cpp:57:14
    ClickHouse#2 0xabcb3f7bdd40 in DB::AggregateFunctionQuantile<char8_t, DB::(anonymous namespace)::QuantileReservoirSamplerDeterministic<char8_t>, DB::NameQuantileDeterministic, true, double, false, false>::serialize(char const*, DB::WriteBuffer&, std::__1::optional<unsigned long>) const .build-msan/./src/AggregateFunctions/AggregateFunctionQuantile.h:242:57
    ClickHouse#3 0xabcb4ae6e754 in DB::serializeToString(std::__1::shared_ptr<DB::IAggregateFunction const> const&, DB::IColumn const&, unsigned long, unsigned long) .build-msan/./src/DataTypes/Serializations/SerializationAggregateFunction.cpp:102:15
    ClickHouse#4 0xabcb4ae6e47c in DB::SerializationAggregateFunction::serializeText(DB::IColumn const&, unsigned long, DB::WriteBuffer&, DB::FormatSettings const&) const .build-msan/./src/DataTypes/Serializations/SerializationAggregateFunction.cpp:132:17

The problem is the assigment of the whole pair.

Fixes: ClickHouse#80862
Complete report: https://pastila.clickhouse.com/?0005f20c/c8363f3b9a4205781d88c2f3fe4a0841#19owb1ROpa4VkIUDulFBpw==
azat added a commit to azat/ClickHouse that referenced this pull request Jun 19, 2025
Found on CI [1]:

<details>

<summary>stacktrace</summary>

    WARNING: ThreadSanitizer: data race (pid=328014)
      Write of size 8 at 0x729800008140 by main thread:
        0 __tsan_memcpy <null> (clickhouse+0x8b061be) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        1 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) ci/tmp/build/./contrib/llvm-project/libcxx/include/string:2658:22 (clickhouse+0x191548c3) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        2 DB::SettingFieldTimezone::operator=(DB::SettingFieldTimezone const&) ci/tmp/build/./src/Core/SettingsFields.h:468:8 (clickhouse+0x191548c3)
        3 DB::SettingsTraits::Data::operator=(DB::SettingsTraits::Data const&) ci/tmp/build/./src/Core/Settings.cpp:6957:1 (clickhouse+0x191548c3)
        4 DB::BaseSettings<DB::SettingsTraits>::operator=(DB::BaseSettings<DB::SettingsTraits> const&) ci/tmp/build/./src/Core/BaseSettings.h:109:60 (clickhouse+0x18f98aec) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        5 DB::SettingsImpl::operator=(DB::SettingsImpl const&) ci/tmp/build/./src/Core/Settings.cpp:6963:8 (clickhouse+0x18f98aec)
        6 DB::Settings::operator=(DB::Settings const&) ci/tmp/build/./src/Core/Settings.cpp:7170:11 (clickhouse+0x18f98aec)
        7 DB::Context::setSettings(DB::Settings const&) ci/tmp/build/./src/Interpreters/Context.cpp:2618:15 (clickhouse+0x1a6aac4a) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        8 DB::ClientBase::processParsedSingleQuery(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::shared_ptr<DB::IAST>, bool&, unsigned long)::$_0::operator()() const ci/tmp/build/./src/Client/ClientBase.cpp:2180:9 (clickhouse+0x1db11597) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        9 BasicScopeGuard<DB::ClientBase::processParsedSingleQuery(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::shared_ptr<DB::IAST>, bool&, unsigned long)::$_0>::invoke() ci/tmp/build/./base/base/../base/scope_guard.h:101:9 (clickhouse+0x1db11597)
        10 BasicScopeGuard<DB::ClientBase::processParsedSingleQuery(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::shared_ptr<DB::IAST>, bool&, unsigned long)::$_0>::~BasicScopeGuard() ci/tmp/build/./base/base/../base/scope_guard.h:50:26 (clickhouse+0x1db11597)
        11 DB::ClientBase::processParsedSingleQuery(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::shared_ptr<DB::IAST>, bool&, unsigned long) ci/tmp/build/./src/Client/ClientBase.cpp:2245:5 (clickhouse+0x1db0418a) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        12 DB::ClientBase::executeMultiQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) ci/tmp/build/./src/Client/ClientBase.cpp:2618:21 (clickhouse+0x1db12b5e) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        13 DB::ClientBase::processQueryText(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) ci/tmp/build/./src/Client/ClientBase.cpp:2812:12 (clickhouse+0x1db142a6) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        14 DB::ClientBase::runInteractive() ci/tmp/build/./src/Client/ClientBase.cpp:3367:18 (clickhouse+0x1db1d57b) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        15 DB::Client::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) ci/tmp/build/./programs/client/Client.cpp:399:9 (clickhouse+0x128ba9c1) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        16 non-virtual thunk to DB::Client::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) ci/tmp/build/./programs/client/Client.cpp (clickhouse+0x128bb0a0) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        17 Poco::Util::Application::run() ci/tmp/build/./base/poco/Util/src/Application.cpp:315:8 (clickhouse+0x23017cbe) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        18 mainEntryClickHouseClient(int, char**) ci/tmp/build/./programs/client/Client.cpp:1139:23 (clickhouse+0x128c8ea6) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        19 main ci/tmp/build/./programs/main.cpp:323:21 (clickhouse+0x8b8ea04) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)

      Previous read of size 8 at 0x729800008140 by thread T2:
        #0 __tsan_memcpy <null> (clickhouse+0x8b061be) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        ClickHouse#1 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) ci/tmp/build/./contrib/llvm-project/libcxx/include/string:2658:22 (clickhouse+0x1259a1c7) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        ClickHouse#2 DateLUT::instance() ci/tmp/build/./src/Common/DateLUT.cpp:173:35 (clickhouse+0x1259a1c7)
        ClickHouse#3 DateLUT::instance(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) ci/tmp/build/./src/Common/DateLUT.h:29:20 (clickhouse+0x192bbab2) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        ClickHouse#4 TimezoneMixin::TimezoneMixin(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) ci/tmp/build/./src/DataTypes/TimezoneMixin.h:16:21 (clickhouse+0x192bbab2)
        ClickHouse#5 DB::DataTypeDateTime::DataTypeDateTime(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) ci/tmp/build/./src/DataTypes/DataTypeDateTime.cpp:13:7 (clickhouse+0x192bb645) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        6 std::__1::shared_ptr<DB::DataTypeDateTime> std::__1::allocate_shared[abi:ne190107]<DB::DataTypeDateTime, std::__1::allocator<DB::DataTypeDateTime>, 0>(std::__1::allocator<DB::DataTypeDateTime> const&) FunctionsExternalDictionaries.cpp (clickhouse+0x8ddfc9b) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        7 std::__1::shared_ptr<DB::DataTypeDateTime> std::__1::make_shared[abi:ne190107]<DB::DataTypeDateTime, 0>() ci/tmp/build/./contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:851:10 (clickhouse+0x193bbb51) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        8 DB::create(std::__1::shared_ptr<DB::IAST> const&) ci/tmp/build/./src/DataTypes/registerDataTypeDateTime.cpp:66:16 (clickhouse+0x193bbb51)
        9 decltype(std::declval<std::__1::shared_ptr<DB::IDataType const> (*&)(std::__1::shared_ptr<DB::IAST> const&)>()(std::declval<std::__1::shared_ptr<DB::IAST> const&>())) std::__1::__invoke[abi:ne190107]<std::__1::shared_ptr<DB::IDataType const> (*&)(std::__1::shared_ptr<DB::IAST> const&), std::__1::shared_ptr<DB::IAST> const&>(std::__1::shared_ptr<DB::IDataType const> (*&)(std::__1::shared_ptr<DB::IAST> const&), std::__1::shared_ptr<DB::IAST> const&) ci/tmp/build/./contrib/llvm-project/libcxx/include/__type_traits/invoke.h:149:25 (clickhouse+0x192b5ea3) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        10 std::__1::shared_ptr<DB::IDataType const> std::__1::__invoke_void_return_wrapper<std::__1::shared_ptr<DB::IDataType const>, false>::__call[abi:ne190107]<std::__1::shared_ptr<DB::IDataType const> (*&)(std::__1::shared_ptr<DB::IAST> const&), std::__1::shared_ptr<DB::IAST> const&>(std::__1::shared_ptr<DB::IDataType const> (*&)(std::__1::shared_ptr<DB::IAST> const&), std::__1::shared_ptr<DB::IAST> const&) ci/tmp/build/./contrib/llvm-project/libcxx/include/__type_traits/invoke.h:216:12 (clickhouse+0x192b5ea3)
        11 std::__1::__function::__default_alloc_func<std::__1::shared_ptr<DB::IDataType const> (*)(std::__1::shared_ptr<DB::IAST> const&), std::__1::shared_ptr<DB::IDataType const> (std::__1::shared_ptr<DB::IAST> const&)>::operator()[abi:ne190107](std::__1::shared_ptr<DB::IAST> const&) ci/tmp/build/./contrib/llvm-project/libcxx/include/__functional/function.h:210:12 (clickhouse+0x192b5ea3)
        12 std::__1::shared_ptr<DB::IDataType const> std::__1::__function::__policy_invoker<std::__1::shared_ptr<DB::IDataType const> (std::__1::shared_ptr<DB::IAST> const&)>::__call_impl[abi:ne190107]<std::__1::__function::__default_alloc_func<std::__1::shared_ptr<DB::IDataType const> (*)(std::__1::shared_ptr<DB::IAST> const&), std::__1::shared_ptr<DB::IDataType const> (std::__1::shared_ptr<DB::IAST> const&)>>(std::__1::__function::__policy_storage const*, std::__1::shared_ptr<DB::IAST> const&) ci/tmp/build/./contrib/llvm-project/libcxx/include/__functional/function.h:610:12 (clickhouse+0x192b5ea3)
        13 std::__1::__function::__policy_func<std::__1::shared_ptr<DB::IDataType const> (std::__1::shared_ptr<DB::IAST> const&)>::operator()[abi:ne190107](std::__1::shared_ptr<DB::IAST> const&) const ci/tmp/build/./contrib/llvm-project/libcxx/include/__functional/function.h:716:12 (clickhouse+0x192cfcc6) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        14 std::__1::function<std::__1::shared_ptr<DB::IDataType const> (std::__1::shared_ptr<DB::IAST> const&)>::operator()(std::__1::shared_ptr<DB::IAST> const&) const ci/tmp/build/./contrib/llvm-project/libcxx/include/__functional/function.h:989:10 (clickhouse+0x192cfcc6)
        15 std::__1::shared_ptr<DB::IDataType const> DB::DataTypeFactory::getImpl<false>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::shared_ptr<DB::IAST> const&) const ci/tmp/build/./src/DataTypes/DataTypeFactory.cpp:144:21 (clickhouse+0x192cfcc6)
        16 std::__1::shared_ptr<DB::IDataType const> DB::DataTypeFactory::getImpl<false>(std::__1::shared_ptr<DB::IAST> const&) const ci/tmp/build/./src/DataTypes/DataTypeFactory.cpp:91:16 (clickhouse+0x192cf5f3) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        17 std::__1::shared_ptr<DB::IDataType const> DB::DataTypeFactory::getImpl<false>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const ci/tmp/build/./src/DataTypes/DataTypeFactory.cpp:73:12 (clickhouse+0x192cf18d) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        18 DB::DataTypeFactory::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const ci/tmp/build/./src/DataTypes/DataTypeFactory.cpp:35:12 (clickhouse+0x192ccfa0) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        19 DB::NativeReader::read() ci/tmp/build/./src/Formats/NativeReader.cpp:188:45 (clickhouse+0x1dde11c2) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        20 DB::Connection::receiveDataImpl(DB::NativeReader&) ci/tmp/build/./src/Client/Connection.cpp:1396:24 (clickhouse+0x1db4c3c9) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        21 DB::Connection::receiveProfileEvents() ci/tmp/build/./src/Client/Connection.cpp:1408:12 (clickhouse+0x1db4b471) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        22 DB::Connection::receivePacket() ci/tmp/build/./src/Client/Connection.cpp:1345:29 (clickhouse+0x1db4b471)
        23 DB::Suggest::fetch(DB::IServerConnection&, DB::ConnectionTimeouts const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, DB::ClientInfo const&) ci/tmp/build/./src/Client/Suggest.cpp:170:36 (clickhouse+0x1dbbfce0) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        24 void DB::Suggest::load<DB::Connection>(std::__1::shared_ptr<DB::Context const>, DB::ConnectionParameters const&, int, bool)::'lambda'()::operator()() const ci/tmp/build/./src/Client/Suggest.cpp:103:17 (clickhouse+0x1dbc236e) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        25 decltype(std::declval<void DB::Suggest::load<DB::Connection>(std::__1::shared_ptr<DB::Context const>, DB::ConnectionParameters const&, int, bool)::'lambda'()>()()) std::__1::__invoke[abi:ne190107]<void DB::Suggest::load<DB::Connection>(std::__1::shared_ptr<DB::Context const>, DB::ConnectionParameters const&, int, bool)::'lambda'()>(void DB::Suggest::load<DB::Connection>(std::__1::shared_ptr<DB::Context const>, DB::ConnectionParameters const&, int, bool)::'lambda'()&&) ci/tmp/build/./contrib/llvm-project/libcxx/include/__type_traits/invoke.h:149:25 (clickhouse+0x1dbc2038) (BuildId: 50a1015145bb9fb79089f4828db24f2dae0945e5)
        26 void std::__1::__thread_execute[abi:ne190107]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void DB::Suggest::load<DB::Connection>(std::__1::shared_ptr<DB::Context const>, DB::ConnectionParameters const&, int, bool)::'lambda'()>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void DB::Suggest::load<DB::Connection>(std::__1::shared_ptr<DB::Context const>, DB::ConnectionParameters const&, int, bool)::'lambda'()>&, std::__1::__tuple_indices<...>) ci/tmp/build/./contrib/llvm-project/libcxx/include/__thread/thread.h:192:3 (clickhouse+0x1dbc2038)
        27 void* std::__1::__thread_proxy[abi:ne190107]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void DB::Suggest::load<DB::Connection>(std::__1::shared_ptr<DB::Context const>, DB::ConnectionParameters const&, int, bool)::'lambda'()>>(void*) ci/tmp/build/./contrib/llvm-project/libcxx/include/__thread/thread.h:201:3 (clickhouse+0x1dbc2038)

</details>

What is interesting that it has been pops up only after ClickHouse#81759

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/PRs/82168/8ab5ff7cd742626a263fd7a262d4ff86aa28880d//stateless_tests_amd_tsan_s3_storage_3_3/job.log
azat added a commit to azat/ClickHouse that referenced this pull request Jun 30, 2025
Otherwise it may lead to data-race:

    WARNING: ThreadSanitizer: data race (pid=26127)
      Write of size 6 at 0x7298000099e8 by main thread:
        0 __tsan_memcpy <null> (clickhouse-82444-tsan+0x8be71be) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)
        1 DB::SettingsTraits::Data::operator=(DB::SettingsTraits::Data const&) ci/tmp/build/./src/Core/Settings.cpp:6978:1 (clickhouse-82444-tsan+0x192ae4f9) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)
        2 DB::BaseSettings<DB::SettingsTraits>::operator=(DB::BaseSettings<DB::SettingsTraits> const&) ci/tmp/build/./src/Core/BaseSettings.h:109:60 (clickhouse-82444-tsan+0x190f2bcc) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)
        3 DB::SettingsImpl::operator=(DB::SettingsImpl const&) ci/tmp/build/./src/Core/Settings.cpp:6984:8 (clickhouse-82444-tsan+0x190f2bcc)
        4 DB::Settings::operator=(DB::Settings const&) ci/tmp/build/./src/Core/Settings.cpp:7191:11 (clickhouse-82444-tsan+0x190f2bcc)
        5 DB::Context::setSettings(DB::Settings const&) ci/tmp/build/./src/Interpreters/Context.cpp:2635:15 (clickhouse-82444-tsan+0x1aa94c0a) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)
        6 DB::ClientBase::processParsedSingleQuery(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::shared_ptr<DB::IAST>, bool&, unsigned long)::$_0::operator()() const ci/tmp/build/./src/Client/ClientBase.cpp:2184:9 (clickhouse-82444-tsan+0x1df0f4d7) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)
        7 BasicScopeGuard<DB::ClientBase::processParsedSingleQuery(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::shared_ptr<DB::IAST>, bool&, unsigned long)::$_0>::invoke() ci/tmp/build/./base/base/../base/scope_guard.h:101:9 (clickhouse-82444-tsan+0x1df0f4d7)
        8 BasicScopeGuard<DB::ClientBase::processParsedSingleQuery(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::shared_ptr<DB::IAST>, bool&, unsigned long)::$_0>::~BasicScopeGuard() ci/tmp/build/./base/base/../base/scope_guard.h:50:26 (clickhouse-82444-tsan+0x1df0f4d7)
        9 DB::ClientBase::processParsedSingleQuery(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::shared_ptr<DB::IAST>, bool&, unsigned long) ci/tmp/build/./src/Client/ClientBase.cpp:2249:5 (clickhouse-82444-tsan+0x1df021ca) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)

      Previous read of size 1 at 0x7298000099e8 by thread T4:
        #0 DB::SettingFieldNumber<bool>::operator bool() const ci/tmp/build/./src/Core/SettingsFields.h:40:36 (clickhouse-82444-tsan+0x1b114e5f) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)
        ClickHouse#1 DB::ThreadStatus::finalizePerformanceCounters() ci/tmp/build/./src/Interpreters/ThreadStatusExt.cpp:547:17 (clickhouse-82444-tsan+0x1b114e5f)
        ClickHouse#2 DB::ThreadStatus::detachFromGroup() ci/tmp/build/./src/Interpreters/ThreadStatusExt.cpp:375:5 (clickhouse-82444-tsan+0x1b113aec) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)
        ClickHouse#3 DB::CurrentThread::detachFromGroupIfNotDetached() ci/tmp/build/./src/Interpreters/ThreadStatusExt.cpp:716:21 (clickhouse-82444-tsan+0x1b1119b3) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)
        ClickHouse#4 DB::ThreadGroupSwitcher::~ThreadGroupSwitcher() ci/tmp/build/./src/Interpreters/ThreadStatusExt.cpp:261:9 (clickhouse-82444-tsan+0x1b1119b3)
        ClickHouse#5 DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::__1::function<void ()>>::operator()(std::__1::function<void ()>&&, Priority, std::__1::optional<unsigned long>)::'lambda'()::operator()() ci/tmp/build/./src/Common/threadPoolCallbackRunner.h:179:9 (clickhouse-82444-tsan+0x14beafde) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)

      Thread T4 'ThreadPool' (tid=26133, running) created by thread T3 at:
        ...
        12 DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::__1::function<void ()>>::operator()(std::__1::function<void ()>&&, Priority, std::__1::optional<unsigned long>) ci/tmp/build/./src/Common/threadPoolCallbackRunner.h:188:22 (clickhouse-82444-tsan+0x14be522d) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)
        13 DB::ParallelParsingInputFormat::scheduleParserThreadForUnitWithNumber(unsigned long) ci/tmp/build/./src/Processors/Formats/Impl/ParallelParsingInputFormat.h:287:9 (clickhouse-82444-tsan+0x1e495627) (BuildId: e5eeeb8fc2a0ab65c098bb1f3db89853f2439448)
        14 DB::ParallelParsingInputFormat::segmentatorThreadFunction(std::__1::shared_ptr<DB::ThreadGroup>) ci/tmp/build/./src/Processors/Formats/Impl/ParallelParsingInputFormat.cpp:45:13 (clickhouse-82444-tsan+0x1e495627)

Refs: https://pastila.nl/?0001fdef/9a58e9d59c32d45100a481de26dccf68#T4iNrMFUnu4F2hWST5wLdQ==
arsenmuk referenced this pull request in arsenmuk/ClickHouse Jul 26, 2025
arsenmuk referenced this pull request in arsenmuk/ClickHouse Jul 26, 2025
github-merge-queue bot pushed a commit that referenced this pull request Aug 20, 2025
github-merge-queue bot pushed a commit that referenced this pull request Sep 17, 2025
AVMusorin added a commit to AVMusorin/ClickHouse that referenced this pull request Nov 17, 2025
…y names

When ClickHouse encounters a distributed table directory with a name that:
- starts with the pattern `shardN_all_replicas` (e.g., `shard3_all_replicas_bkp`)
- but doesn't end with exactly `_all_replicas`

It would crash with a segmentation fault due to out-of-bounds array access.

Trace example:
```
* thread ClickHouse#1, name = 'clickhouse-serv', stop reason = signal SIGSEGV
  * frame #0: 0x000000001194481b clickhouse-server`DB::Cluster::Address::Address(DB::Cluster::Address const&) + 27
    frame ClickHouse#1: 0x0000000011944550 clickhouse-server`void std::__1::vector<DB::Cluster::Address, std::__1::allocator<DB::Cluster::Address> >::__push_back_slow_path<DB::Cluster::Address const&>(DB::Cluster::Address const&&&) + 208
    frame ClickHouse#2: 0x00000000129a6c35 clickhouse-server`DB::StorageDistributed::parseAddresses(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const + 3349
    frame ClickHouse#3: 0x00000000129a589b clickhouse-server`DB::StorageDistributed::getDirectoryQueue(std::__1::shared_ptr<DB::IDisk> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 3675
    frame ClickHouse#4: 0x00000000129a3f22 clickhouse-server`DB::StorageDistributed::initializeDirectoryQueuesForDisk(std::__1::shared_ptr<DB::IDisk> const&) + 2082
    frame ClickHouse#5: 0x000000000f681c48 clickhouse-server`DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >, std::__1::function<void ()> >::operator()(std::__1::function<void ()>&&, Priority)::'lambda'()::operator()() + 136
    frame ClickHouse#6: 0x000000000f68286c clickhouse-server`std::__1::packaged_task<void ()>::operator()() + 44
    frame ClickHouse#7: 0x000000000d83335b clickhouse-server`ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >::ThreadFromThreadPool::worker() + 2395
    frame ClickHouse#8: 0x000000000d839e23 clickhouse-server`void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<false, true>::ThreadFromGlobalPoolImpl<void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >::ThreadFromThreadPool::*)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >::ThreadFromThre
adPool*>(void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >::ThreadFromThreadPool::*&&)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >::ThreadFromThreadPool*&&)::'lambda'(), void ()> >(std::__1::__function::__policy_storage const*) + 99
    frame ClickHouse#9: 0x000000000d830602 clickhouse-server`ThreadPoolImpl<std::__1::thread>::ThreadFromThreadPool::worker() + 2242
    frame ClickHouse#10: 0x000000000d8379ba clickhouse-server`_ZNSt3__114__thread_proxyB6v15007INS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN14ThreadPoolImplINS_6threadEE20ThreadFromThreadPoolEFvvEPSA_EEEEEPvSF_ + 90
```
alexey-milovidov added a commit that referenced this pull request Dec 24, 2025
Docs: move aggregate functions docs to source (#2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants