Skip to content

rocketmq不支持运行时修改刷盘方式? #10241

@lenotang

Description

@lenotang

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

Ubuntu 20.04/Centos 7.9

RocketMQ version

4.9.7

JDK Version

Oracle JDK 1.8.0

Describe the Bug

rocketmq不支持运行时修改刷盘方式
如果MQ启动的时候是同步刷盘策略(FlushDiskType:SYNC_FLUSH),那用API可以随便反复改刷盘方式实时生效; 如果MQ启动的时候是异步刷盘策略(FlushDiskType:ASYNC_FLUSH),用API改成同步刷盘策略,改后不重启就会发送抛异常。

Steps to Reproduce

1.MQ集群以同步刷盘策略(FlushDiskType:SYNC_FLUSH)启动,在RocketMQ运行过程中,动态修改FlushDiskType为ASYNC_FLUSH,集群收发消息正常,再次动态修改FlushDiskType为SYNC_FLUSH,集群收发消息正常,无论修改多少次,不需要重启集群,收发消息都没问题。

2.MQ集群以异步刷盘策略(FlushDiskType:ASYNC_FLUSH)启动,在RocketMQ运行过程中,动态修改FlushDiskType为SYNC_FLUSH时,发消息抛出异常(但实际会落盘,重启后可以查询)。
java.lang.ClassCastException: org.apache.rocketmq.store.CommitLog$FlushRealTimeService cannot be cast to org.apache.rocketmq.store.CommitLog$GroupCommitService

What Did You Expect to See?

不管MQ启动的时候是什么刷盘策略,FlushDiskType参数都能够支持运行时修改(不需要重启MQ集群)

What Did You See Instead?

MQ集群以异步刷盘策略(FlushDiskType:ASYNC_FLUSH)启动,在RocketMQ运行过程中,动态修改FlushDiskType为SYNC_FLUSH时,发消息抛出异常(但实际会落盘,重启后可以查询)。

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions