apache / apache/rocketmq

[Enhancement] Merge enableRunningFlagsInFlush and isWriteWithoutMmap configurations

Open
#9,730 0 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
2d 20h
Merged PRs (30d)
26

Description

### Before Creating the Enhancement Request

- [x] 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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.