Skip to content

[Enhancement] Merge enableRunningFlagsInFlush and isWriteWithoutMmap configurations #9730

@guyinyou

Description

@guyinyou

Before Creating the Enhancement Request

  • I have confirmed that this should be classified as an enhancement rather than a bug/feature.

Summary

Merge the enableRunningFlagsInFlush and isWriteWithoutMmap configuration options into a single isWriteWithoutMmap configuration to simplify configuration management and reduce the chance of misconfiguration.

Motivation

Currently, RocketMQ has two related configuration options:
enableRunningFlagsInFlush: Controls whether to use runningFlags when flushing data to disk
isWriteWithoutMmap: Controls whether to use RandomAccessFile instead of MappedByteBuffer for writing
These two configurations are typically used together and need to be enabled/disabled simultaneously. Having them as separate configurations creates several issues:
Configuration Complexity: Users need to manage two separate but related settings
Misconfiguration Risk: It's easy to set one without the other, leading to unexpected behavior
Maintenance Overhead: Code needs to check both configurations in multiple places
User Confusion: The relationship between these two settings is not immediately clear
By merging them into a single configuration, we can simplify the user experience and reduce the potential for configuration errors.

Describe the Solution You'd Like

Merge enableRunningFlagsInFlush into isWriteWithoutMmap with the following behavior:
When isWriteWithoutMmap = true:
Use RandomAccessFile instead of MappedByteBuffer for writing
Set runningFlags to null during MappedFileQueue and MappedFile initialization to avoid conflicts with non-mmap operations
When isWriteWithoutMmap = false:
Use MappedByteBuffer for writing
Use normal runningFlags behavior

Describe Alternatives You've Considered

N/A

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions