question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should truncate the commitLog base on confirmOffset?

See original GitHub issue

Hi Community, i have a silly question, when a slave broker will changing to master and the slave’s confirmOffset get from old master. It will recalculate the confirmOffset when AutoSwitchHAService#changeToMaster, buf if the slave maxOffset > confirmOffset(this broker replicates relatively fast and the confirmOffset is the one that takes the smallest value of all syncStateSets ), In this case, will it cause the inconsistent messages? should we truncate the commitLog between confirmOffset to maxOffset?

Hope all your helps.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
lizhiminscommented, Oct 8, 2022

@lizhimins @RongtongJin Controller模式下应该不太涉及到日志状态机,我提出的疑问是:当前的代码实现,分发领先(dispatchBehind)是用confirmOffset减reputFromOffset,在切换时如果不先把confirmOffset重置到maxOffset,比如reputFromOffset=confirmOffset < maxOffset时,那truncateInvalidMsg可能就有问题了,我的理解是在truncateInvalidMsg前后都应该计算一下confirmOffset。

是的,这个和我的理解一致

  • truncate 前 fix confirmOffset = maxOffset 是为了 apply unconfirmed log,这样才能不丢已提交的消息
  • truncate 后 fix confirmOffset = last consist point 是为了让主备对齐
3reactions
RongtongJincommented, Sep 29, 2022

Hi @lanlanbaby, it will not truncate the slave’s commitLog between confirmOffset to maxOffset before the slave changing to master. First, the transfer of confirmOffset is delayed, if the commitLog between confirmOffset to maxOffset is truncated, messages may be lost. In addition, we only guarantee that messages will not be lost. Messages between confirmOffset to maxOffset are uncertain (no ack to clients), so it doesn’t matter if these messages exist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dev - The Mail Archive
GitBox; 2022/09/28 [GitHub] [rocketmq] lanlanbaby commented on issue #5209: Should truncate the commitLog base on confirmOffset? GitBox; 2022/09/28 [GitHub] ...
Read more >
索引区分度 - Absurd博客
Get the raw commit log data starting from the given offset, which should used for ... Base counter value, used mainly when there...
Read more >
didi/DDMQ:CommitLog$DefaultAppendMessageCallback ...
distributed under the License is distributed on an "AS IS" BASIS, ... this can not be included in truncate offset ... confirmOffset =...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found