Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose controller config #554

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public class BrokerConfig implements ControllerConfig {

private final DatabaseConfig db;

private final Controller controller;

private boolean terminating;

public BrokerConfig() {
Expand All @@ -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) {
Expand Down Expand Up @@ -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();
}
}
100 changes: 100 additions & 0 deletions common/src/main/java/com/automq/rocketmq/common/config/Controller.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ default int leaseLifeSpanInSecs() {
return 10;
}

default int nodeAliveIntervalInSecs() {
default long nodeAliveIntervalInSecs() {
return 60;
}

Expand Down
2 changes: 2 additions & 0 deletions distribution/conf/broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down