logstash-output-google_bigquery 4.1.1-java → 4.1.2-java

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
  SHA256:
3
- metadata.gz: 1bea90d55eb25689d86a79c1adf326d382d8f2d7c6045a027935b5f19c4e005f
4
- data.tar.gz: fd315b0e136a61429a63489a2d3ea21e294d474814d809911b382268037a8ce8
3
+ metadata.gz: 9361650ebd1559f1d2e7237028993cb9d86ae9cd0c9e86473a4d9f5910418736
4
+ data.tar.gz: b82fb5507e89bd687de2fda556937817164bb3b25aaaf40cda8fe7beca51a5cf
5
5
  SHA512:
6
- metadata.gz: d178dea332da37a9f4762624a409415b90b55b74d3c2279cb521c79621d74e2fb70686b1256249d368da22a08c742a10714b8623eb632c423d9d8be4f90e8d2f
7
- data.tar.gz: a83de7d1395056256d36889a4ecb8ee30b0d79cfc81ae2b193363a86cc188728218670ad5250a4cf24796eeff0af9d8f4a2aa4972e8c9d169c4a486f1c5df5ff
6
+ metadata.gz: c6d0dfb7489d814b9a0b10d73270165e6842720c317d692f8d49e0308abf8c6773ce929eac14e02d43537f8b308845c94d4cdc31eb8fe81dc437c043e4ee95b9
7
+ data.tar.gz: 40c022608e5c861990fc710ae220caab8cb3aef5a968b1ba59120d1cb77d2c639dcb6d5aeb16a03fd7eb5736ff8778c2370de26e7c47271ce72aa431d3e4254f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.1.2
2
+ - Fixed issue where Logstash shutdown could cause data loss due to not flushing buffers on close [#52](https://github.com/logstash-plugins/logstash-output-google_bigquery/pull/52)
3
+
1
4
  ## 4.1.1
2
5
  - Fixed inaccuracies in documentation [#46](https://github.com/logstash-plugins/logstash-output-google_bigquery/pull/46)
3
6
 
@@ -7,6 +7,7 @@ require 'logstash/outputs/bigquery/schema'
7
7
 
8
8
  require 'time'
9
9
  require 'fileutils'
10
+ require 'concurrent'
10
11
 
11
12
  #
12
13
  # === Summary
@@ -181,6 +182,7 @@ class LogStash::Outputs::GoogleBigQuery < LogStash::Outputs::Base
181
182
  @schema = LogStash::Outputs::BigQuery::Schema.parse_csv_or_json @csv_schema, @json_schema
182
183
  @bq_client = LogStash::Outputs::BigQuery::StreamingClient.new @json_key_file, @project_id, @logger
183
184
  @batcher = LogStash::Outputs::BigQuery::Batcher.new @batch_size, @batch_size_bytes
185
+ @stopping = Concurrent::AtomicBoolean.new(false)
184
186
 
185
187
  init_batcher_flush_thread
186
188
  end
@@ -274,11 +276,24 @@ class LogStash::Outputs::GoogleBigQuery < LogStash::Outputs::Base
274
276
 
275
277
  def init_batcher_flush_thread
276
278
  @flush_thread = Thread.new do
277
- loop do
278
- sleep @flush_interval_secs
279
+ until stopping?
280
+ Stud.stoppable_sleep(@flush_interval_secs) { stopping? }
279
281
 
280
282
  @batcher.enqueue(nil) { |batch| publish(batch) }
281
283
  end
282
284
  end
283
285
  end
286
+
287
+ def stopping?
288
+ @stopping.value
289
+ end
290
+
291
+ def close
292
+ @stopping.make_true
293
+ @flush_thread.wakeup
294
+ @flush_thread.join
295
+ # Final flush to publish any events published if a pipeline receives a shutdown signal after flush thread
296
+ # has begun flushing.
297
+ @batcher.enqueue(nil) { |batch| publish(batch) }
298
+ end
284
299
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-google_bigquery'
3
- s.version = '4.1.1'
3
+ s.version = '4.1.2'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Writes events to Google BigQuery"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-google_bigquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.1.2
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-25 00:00:00.000000000 Z
11
+ date: 2019-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement