Skip to content

Commit 4443c2e

Browse files
authored
Merge pull request #90 from fluent/follow-up-86
Update pool parameter. ref #86
2 parents 9979f31 + c5076d9 commit 4443c2e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/fluent/plugin/out_sql.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class SQLOutput < Output
2929
config_param :remove_tag_prefix, :string, default: nil
3030
desc 'enable fallback'
3131
config_param :enable_fallback, :bool, default: true
32-
config_param :pool, :integer, default: 10
32+
desc "size of ActiveRecord's connection pool"
33+
config_param :pool, :integer, default: 5
3334
desc "specifies the timeout to establish a new connection to the database before failing"
3435
config_param :timeout, :integer, default: 5000
3536

@@ -175,6 +176,10 @@ def configure(conf)
175176
end
176177
}
177178

179+
if @pool < @buffer_config.flush_thread_count
180+
log.warn "connection pool size is smaller than buffer's flush_thread_count. Recommend to increase pool value", :pool => @pool, :flush_thread_count => @buffer_config.flush_thread_count
181+
end
182+
178183
if @default_table.nil?
179184
raise Fluent::ConfigError, "There is no default table. <table> is required in sql output"
180185
end

test/plugin/test_out_sql.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def test_configure
4343
password: "fluentd",
4444
schema_search_path: 'public',
4545
remove_tag_suffix: /^db/,
46-
enable_fallback: true
46+
enable_fallback: true,
47+
pool: 5
4748
}
4849
actual = {
4950
host: d.instance.host,
@@ -54,7 +55,8 @@ def test_configure
5455
password: d.instance.password,
5556
schema_search_path: d.instance.schema_search_path,
5657
remove_tag_suffix: d.instance.remove_tag_prefix,
57-
enable_fallback: d.instance.enable_fallback
58+
enable_fallback: d.instance.enable_fallback,
59+
pool: d.instance.pool
5860
}
5961
assert_equal(expected, actual)
6062
assert_empty(d.instance.tables)

0 commit comments

Comments
 (0)