Skip to content

Bump brotli from v1.0.9 to v1.2.0 - #119096

Merged
thevar1able merged 4 commits into
ClickHouse:masterfrom
actueleai:bump-brotli-v1.2.0
Oct 5, 2026
Merged

thevar1able merged 4 commits into
ClickHouse:masterfrom
actueleai:bump-brotli-v1.2.0

Conversation

@actueleai

@actueleai actueleai commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Bumps brotli to the upstream v1.2.0 release tag (from v1.0.9, released 2020), picking up two upstream releases including shared/compound dictionary support.

ClickHouse-side changes

  • .gitmodules — points contrib/brotli at https://github.com/google/brotli; the fork's only patch (removing recursive submodules) is obsolete because upstream v1.2.0 has no .gitmodules, and the fork has no v1.2.0 tag.
  • contrib/brotli-cmake/CMakeLists.txt — SRCS resynced with upstream's c/{common,dec,enc}/*.c glob, adding common/shared_dictionary.c, dec/prefix.c, dec/static_init.c, enc/compound_dictionary.c, enc/static_dict_lut.c, enc/static_init.c; dropped the BROTLI_BUILD_PORTABLE define, which no longer exists upstream.

Behaviour changes

  • Brotli-compressed output is no longer byte-identical to the previous version (default level shrinks ~1.3%). Decoding is unaffected: data written by either version reads correctly in the other.

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

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

Update brotli to v1.2.0.


Workflow [PR]
Sync PR [sync-upstream/pr/119096]

Version info

  • Merged into: 26.10.1.1594-master (included in 26.10 and later)

Update `brotli` from `v1.0.9` (plus one ClickHouse commit that removed the
recursive `research/esaxx` and `research/libdivsufsort` submodules) to the
upstream release `v1.2.0`.

Upstream `v1.2.0` no longer has a `.gitmodules` file, so the only reason for
the `ClickHouse/brotli` fork is gone and the submodule now points directly at
`https://github.com/google/brotli`.

Build integration changes in `contrib/brotli-cmake/CMakeLists.txt`:
- Added the new sources `common/shared_dictionary.c`, `dec/prefix.c`,
  `dec/static_init.c`, `enc/compound_dictionary.c`, `enc/static_dict_lut.c`
  and `enc/static_init.c`. The list now matches every `*.c` file under
  `c/common`, `c/dec` and `c/enc`, which is exactly what upstream's own
  `CMakeLists.txt` globs. `enc/static_init_lazy.cc` is deliberately left out:
  it is only used with `BROTLI_STATIC_INIT_LAZY`, and the default is
  `BROTLI_STATIC_INIT_NONE`.
- Removed `BROTLI_BUILD_PORTABLE=1`; the macro no longer exists anywhere in
  the `brotli` sources.

The public C API is additive (shared/compound dictionaries, decoder metadata
callbacks, `BrotliEncoderEstimatePeakMemoryUsage`), so `BrotliReadBuffer` and
`BrotliWriteBuffer` need no changes.

Co-Authored-By: Claude Opus 5 <[email protected]>
@thevar1able
thevar1able self-requested a review September 9, 2026 20:45
@thevar1able thevar1able self-assigned this Sep 9, 2026
@thevar1able thevar1able added the can be tested Allows running workflows for external contributors label Sep 9, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f8603ad]

Summary: ✅


AI Review

Summary

This PR updates vendored brotli from the old v1.0.9-based fork lineage to ClickHouse/v1.2.0 (upstream v1.2.0 plus the loongarch64 BROTLI_MODEL follow-up) and resyncs contrib/brotli-cmake/CMakeLists.txt to the new source layout. I do not see a regression test that proves the material compatibility claim behind the bump — that current ClickHouse still decodes br streams produced by the previous vendored encoder — so I am requesting one focused fixture-based test before merge.

Findings
  • ⚠️ Majors
    • [contrib/brotli:1] The PR explicitly claims cross-version decode compatibility, but the coverage still only exercises current-version round trips / CLI interop (tests/queries/0_stateless/00302_http_compression.sh, tests/queries/0_stateless/01059_storage_file_compression.sh, tests/queries/0_stateless/02115_write_buffers_finalize.sh). That would not catch a regression where current ClickHouse stops reading a br stream produced by the previously vendored brotli, which is the main user-visible compatibility risk of this dependency bump.
    • Suggested fix: add one focused stateless fixture produced by the old vendored commit and verify that current ClickHouse reads it through one existing brotli input path (file(...), ENGINE = File, or HTTP Content-Encoding: br).
Tests
  • ⚠️ Add the smallest possible cross-version compatibility test: one .br payload generated by the previous vendored encoder and one query proving current ClickHouse decodes it successfully.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Add one focused regression test proving current ClickHouse can decode data produced by the previous vendored brotli.

LLVM Coverage Report

Measured on commit f8603ad.

Metric Baseline Current Δ
Lines 88.10% 88.10% +0.00%
Functions 91.70% 91.70% +0.00%
Branches 79.50% 79.50% +0.00%

Changed lines: Uncovered code analysis did not run: No coverable C/C++ source files changed (contrib/ is excluded from coverage).

Newly covered: +198 lines in 52 files (-111 lines lost coverage) · Details

Full report

@clickhouse-gh clickhouse-gh Bot added pr-build Pull request with build/testing/packaging improvement submodule changed At least one submodule changed in this PR. comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. labels Sep 9, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing f8603ad57 with master 782be4dce (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

⚠️ Significant changes: object file sizes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes ⚠️

20 object files changed (+208.67 KiB total), 6 added.

Object file Master PR Δ
contrib/brotli-cmake/CMakeFiles/_brotli.dir/__/brotli/c/enc/static_dict_lut.c.o new 331.87 KiB +331.87 KiB
contrib/brotli-cmake/CMakeFiles/_brotli.dir/__/brotli/c/enc/encoder_dict.c.o 333.49 KiB 7.02 KiB -326.47 KiB (-97.89%)
contrib/brotli-cmake/CMakeFiles/_brotli.dir/__/brotli/c/enc/backward_references.c.o 116.44 KiB 296.61 KiB +180.17 KiB (+154.73%)

719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

57 translation units recompiled, 100 s compile time in total, 51 of them have a recent master baseline.

Job report

@thevar1able
thevar1able marked this pull request as ready for review September 10, 2026 20:18
@clickhouse-gh clickhouse-gh Bot added the external Author is not a member of the ClickHouse organization label Sep 11, 2026
@maxknv maxknv removed the external Author is not a member of the ClickHouse organization label Sep 11, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Sep 21, 2026
set(SRCS
"${BROTLI_SOURCE_DIR}/enc/command.c"
"${BROTLI_SOURCE_DIR}/enc/fast_log.c"
"${BROTLI_SOURCE_DIR}/common/constants.c"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR body promises that data written by the previous vendored brotli still decodes correctly after this bump, but I do not see any test that actually exercises that contract. The existing brotli coverage (00302_http_compression.sh, 01059_storage_file_compression.sh, 02115_write_buffers_finalize.sh, etc.) is current-version round trips / CLI interop, so it would not catch a regression where ClickHouse stops reading a stream produced by the old vendored encoder.

Please add one focused stateless fixture generated by the previous vendored submodule commit and verify that current ClickHouse still reads it through one of the brotli read paths (File, file, or HTTP Content-Encoding: br).

alexey-milovidov and others added 2 commits September 26, 2026 02:52
Upstream `v1.2.0` applies `__attribute__((model("small")))` through
`BROTLI_MODEL` whenever the compiler supports the `model` attribute, which
breaks the loongarch64 build with `code model 'small' is not supported on
this target`. Point the submodule back to the `ClickHouse/brotli` fork, at
branch `ClickHouse/v1.2.0`: `v1.2.0` plus the cherry-picked upstream commit
google/brotli@e230f474b8 ("disable BROTLI_MODEL macro for some targets").

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=119096&sha=3f405fc724ee1ee5db9603cb47188f5129beca8b&name_0=PR&name_1=Build%20%28loongarch64%29
PR: ClickHouse#119096

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thevar1able
thevar1able added this pull request to the merge queue Oct 5, 2026
Merged via the queue into ClickHouse:master with commit 980a040 Oct 5, 2026
149 checks passed
@thevar1able
thevar1able deleted the bump-brotli-v1.2.0 branch October 5, 2026 15:56
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 5, 2026
alexey-milovidov added a commit that referenced this pull request Oct 26, 2026
Resolve the `contrib/brotli` submodule conflict by taking the cherry-picked pin `2d9c9b61f4e7` (v1.2.1). 26.9 is still on v1.0.9, so the merge keeps master's `contrib/brotli-cmake/CMakeLists.txt` from #119096, which v1.2.x needs to link.
alexey-milovidov added a commit that referenced this pull request Oct 26, 2026
The merge of `backport/26.9/127419` kept 26.9's `contrib/brotli-cmake/CMakeLists.txt`, which lists the v1.0.9 sources. The cherry-picked pin is v1.2.1, which needs the build script from #119096 to link.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov pushed a commit that referenced this pull request Oct 26, 2026
Merge backport/26.3/127419 into cherrypick/26.3/127419. The only conflict is
the contrib/brotli submodule: 26.3 pins brotli v1.0.9 (d224526f8fa7), while
master moved v1.2.0 -> v1.2.1. Take the master pin 2d9c9b61f4e7 (the
ClickHouse fork of v1.2.1) and master's contrib/brotli-cmake/CMakeLists.txt
source list from #119096 (v1.0.9 -> v1.2.0), without which v1.2.x does not
link. src/CMakeLists.txt and the new gtest merge cleanly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov pushed a commit that referenced this pull request Oct 26, 2026
Merge backport/26.8/127419 into cherrypick/26.8/127419. The only conflict is
the contrib/brotli submodule: 26.8 pins brotli v1.0.9 (d224526f8fa7), while
master moved v1.2.0 -> v1.2.1. Take the master pin 2d9c9b61f4e7 (the
ClickHouse fork of v1.2.1) and master's contrib/brotli-cmake/CMakeLists.txt
source list from #119096 (v1.0.9 -> v1.2.0), without which v1.2.x does not
link. src/CMakeLists.txt and the new gtest merge cleanly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. manual approve Manual approve required to run CI pr-build Pull request with build/testing/packaging improvement pr-synced-to-cloud The PR is synced to the cloud repo submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants