RongtongJin commented on code in PR #4809:
URL: https://github.com/apache/rocketmq/pull/4809#discussion_r943027181
##########
common/src/main/java/org/apache/rocketmq/common/protocol/header/namesrv/BrokerHeartbeatRequestHeader.java:
##########
@@ -28,7 +28,10 @@ public class BrokerHeartbeatRequestHeader implements
CommandCustomHeader {
private String brokerAddr;
@CFNotNull
private String brokerName;
-
+ @CFNotNull
+ private int epoch;
+ @CFNotNull
+ private long maxOffset;
Review Comment:
Since this heartbeat package will also be used by nameserver, in order to
ensure compatibility, it is necessary to set the newly added field to
**@CFNullable**
##########
controller/src/main/java/org/apache/rocketmq/controller/pojo/BrokerLiveInfo.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.controller.pojo;
Review Comment:
It would be better to follow the current style and not create a new pojo
directory
##########
common/src/main/java/org/apache/rocketmq/common/protocol/header/namesrv/BrokerHeartbeatRequestHeader.java:
##########
@@ -28,7 +28,10 @@ public class BrokerHeartbeatRequestHeader implements
CommandCustomHeader {
private String brokerAddr;
@CFNotNull
private String brokerName;
-
+ @CFNotNull
+ private int epoch;
+ @CFNotNull
+ private long maxOffset;
Review Comment:
IMO, It would be better to add confirmOffset to the heartbeat packet.
##########
controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:
##########
@@ -201,6 +205,7 @@ public ControllerResult<ElectMasterResponseHeader>
electMaster(
* @param filter return true if the candidate is available
* @return true if elect success
*/
+ @Deprecated
Review Comment:
If this method is no longer used, it can be deleted. It has not been
released yet.
##########
controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:
##########
@@ -77,20 +81,25 @@ public class DLedgerController implements Controller {
private final DLedgerControllerStateMachine statemachine;
// Usr for checking whether the broker is alive
private BiPredicate<String, String> brokerAlivePredicate;
+
+ private BiFunction<String, String, BrokerLiveInfo> additionalInfoGetter;
+
+
private AtomicBoolean isScheduling = new AtomicBoolean(false);
public DLedgerController(final ControllerConfig config, final
BiPredicate<String, String> brokerAlivePredicate) {
- this(config, brokerAlivePredicate, null, null, null);
+ this(config, brokerAlivePredicate, null, null, null, null);
}
public DLedgerController(final ControllerConfig controllerConfig,
final BiPredicate<String, String> brokerAlivePredicate, final
NettyServerConfig nettyServerConfig,
- final NettyClientConfig nettyClientConfig, final ChannelEventListener
channelEventListener) {
+ final NettyClientConfig nettyClientConfig, final ChannelEventListener
channelEventListener,
+ BiFunction<String, String, BrokerLiveInfo>
additionalInfoGetter) {
Review Comment:
It would better to use electPolicy to construct here instead of
brokerAlivePredicate and additionalInfoGetter
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]