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

support the client request time control #154

Merged
merged 1 commit into from
Aug 20, 2024
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
8 changes: 8 additions & 0 deletions src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ public class CosNConfigKeys extends CommonConfigurationKeys {

public static final int DEFAULT_COSN_IDLE_CONNECTION_ALIVE = 60000;

// request time out enable then request timeout and client thread size config work
public static final String COSN_CLIENT_USE_REQUEST_TIMEOUT = "fs.cosn.client.use.request.timeout";
public static final boolean DEFAULT_COSN_CLIENT_USE_REQUEST_TIMEOUT = false;
public static final String COSN_CLIENT_REQUEST_TIMEOUT = "fs.cosn.client.request.timeout";
public static final int DEFAULT_COSN_CLIENT_REQUEST_TIMEOUT = 5 * 60 * 1000; //5min
public static final String COSN_CLIENT_REQUEST_TIMEOUT_THREAD_SIZE = "fs.cosn.client.request.timeout.thread.size";
public static final int DEFAULT_COSN_CLIENT_REQUEST_TIMEOUT_THREAD_SIZE = Runtime.getRuntime().availableProcessors() * 5;

public static final String CUSTOMER_DOMAIN = "fs.cosn.customer.domain";
public static final String COSN_SERVER_SIDE_ENCRYPTION_ALGORITHM = "fs.cosn.server-side-encryption.algorithm";
public static final String COSN_SERVER_SIDE_ENCRYPTION_KEY = "fs.cosn.server-side-encryption.key";
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/apache/hadoop/fs/CosNativeFileSystemStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,19 @@ private void initCOSClient(URI uri, Configuration conf) throws IOException {
config.setShortConnection();
}

if (conf.getBoolean(CosNConfigKeys.COSN_CLIENT_USE_REQUEST_TIMEOUT,
CosNConfigKeys.DEFAULT_COSN_CLIENT_USE_REQUEST_TIMEOUT)) {
config.setRequestTimeOutEnable(true);
config.setRequestTimeout(
conf.getInt(
CosNConfigKeys.COSN_CLIENT_REQUEST_TIMEOUT,
CosNConfigKeys.DEFAULT_COSN_CLIENT_REQUEST_TIMEOUT));
config.setTimeoutClientThreadSize(
conf.getInt(
CosNConfigKeys.COSN_CLIENT_REQUEST_TIMEOUT_THREAD_SIZE,
CosNConfigKeys.DEFAULT_COSN_CLIENT_REQUEST_TIMEOUT_THREAD_SIZE));
}

config.setMaxConnectionsCount(
conf.getInt(
CosNConfigKeys.MAX_CONNECTION_NUM,
Expand Down