to #9692 Support async delete for topics
Which Issue(s) This PR Fixes
Fixes #9692
Brief Description
Support asynchronous deletion of topics to improve performance
How Did You Test This Change?
The main cause of failure in job 50213573092 is repeated errors related to decoding the custom field <defaultTopic>, specifically:
org.apache.rocketmq.remoting.exception.RemotingCommandException: the custom field <defaultTopic> is null
at org.apache.rocketmq.remoting.protocol.RemotingCommand.decodeCommandCustomHeaderDirectly(RemotingCommand.java:307)
This error occurs multiple times during topic creation and update operations, indicating that the field defaultTopic is expected but not set or is being passed as null in requests to the broker.
Solution:
- Ensure
defaultTopicIs Set in Requests**
- Check all places where requests are made to create or update topics, especially in tests and any client code.
- Make sure the request header includes a non-null value for
defaultTopicwhere it's required.
Example Fix in Java:
If you are constructing a request using a command header, ensure you set defaultTopic:
java:- YourCustomHeader header = new YourCustomHeader(); header.setDefaultTopic("YOUR_TOPIC_NAME"); // Set to an appropriate topic name remotingCommand.setCustomHeader(header);
2. Add Null Checks in Broker/Processor Code
- In `RemotingCommand.decodeCommandCustomHeaderDirectly`, add a null check and handle missing fields more gracefully, possibly with a default value or clear error message.
Example Defensive Code:
```java
if (customHeader.getDefaultTopic() == null) {
throw new RemotingCommandException("The custom field <defaultTopic> must not be null");
}
But ideally, the fix should be at the source (where the request is constructed), not just error handling.
- Review Test Definitions**
Several log entries suggest the issue may be in the integration tests for topic creation. Check test files for topic creation requests, and verify that defaultTopic is set.
Additional Error: NullPointerException in setCommitLogReadaheadMode
java.lang.NullPointerException: null at org.apache.rocketmq.broker.processor.AdminBrokerProcessor.setCommitLogReadaheadMode(AdminBrokerProcessor.java:1050)
Solution: Add null checks for the objects used inside setCommitLogReadaheadMode. Ensure all required arguments are initialized before use.