diff --git a/embulk-output-mysql/README.md b/embulk-output-mysql/README.md index 4c7b497e..11c455d4 100644 --- a/embulk-output-mysql/README.md +++ b/embulk-output-mysql/README.md @@ -33,6 +33,8 @@ MySQL output plugin for Embulk loads records to MySQL. - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) - **before_load**: if set, this SQL will be executed before loading all records. In truncate_insert mode, the SQL will be executed after truncating. replace mode doesn't support this option. - **after_load**: if set, this SQL will be executed after loading all records. +- **socket_timeout**: socket timeout milliseconds (string, default: "2700000") +- **retryable_socket_timeout**: socket timeout milliseconds on retrying (string, default: "1800000") ### Modes diff --git a/embulk-output-mysql/src/main/java/org/embulk/output/MySQLOutputPlugin.java b/embulk-output-mysql/src/main/java/org/embulk/output/MySQLOutputPlugin.java index 4ec860d1..f49ef9d8 100644 --- a/embulk-output-mysql/src/main/java/org/embulk/output/MySQLOutputPlugin.java +++ b/embulk-output-mysql/src/main/java/org/embulk/output/MySQLOutputPlugin.java @@ -50,6 +50,13 @@ public interface MySQLPluginTask @ConfigDefault("\"disable\"") // backward compatibility public Ssl getSsl(); + @Config("socket_timeout") + @ConfigDefault("2700000") + public int getSocketTimeout(); + + @Config("retryable_socket_timeout") + @ConfigDefault("1800000") + public int getRetryableSocketTimeout(); } @Override @@ -80,7 +87,7 @@ protected MySQLOutputConnector getConnector(PluginTask task, boolean retryableMe props.setProperty("useCompression", "true"); props.setProperty("connectTimeout", "300000"); // milliseconds - props.setProperty("socketTimeout", "1800000"); // smillieconds + props.setProperty("socketTimeout", String.valueOf(t.getRetryableSocketTimeout())); // Enable keepalive based on tcp_keepalive_time, tcp_keepalive_intvl and tcp_keepalive_probes kernel parameters. // Socket options TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL are not configurable. @@ -105,7 +112,7 @@ protected MySQLOutputConnector getConnector(PluginTask task, boolean retryableMe if (!retryableMetadataOperation) { // non-retryable batch operation uses longer timeout props.setProperty("connectTimeout", "300000"); // milliseconds - props.setProperty("socketTimeout", "2700000"); // milliseconds + props.setProperty("socketTimeout", String.valueOf(t.getSocketTimeout())); } props.putAll(t.getOptions());