Skip to content

[ISSUE #9654] Optimize the bufferLocal size of the TimerMessageStore - #9655

Merged
lizhimins merged 2 commits into
apache:developfrom
ymwneu:fixTimerBuffer
Aug 3, 2026
Merged

[ISSUE #9654] Optimize the bufferLocal size of the TimerMessageStore#9655
lizhimins merged 2 commits into
apache:developfrom
ymwneu:fixTimerBuffer

Conversation

@ymwneu

@ymwneu ymwneu commented Sep 2, 2025

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Fixes #9654

Brief Description

There is a variable called bufferLocal in TimerMessageStore, which is used to store a single message from the commitlog. The initial size of bufferLocal is currently set to maxMessageSize plus 100 bytes. Since some properties may be added during the intermediate stages of scheduled messages, the maximum message size can exceed maxMessageSize. Although an extra 100 bytes is reserved during initialization, in some scenarios this is not sufficient, resulting in message read failures and subsequently blocking the entire scheduled message process.

How Did You Test This Change?

lizhimins
lizhimins previously approved these changes Sep 2, 2025
@lizhimins lizhimins changed the title Optimize the bufferLocal size of the TimerMessageStore [ISSUE #9654] Optimize the bufferLocal size of the TimerMessageStore Sep 2, 2025
@codecov-commenter

codecov-commenter commented Sep 2, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.24%. Comparing base (2954655) to head (fa4705f).
⚠️ Report is 296 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #9655      +/-   ##
=============================================
+ Coverage      48.12%   48.24%   +0.11%     
- Complexity     12076    13485    +1409     
=============================================
  Files           1313     1380      +67     
  Lines          92837   101093    +8256     
  Branches       11868    13102    +1234     
=============================================
+ Hits           44677    48771    +4094     
- Misses         42650    46342    +3692     
- Partials        5510     5980     +470     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Override
protected ByteBuffer initialValue() {
return ByteBuffer.allocateDirect(storeConfig.getMaxMessageSize() + 100);
return ByteBuffer.allocateDirect(storeConfig.getMaxMessageSize() + storeConfig.getTimerMessageBufferSize());

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.

    int maxMessageSize = Integer.MAX_VALUE - maxMessageBodySize >= 64 * 1024 ?
        maxMessageBodySize + 64 * 1024 : Integer.MAX_VALUE;

Wouldn't it be better to follow the settings in MessageExtEncoder (lines 53–54)?

@lizhimins
lizhimins merged commit 89166af into apache:develop Aug 3, 2026
10 checks passed
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.

[Bug]The bufferLocal size of the TimerMessageStore not enough

5 participants