logstash-output-jdbc 0.2.7 → 0.2.9

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/logstash/outputs/jdbc.rb +12 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6fc8ddfe645eb52236a43bd311160e9b1bb6cb13
4
- data.tar.gz: e5dbdf7eaa611c69380423ec6e2d318bafd295d0
3
+ metadata.gz: 41dff0734cecd8b90c11c38fa3b73de4f43d567a
4
+ data.tar.gz: 2545f0178b9c31b099a9d57ce8dc8e3e67dfce0a
5
5
  SHA512:
6
- metadata.gz: 738fe21719d3f903744fa61c721ef5ec197416089d04d42be0574234d28a692792c24927bef85dd9e2bb511f0ae63bc09c23b6f161fd33b72cdf3b0c6c8ba5e7
7
- data.tar.gz: 18652ad8984829a32fad82e7af6972b34356e6eeb07e01bade6caf71bf148f6bc8e06feb6c7568ac7df8d8328d2017acfe0705c55c30b6d2b14475df2dce781a
6
+ metadata.gz: 8252e3b02295b692bec722cd6c151ba2ab9e1f7b8119b8f483ee415bc3213eee4dd6f9b6b3fb5adc81d50308ad486a747322aded3affb740136952bbe0280633
7
+ data.tar.gz: 5ec626918c6bfb5b8bd13b8b1b781a84e0ae218d49d3cff790c511157b1711e39419fdef4660c6121d0488aed8c531ee66b686408a7d26070a301c18623066ff
@@ -151,7 +151,6 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
151
151
 
152
152
  if @exceptions_tracker.reject { |i| i.nil? }.count >= @max_flush_exceptions
153
153
  @logger.error("JDBC - max_flush_exceptions has been reached")
154
- log_jdbc_exception(e)
155
154
  raise LogStash::ShutdownSignal.new
156
155
  end
157
156
  end
@@ -223,7 +222,7 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
223
222
  begin
224
223
  connection = @pool.getConnection()
225
224
  rescue => e
226
- log_jdbc_exception(e)
225
+ log_jdbc_exception(e, true)
227
226
  raise
228
227
  end
229
228
 
@@ -242,7 +241,6 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
242
241
  statement.close()
243
242
  @exceptions_tracker << nil
244
243
  rescue => e
245
- log_jdbc_exception(e)
246
244
  if retry_exception?(e)
247
245
  raise
248
246
  end
@@ -258,7 +256,7 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
258
256
  begin
259
257
  connection = @pool.getConnection()
260
258
  rescue => e
261
- log_jdbc_exception(e)
259
+ log_jdbc_exception(e, true)
262
260
  raise
263
261
  end
264
262
 
@@ -277,7 +275,6 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
277
275
  @exceptions_tracker << nil
278
276
  end
279
277
  rescue => e
280
- log_jdbc_exception(e)
281
278
  if retry_exception?(e)
282
279
  raise
283
280
  end
@@ -324,17 +321,23 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
324
321
  statement
325
322
  end
326
323
 
327
- def log_jdbc_exception(exception)
324
+ def log_jdbc_exception(exception, retrying)
328
325
  current_exception = exception
329
326
  loop do
330
- @logger.error("JDBC Exception encountered: Will automatically retry.", :exception => current_exception)
327
+ if retrying
328
+ @logger.error("JDBC Exception. Retrying.", :exception => current_exception)
329
+ else
330
+ @logger.error("JDBC Exception. No retry.", :exception => current_exception)
331
+ end
331
332
  current_exception = current_exception.getNextException()
332
333
  break if current_exception == nil
333
334
  end
334
335
  end
335
336
 
336
337
  def retry_exception?(exception)
337
- return (exception.class != java.sql.SQLException or
338
- RETRYABLE_SQLSTATE_CLASSES.include?(e.getSQLState[0,2]))
338
+ retrying = (exception.respond_to? 'getSQLState' and RETRYABLE_SQLSTATE_CLASSES.include?(exception.getSQLState[0,2]))
339
+ log_jdbc_exception(exception, retrying)
340
+
341
+ retrying
339
342
  end
340
343
  end # class LogStash::Outputs::jdbc
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-jdbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - the_angry_angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-29 00:00:00.000000000 Z
11
+ date: 2016-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core