Skip to content

zstd: Update zstd to 1.5.6 for cmake 4 compatability#65915

Merged
SrinivasaBharath merged 2 commits intoceph:mainfrom
edwinzrodriguez:ceph-zstd-update
Nov 20, 2025
Merged

zstd: Update zstd to 1.5.6 for cmake 4 compatability#65915
SrinivasaBharath merged 2 commits intoceph:mainfrom
edwinzrodriguez:ceph-zstd-update

Conversation

@edwinzrodriguez
Copy link
Contributor

cmake 4 drops support for cmake_minimum_required < 3.5 This update bumps zstd to support newer cmake version

Fixes: https://tracker.ceph.com/issues/73522

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@edwinzrodriguez edwinzrodriguez force-pushed the ceph-zstd-update branch 2 times, most recently from d7e1a48 to 9df8408 Compare October 13, 2025 21:25
@edwinzrodriguez
Copy link
Contributor Author

jenkins test make check arm64

@edwinzrodriguez
Copy link
Contributor Author

jenkins test make check arm64

@adamemerson adamemerson requested review from a team and tchaikov October 20, 2025 19:40
@edwinzrodriguez edwinzrodriguez mentioned this pull request Oct 20, 2025
14 tasks
@cbodley cbodley added the rgw label Oct 23, 2025
@cbodley cbodley requested a review from ifed01 October 23, 2025 12:37
Copy link
Contributor

@cbodley cbodley left a comment

Choose a reason for hiding this comment

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

the rgw suite has coverage of all compressor plugins, we can use that to validate

Copy link
Contributor

@tchaikov tchaikov left a comment

Choose a reason for hiding this comment

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

i'd suggest split this change into two commits.

  1. the first commit migrates from the undeprecated APIs.
  2. and the second one bumps up the submodule.

in the commit message of the first commit, we'd better explain why the API was deprecated by referencing the related release notes, and explain the new APIs are available by the minimal supported zstd version.

also, would be better to

  1. take this opportunity to use ZSTD_createCCtx() in favor of ZSTD_createCStream().
  2. use ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters) instead of ZSTD_CCtx_reset() and ZSTD_CCtx_refCDict()
  3. check the return value of these API calls.

@edwinzrodriguez
Copy link
Contributor Author

I broke this change into two commits as requested

Copy link
Contributor

@tchaikov tchaikov left a comment

Choose a reason for hiding this comment

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

lgtm with a nit. but it's not a blocker.

int compress(const ceph::buffer::list &src, ceph::buffer::list &dst, std::optional<int32_t> &compressor_message) override {
ZSTD_CStream *s = ZSTD_createCStream();
ZSTD_initCStream_srcSize(s, cct->_conf->compressor_zstd_level, src.length());
ZSTD_CCtx *s = ZSTD_createCCtx();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. could use unique_ptr with a customized deleter.

@edwinzrodriguez
Copy link
Contributor Author

jenkins test make check

Update ZstdCompressor to use the modern ZSTD compression context API
and improve error handling:

- Replace deprecated ZSTD_createCStream() with ZSTD_createCCtx()
- Use ZSTD_CCtx_reset() with ZSTD_reset_session_and_parameters flag
  instead of separate ZSTD_reset_session_only and ZSTD_CCtx_refCDict()
  calls. This consolidates session and parameter reset into a single
  operation.
- Add proper return value checking for all ZSTD API calls using
  ZSTD_isError() to catch compression failures
- Ensure proper cleanup with ZSTD_freeCCtx() on all error paths to
  prevent memory leaks
- Update corresponding free function from ZSTD_freeCStream() to
  ZSTD_freeCCtx()

These changes align with ZSTD's recommended API usage patterns and
improve robustness by properly handling potential compression errors.

Fixes: https://tracker.ceph.com/issues/73522
Signed-off-by: Edwin Rodriguez <edwin.rodriguez1@ibm.com>
Update zstd submodule to version 1.5.6 for improved performance,
bug fixes, and modern API support.

Fixes: https://tracker.ceph.com/issues/73522
Signed-off-by: Edwin Rodriguez <edwin.rodriguez1@ibm.com>
@edwinzrodriguez
Copy link
Contributor Author

jenkins test make check

@edwinzrodriguez
Copy link
Contributor Author

How do I re-submit this change to qa for testing?

@tchaikov
Copy link
Contributor

tchaikov commented Nov 3, 2025

@edwinzrodriguez i don't think it's been picked up for integration tests after checking the comments and labels in this PR. why do you think it has been tested in lab?

@JonBailey1993
Copy link
Contributor

@SrinivasaBharath SrinivasaBharath merged commit 7442848 into ceph:main Nov 20, 2025
13 checks passed
@github-actions
Copy link

This is an automated message by src/script/redmine-upkeep.py.

I found one or more Fixes: tags in the commit messages in

git log 744284811c8e99e93e5952562d7d742339c7f5ee^..744284811c8e99e93e5952562d7d742339c7f5ee

The referenced tickets are:

Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them.

Update Log: https://github.com/ceph/ceph/actions/runs/19524553816

@edwinzrodriguez edwinzrodriguez deleted the ceph-zstd-update branch December 1, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants