Skip to content

Confusing Behaviour of Single Node Scenario #1162

Open
@Luncert

Description

@Luncert

Your question

What's the expected behaviour of single node scenario?

Your scenes

I'm building a distributed system using JRaft and currently I'm trying to start only one instance for testing. The logic is simple as the counter example, a task is emitted somewhere and the state machine consume the task and execute responsive operation. But the fact is after emitting a task, the apply function in state machine is invoked multiple times
which causes repeat consumption. At the same time, the term keeps increasing until the hook onLeaderStart is invoked.

Another problem is, in the apply function, the task data is incorrect and can't be deserialized until the hook onLeaderStart is invoked.

I'm just a begniner of JRaft and not sure if it's a limitation of JRaft or caused by some incorrect coding by me. Thanks in advance for reply.

Your advice

Environment

  • SOFAJRaft version: 1.3.15

  • JVM version (e.g. java -version): jbr-17

  • OS version (e.g. uname -a): Darwin HNWYJ3K2W5 24.0.0 Darwin Kernel Version 24.0.0: Mon Aug 12 20:51:54 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6000 arm64

  • Maven version: 3.8.6

  • IDE version: Idea

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions