Skip to content

Commit

Permalink
[Enhancement] add timeout configs for star client (#54496)
Browse files Browse the repository at this point in the history
Signed-off-by: starrocks-xupeng <[email protected]>
  • Loading branch information
starrocks-xupeng authored Dec 31, 2024
1 parent a703be9 commit e0465c9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
9 changes: 9 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/common/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2634,6 +2634,15 @@ public class Config extends ConfigBase {
@ConfField(mutable = true)
public static int starmgr_grpc_timeout_seconds = 5;

@ConfField(mutable = true)
public static int star_client_read_timeout_seconds = 15;

@ConfField(mutable = true)
public static int star_client_list_timeout_seconds = 30;

@ConfField(mutable = true)
public static int star_client_write_timeout_seconds = 30;

// ***********************************************************
// * END: of Cloud native meta server related configurations
// ***********************************************************
Expand Down
11 changes: 11 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/lake/StarOSAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ public StarOSAgent() {
public boolean init(StarManagerServer server) {
client = new StarClient(server);
client.connectServer(String.format("127.0.0.1:%d", Config.cloud_native_meta_port));
GlobalStateMgr.getCurrentState().getConfigRefreshDaemon().registerListener(() -> {
client.setClientReadTimeoutSec(Config.star_client_read_timeout_seconds);
client.setClientListTimeoutSec(Config.star_client_list_timeout_seconds);
client.setClientWriteTimeoutSec(Config.star_client_write_timeout_seconds);
});
return true;
}

public boolean initForTest() {
client = new StarClient(null);
client.connectServer(String.format("127.0.0.1:%d", Config.cloud_native_meta_port));
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class StarOSAgentTest {
@Before
public void setUp() throws Exception {
starosAgent = new StarOSAgent();
starosAgent.init(null);
starosAgent.initForTest();
Config.cloud_native_storage_type = "S3";
}

Expand Down

0 comments on commit e0465c9

Please sign in to comment.