ClickHouse® is a real-time analytics DBMS
Go to file
Azat Khuzhin 177cbbac4b Avoid race condition for updating system.distribution_queue values
Previously it was possible to have a race while updating
files_count/bytes_count, since INSERT updates it those counters from one
thread and the same metrics are updated from filesystem in a separate
thread, and even though the access is synchronized with the mutex it
avoids the race only for accessing the variables not the logical race,
since it is possible that getFiles() from a separate thread will
increment counters and later addAndSchedule() will increment them again.

Here you can find an example of this race [1].

  [1]: https://pastila.nl/?00950e00/41a3c7bbb0a7e75bd3f2922c58b02334

Note, that I analyzed logs from production system with lots of async
Distributed INSERT and everything is OK there, even though the logs
contains the following:

    2022.11.20 02:21:15.459483 [ 11528 ] {} <Trace> v21.dist_out.DirectoryMonitor: Files set to 35 (was 34)
    2022.11.20 02:21:15.459515 [ 11528 ] {} <Trace> v21.dist_out.DirectoryMonitor: Bytes set to 4035418 (was 3929008)
    2022.11.20 02:21:15.819488 [ 11528 ] {} <Trace> v21.dist_out.DirectoryMonitor: Files set to 1 (was 2)
    2022.11.20 02:21:15.819502 [ 11528 ] {} <Trace> v21.dist_out.DirectoryMonitor: Bytes set to 190072 (was 296482)

As you may see it first increases the counters and next update
decreases (and 4035418-3929008 == 296482-190072)

Refs: #23885
Reported-by: @tavplubix
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-20 14:13:01 +01:00
.github Merge pull request #43373 from ClickHouse/trying_to_split_checks 2022-11-19 13:42:15 +01:00
base Fix msan warning 2022-11-08 17:25:03 +01:00
benchmark Remove old file 2022-07-12 20:28:02 +02:00
cmake Update version to 22.12.1.1 2022-11-17 22:15:12 +01:00
contrib Merge branch 'master' into manual_snapshot_for_keeper 2022-11-03 08:55:01 +01:00
docker Splitting checks 2022-11-18 17:38:17 +01:00
docs docs: Clarified ZooKeeper tips comments. 2022-11-18 12:08:07 -05:00
packages Fix preserving user configs in rpm packages 2022-11-03 16:58:12 +01:00
programs Merge pull request #43227 from vitlibar/improve-masking-sensitive-info 2022-11-18 15:37:50 +01:00
rust Corrosion fixes + review fixes 2022-09-16 00:05:21 +03:00
src Avoid race condition for updating system.distribution_queue values 2022-11-20 14:13:01 +01:00
tests Merge pull request #43328 from ClickHouse/better-format-version-check 2022-11-18 22:34:37 +01:00
utils Merge pull request #43365 from ClickHouse/update-security-on-tag 2022-11-18 22:39:17 +01:00
website move-images-to-clickhouse-presentations 2022-08-10 04:04:56 +02:00
.clang-format add BeforeLambdaBody to .clang-format 2022-02-11 16:51:45 +01:00
.clang-tidy Function name normalization fix functions header 2022-10-04 17:29:33 +02:00
.editorconfig Changed tabs to spaces in editor configs and in style guide [#CLICKHOUSE-3]. 2017-04-01 11:35:09 +03:00
.git-blame-ignore-revs Add files with revision to ignore for git blame 2022-09-13 23:05:56 +02:00
.gitattributes Ignore core.autocrlf for tests references 2022-10-05 09:13:27 +02:00
.gitignore Merge remote-tracking branch 'origin/master' into revive-sqlancer 2022-10-26 08:31:00 +00:00
.gitmodules add Morton Coding (ZCurve) 2022-10-19 15:59:25 +02:00
.pylintrc Cover deprecated bad-* pylint options with black 2022-06-08 14:18:28 +02:00
.snyk Add exclusions from the Snyk scan 2022-10-31 17:47:02 +01:00
.vimrc Changed tabs to spaces in editor configs and in style guide [#CLICKHOUSE-3]. 2017-04-01 11:35:09 +03:00
.yamllint Drop truthy.check-keys from yamllint (does not supported on CI) 2021-02-21 06:15:36 +03:00
AUTHORS Update AUTHORS 2021-09-22 11:38:03 +03:00
CHANGELOG.md Add #43072 2022-11-17 21:03:18 +01:00
CMakeLists.txt fix 2022-10-29 18:58:11 +08:00
CODE_OF_CONDUCT.md Add minimal code of conduct #9676 2020-03-16 12:44:28 +03:00
CONTRIBUTING.md Mention ClickHouse CLA in CONTRIBUTING.md (#32697) 2021-12-14 03:47:19 +03:00
format_sources allow several <graphite> targets (#603) 2017-03-21 23:08:09 +04:00
LICENSE Update year 2022-01-27 01:01:27 +03:00
PreLoad.cmake Update PreLoad.cmake 2022-08-26 18:30:05 +08:00
README.md Update README.md 2022-10-28 13:58:14 -06:00
SECURITY.md Merge pull request #43365 from ClickHouse/update-security-on-tag 2022-11-18 22:39:17 +01:00

ClickHouse — open source distributed column-oriented DBMS

ClickHouse® is an open-source column-oriented database management system that allows generating analytical data reports in real-time.

  • Official website has a quick high-level overview of ClickHouse on the main page.
  • ClickHouse Cloud ClickHouse as a service, built by the creators and maintainers.
  • Tutorial shows how to set up and query a small ClickHouse cluster.
  • Documentation provides more in-depth information.
  • YouTube channel has a lot of content about ClickHouse in video format.
  • Slack and Telegram allow chatting with ClickHouse users in real-time.
  • Blog contains various ClickHouse-related articles, as well as announcements and reports about events.
  • Code Browser (Woboq) with syntax highlight and navigation.
  • Code Browser (github.dev) with syntax highlight, powered by github.dev.
  • Contacts can help to get your questions answered if there are any.

Upcoming events

  • v22.11 Release Webinar Original creator, co-founder, and CTO of ClickHouse Alexey Milovidov will walk us through the highlights of the release, provide live demos, and share vision into what is coming in the roadmap.
  • ClickHouse Meetup at the Deutsche Bank office in Berlin Hear from Deutsche Bank on why they chose ClickHouse for big sensitive data in a regulated environment. The ClickHouse team will then present how ClickHouse is used for real time financial data analytics, including tick data, trade analytics and risk management.
  • AWS re:Invent Core members of the ClickHouse team -- including 2 of our founders -- will be at re:Invent from November 29 to December 3. We are available on the show floor, but are also determining interest in holding an event during the time there.