diff --git a/common/src/main/java/com/automq/rocketmq/common/config/BrokerConfig.java b/common/src/main/java/com/automq/rocketmq/common/config/BrokerConfig.java index e66edfde4..a95a7f486 100644 --- a/common/src/main/java/com/automq/rocketmq/common/config/BrokerConfig.java +++ b/common/src/main/java/com/automq/rocketmq/common/config/BrokerConfig.java @@ -66,6 +66,8 @@ public class BrokerConfig implements ControllerConfig { private final DatabaseConfig db; + private final Controller controller; + private boolean terminating; public BrokerConfig() { @@ -74,6 +76,7 @@ public BrokerConfig() { this.store = new StoreConfig(); this.s3Stream = new S3StreamConfig(); this.db = new DatabaseConfig(); + this.controller = new Controller(); } private static String parseHost(String address) { @@ -245,4 +248,44 @@ public String getInnerAccessKey() { public String getInnerSecretKey() { return innerSecretKey; } + + @Override + public long scanIntervalInSecs() { + return controller.getScanIntervalInSecs(); + } + + @Override + public int leaseLifeSpanInSecs() { + return controller.getLeaseLifeSpanInSecs(); + } + + @Override + public long nodeAliveIntervalInSecs() { + return controller.getNodeAliveIntervalInSecs(); + } + + @Override + public int deletedTopicLingersInSecs() { + return controller.getDeletedTopicLingersInSecs(); + } + + @Override + public int deletedGroupLingersInSecs() { + return controller.getDeletedGroupLingersInSecs(); + } + + @Override + public long balanceWorkloadIntervalInSecs() { + return controller.getBalanceWorkloadIntervalInSecs(); + } + + @Override + public long recycleS3IntervalInSecs() { + return controller.getRecycleS3IntervalInSecs(); + } + + @Override + public int workloadTolerance() { + return controller.getWorkloadTolerance(); + } } diff --git a/common/src/main/java/com/automq/rocketmq/common/config/Controller.java b/common/src/main/java/com/automq/rocketmq/common/config/Controller.java new file mode 100644 index 000000000..816c18c1a --- /dev/null +++ b/common/src/main/java/com/automq/rocketmq/common/config/Controller.java @@ -0,0 +1,100 @@ +/* + * 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 com.automq.rocketmq.common.config; + +public class Controller { + private long recycleS3IntervalInSecs = 3600; + + private long scanIntervalInSecs = 30; + + private int leaseLifeSpanInSecs = 10; + + private long nodeAliveIntervalInSecs = 60; + + private int deletedTopicLingersInSecs = 300; + + private int deletedGroupLingersInSecs = 300; + + private long balanceWorkloadIntervalInSecs = 10; + + private int workloadTolerance = 2; + + public long getRecycleS3IntervalInSecs() { + return recycleS3IntervalInSecs; + } + + public void setRecycleS3IntervalInSecs(long recycleS3IntervalInSecs) { + this.recycleS3IntervalInSecs = recycleS3IntervalInSecs; + } + + public long getScanIntervalInSecs() { + return scanIntervalInSecs; + } + + public void setScanIntervalInSecs(long scanIntervalInSecs) { + this.scanIntervalInSecs = scanIntervalInSecs; + } + + public int getLeaseLifeSpanInSecs() { + return leaseLifeSpanInSecs; + } + + public void setLeaseLifeSpanInSecs(int leaseLifeSpanInSecs) { + this.leaseLifeSpanInSecs = leaseLifeSpanInSecs; + } + + public long getNodeAliveIntervalInSecs() { + return nodeAliveIntervalInSecs; + } + + public void setNodeAliveIntervalInSecs(long nodeAliveIntervalInSecs) { + this.nodeAliveIntervalInSecs = nodeAliveIntervalInSecs; + } + + public int getDeletedTopicLingersInSecs() { + return deletedTopicLingersInSecs; + } + + public void setDeletedTopicLingersInSecs(int deletedTopicLingersInSecs) { + this.deletedTopicLingersInSecs = deletedTopicLingersInSecs; + } + + public int getDeletedGroupLingersInSecs() { + return deletedGroupLingersInSecs; + } + + public void setDeletedGroupLingersInSecs(int deletedGroupLingersInSecs) { + this.deletedGroupLingersInSecs = deletedGroupLingersInSecs; + } + + public long getBalanceWorkloadIntervalInSecs() { + return balanceWorkloadIntervalInSecs; + } + + public void setBalanceWorkloadIntervalInSecs(long balanceWorkloadIntervalInSecs) { + this.balanceWorkloadIntervalInSecs = balanceWorkloadIntervalInSecs; + } + + public int getWorkloadTolerance() { + return workloadTolerance; + } + + public void setWorkloadTolerance(int workloadTolerance) { + this.workloadTolerance = workloadTolerance; + } +} diff --git a/common/src/main/java/com/automq/rocketmq/common/config/ControllerConfig.java b/common/src/main/java/com/automq/rocketmq/common/config/ControllerConfig.java index b5f1e29dd..66ad1af84 100644 --- a/common/src/main/java/com/automq/rocketmq/common/config/ControllerConfig.java +++ b/common/src/main/java/com/automq/rocketmq/common/config/ControllerConfig.java @@ -43,7 +43,7 @@ default int leaseLifeSpanInSecs() { return 10; } - default int nodeAliveIntervalInSecs() { + default long nodeAliveIntervalInSecs() { return 60; } diff --git a/distribution/conf/broker.yaml b/distribution/conf/broker.yaml index c35bd0438..8f65470cf 100644 --- a/distribution/conf/broker.yaml +++ b/distribution/conf/broker.yaml @@ -15,6 +15,8 @@ db: url: "jdbc:mysql://mysql-server:3306/metadata" userName: "root" password: "password" +controller: + recycleS3IntervalInSecs: 360 metrics: exporterType: "OTLP_GRPC" grpcExporterTarget: "http://10.129.63.127:4317"