fluent-plugin-sql 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e23b9247528a135033b20b8948e2c7c8553e8a7
4
- data.tar.gz: 3f6b03e77450c220f17851b50c1f799e80f1e4e8
3
+ metadata.gz: ca9f3bc9d2178bcaa84c466b45a1077f0fc5a2b6
4
+ data.tar.gz: 09e653873d5740e19f972ec4328709e20f90aada
5
5
  SHA512:
6
- metadata.gz: e6259bf6a96579679fa63f3cd7af978a8f5c23134a41438ba81f0c7d0744b3fd883f761c326156907e85d4b8f1d7d122f8841fbdd8905999f397f0a12a9f8ab2
7
- data.tar.gz: 2eefbca9a6c289f8286bfe98472c43abe6cb5343c056f59f1490e67af65a2709157c1f7007e53fba102ef17f584352e2c139983768ec2a75b4bb9b11f1362b3f
6
+ metadata.gz: a8d5c1f6860b0f76fb27d4a7b83bfeeb0404492005b198b89a73d8f885eed2a0fcf1118a40a63aa2015cb85e4a90b028c46d7058785b836acce61a4f20525e2e
7
+ data.tar.gz: f9abb12f48ce89a31bf3ac604e85e3315bccb8d39706d96f06296adcc9d10a464f3e81e79f9a3524b37f5a962734defa35d8dd358949287965db6929fecfad3a
data/.travis.yml CHANGED
@@ -5,10 +5,15 @@ addons:
5
5
  postgresql: "9.4"
6
6
 
7
7
  rvm:
8
- - 2.0.0
8
+ - 2.0
9
9
  - 2.1
10
- - 2.2
11
- - 2.3.0
10
+ - 2.2.4
11
+ - 2.3.1
12
+ - ruby-head
13
+
14
+ gemfile:
15
+ - Gemfile
16
+ - Gemfile.v0.12
12
17
 
13
18
  before_install:
14
19
  - gem install bundler
@@ -18,3 +23,10 @@ before_script:
18
23
  - psql -U postgres -c "CREATE DATABASE fluentd_test OWNER fluentd;"
19
24
 
20
25
  script: bundle exec rake test
26
+
27
+ matrix:
28
+ allow_failures:
29
+ - rvm: ruby-head
30
+ exclude:
31
+ - rvm: 2.0
32
+ gemfile: Gemfile
data/Gemfile.v0.12 ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'json', '= 1.8.3'
4
+ gem 'fluentd', '~> 0.12.0'
5
+
6
+ gemspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
@@ -15,6 +15,9 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
+
19
+ require "fluent/input"
20
+
18
21
  module Fluent
19
22
 
20
23
  require 'active_record'
@@ -1,3 +1,5 @@
1
+ require "fluent/output"
2
+
1
3
  module Fluent
2
4
  class SQLOutput < BufferedOutput
3
5
  Plugin.register_output('sql', self)
@@ -29,6 +31,8 @@ module Fluent
29
31
  config_param :socket, :string, :default => nil
30
32
  desc 'remove the given prefix from the events'
31
33
  config_param :remove_tag_prefix, :string, :default => nil
34
+ desc 'enable fallback'
35
+ config_param :enable_fallback, :bool, :default => true
32
36
 
33
37
  attr_accessor :tables
34
38
 
@@ -47,10 +51,11 @@ module Fluent
47
51
  attr_reader :model
48
52
  attr_reader :pattern
49
53
 
50
- def initialize(pattern, log)
54
+ def initialize(pattern, log, enable_fallback)
51
55
  super()
52
56
  @pattern = MatchPattern.create(pattern)
53
57
  @log = log
58
+ @enable_fallback = enable_fallback
54
59
  end
55
60
 
56
61
  def configure(conf)
@@ -97,9 +102,14 @@ module Fluent
97
102
  begin
98
103
  @model.import(records)
99
104
  rescue ActiveRecord::StatementInvalid, ActiveRecord::Import::MissingColumnError => e
100
- # ignore other exceptions to use Fluentd retry mechanizm
101
- @log.warn "Got deterministic error. Fallback to one-by-one import", :error => e.message, :error_class => e.class
102
- one_by_one_import(records)
105
+ if @enable_fallback
106
+ # ignore other exceptions to use Fluentd retry mechanizm
107
+ @log.warn "Got deterministic error. Fallback to one-by-one import", :error => e.message, :error_class => e.class
108
+ one_by_one_import(records)
109
+ else
110
+ $log.warn "Got deterministic error. Fallback is disabled", :error => e.message, :error_class => e.class
111
+ raise e
112
+ end
103
113
  end
104
114
  end
105
115
 
@@ -155,7 +165,7 @@ module Fluent
155
165
  conf.elements.select { |e|
156
166
  e.name == 'table'
157
167
  }.each { |e|
158
- te = TableElement.new(e.arg, log)
168
+ te = TableElement.new(e.arg, log, @enable_fallback)
159
169
  te.configure(e)
160
170
  if e.arg.empty?
161
171
  $log.warn "Detect duplicate default table definition" if @default_table
@@ -38,7 +38,8 @@ class SqlOutputTest < Test::Unit::TestCase
38
38
  database: "fluentd_test",
39
39
  username: "fluentd",
40
40
  password: "fluentd",
41
- remove_tag_suffix: /^db/
41
+ remove_tag_suffix: /^db/,
42
+ enable_fallback: true
42
43
  }
43
44
  actual = {
44
45
  host: d.instance.host,
@@ -47,7 +48,8 @@ class SqlOutputTest < Test::Unit::TestCase
47
48
  database: d.instance.database,
48
49
  username: d.instance.username,
49
50
  password: d.instance.password,
50
- remove_tag_suffix: d.instance.remove_tag_prefix
51
+ remove_tag_suffix: d.instance.remove_tag_prefix,
52
+ enable_fallback: d.instance.enable_fallback
51
53
  }
52
54
  assert_equal(expected, actual)
53
55
  assert_empty(d.instance.tables)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-26 00:00:00.000000000 Z
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -136,6 +136,7 @@ extra_rdoc_files: []
136
136
  files:
137
137
  - ".travis.yml"
138
138
  - Gemfile
139
+ - Gemfile.v0.12
139
140
  - README.md
140
141
  - Rakefile
141
142
  - VERSION