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

Spring boot http upload file maximum limit parameterization #6013

Merged
merged 1 commit into from
Jun 20, 2021
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
2 changes: 2 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/PaloFe.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ public static void start(String dorisHomeDir, String pidDir, String[] args) {
} else {
org.apache.doris.httpv2.HttpServer httpServer2 = new org.apache.doris.httpv2.HttpServer();
httpServer2.setPort(Config.http_port);
httpServer2.setMaxFileSize(Config.http_max_file_size);
httpServer2.setMaxRequestSize(Config.http_max_file_size);
httpServer2.start(dorisHomeDir);
}

Expand Down
6 changes: 6 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/common/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ public class Config extends ConfigBase {
*/
@ConfField public static int http_backlog_num = 1024;

/**
*Maximum file limit for single upload of web request, default value: 100M
*/
@ConfField public static String http_max_file_size = "100M";
@ConfField public static String http_max_request_size = "100M";

/**
* The backlog_num for mysql nio server
* When you enlarge this backlog_num, you should enlarge the value in
Expand Down
17 changes: 13 additions & 4 deletions fe/fe-core/src/main/java/org/apache/doris/httpv2/HttpServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
public class HttpServer extends SpringBootServletInitializer {

private int port;
//The maximum file limit for a single upload of a web request
private String maxFileSize;
private String maxRequestSize;

public void setMaxFileSize(String maxFileSize) {
this.maxFileSize = maxFileSize;
}

public void setMaxRequestSize(String maxRequestSize) {
this.maxRequestSize = maxRequestSize;
}

public void setPort(int port) {
this.port = port;
Expand All @@ -52,10 +63,8 @@ public void start(String dorisHome) {
properties.put("spring.http.encoding.charset", "UTF-8");
properties.put("spring.http.encoding.enabled", true);
properties.put("spring.http.encoding.force", true);
// properties.put("spring.http.multipart.maxFileSize", "100Mb");
// properties.put("spring.http.multipart.maxRequestSize", "100Mb");
properties.put("spring.servlet.multipart.max-file-size", "100MB");
properties.put("spring.servlet.multipart.max-request-size", "100MB");
properties.put("spring.servlet.multipart.max-file-size", this.maxFileSize);
properties.put("spring.servlet.multipart.max-request-size", this.maxRequestSize);
properties.put("logging.config", dorisHome + "/conf/" + SpringLog4j2Config.SPRING_LOG_XML_FILE);
new SpringApplicationBuilder()
.sources(HttpServer.class)
Expand Down