Skip to content

[9.4] (backport #18874) DeadLetterQueueUtils#extractSegmentId improvement: replace split with index of and substring methods.#18961

Merged
mashhurs merged 1 commit into9.4from
mergify/bp/9.4/pr-18874
Apr 8, 2026
Merged

[9.4] (backport #18874) DeadLetterQueueUtils#extractSegmentId improvement: replace split with index of and substring methods.#18961
mashhurs merged 1 commit into9.4from
mergify/bp/9.4/pr-18874

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Apr 7, 2026

Release notes

What does this PR do?

DLQ flush operation is heavy, under the hood DeadLetterQueueUtils#extractSegmentId will be called. The String#split is also CPU intensive that internally utilizes Pattern#compile. Since the logic is simple, it can be replaceable with indexOf and substring.

Why is it important/What is the impact to the user?

A bit performance improvement when using DLQ.

Checklist

  • My code follows the style guidelines of this project
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • [ ]

How to test this PR locally

Functionality test can be done by enabling DLQ and changing its settings, such as make size small to make DLQ full.
But performance measurement is a bit hard on powerful machines, so here is the benchmark - #18883

Related issues

Use cases

Screenshots

Logs


This is an automatic backport of pull request #18874 done by [Mergify](https://mergify.com).

… index of and substring methods. (#18874)

* DeadLetterQueueUtils: avoid using heavy split operation, replace it with simple index of and substring methods.

* Handle exception case if file name doesn't end with .log. Add unit test cases.

(cherry picked from commit 8d7a5a3)
@mergify mergify bot added the backport label Apr 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
  • run exhaustive tests : Run the exhaustive tests Buildkite pipeline.

Copy link
Copy Markdown
Contributor

@mashhurs mashhurs left a comment

Choose a reason for hiding this comment

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

clean backport, will hold merging till gemfile.lock land

@elasticmachine
Copy link
Copy Markdown

💚 Build Succeeded

cc @mashhurs

@mashhurs mashhurs merged commit 91bf043 into 9.4 Apr 8, 2026
13 checks passed
@mashhurs mashhurs deleted the mergify/bp/9.4/pr-18874 branch April 8, 2026 00:33
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.

2 participants