logstash-core 7.2.0-java → 7.2.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f34b96ed7e4139bc1eb3d820d6f325e3bd579be9381a369be73aa08dc231d4e1
4
- data.tar.gz: e8d3c2aa6e2d59b44e7f99f27af966ed962608f90e7c9af0f68b5a459d4804cf
3
+ metadata.gz: '049f2a5cf05f1811e4393f09bbf0dfd07b63fcfc27e760fefafdb7d78c340659'
4
+ data.tar.gz: a22c780783a2d190f4e97877e5e41191921a49568184b59c1d12ce276f55e567
5
5
  SHA512:
6
- metadata.gz: 0c13a53ea439c0d4293ab3e6bcb4f91bd93e98c98184d2cadc1c1466372bd2af7ad469522802f4e82fa5d66cae9b486c8b3b51111ebdd683c50e5203b4975cae
7
- data.tar.gz: c7dbd2b483cc41c47fd3036dc4bf7223578de3cdb4ef7ea5d75cfa3c4bf7572808756bfb5dc85ac394a9e74cb238b2c19707ca6361edb871de8c2dd403f0aa15
6
+ metadata.gz: ce56af4e9f40c706cd08f7ef6fb00dcab449e64b72968312feff85aa0c8460a28b48b41fa5b059eb75b610a679ccfef38653cf5774160eb3878eb5fded78ec1d
7
+ data.tar.gz: 6d480b9c63e22f25b2b51521e6da69013bac56f875b803c94e173a8153ab2618bae4d366d90904286ecde7bdb4f0584030aad05fab1bb2103d251835058691ee
@@ -186,9 +186,9 @@ class LogStash::Agent
186
186
  pipeline_bus.setBlockOnUnlisten(true)
187
187
 
188
188
  stop_collecting_metrics
189
- stop_webserver
190
189
  transition_to_stopped
191
190
  converge_result = shutdown_pipelines
191
+ stop_webserver
192
192
  converge_result
193
193
  end
194
194
 
@@ -35,6 +35,7 @@ module LogStash
35
35
  # will block until the other compute finishes so no mutex is necessary
36
36
  # for synchronizing compute calls
37
37
  @states = java.util.concurrent.ConcurrentHashMap.new
38
+ @locks = java.util.concurrent.ConcurrentHashMap.new
38
39
  end
39
40
 
40
41
  # Execute the passed creation logic block and create a new state upon success
@@ -46,24 +47,28 @@ module LogStash
46
47
  #
47
48
  # @return [Boolean] new pipeline creation success
48
49
  def create_pipeline(pipeline_id, pipeline, &create_block)
50
+ lock = get_lock(pipeline_id)
51
+ lock.lock
52
+
49
53
  success = false
50
54
 
51
- @states.compute(pipeline_id) do |_, state|
52
- if state
53
- if state.terminated?
54
- success = yield
55
- state.set_pipeline(pipeline)
56
- else
57
- logger.error("Attempted to create a pipeline that already exists", :pipeline_id => pipeline_id)
58
- end
59
- state
60
- else
55
+ state = @states.get(pipeline_id)
56
+ if state
57
+ if state.terminated?
61
58
  success = yield
62
- success ? PipelineState.new(pipeline_id, pipeline) : nil
59
+ state.set_pipeline(pipeline)
60
+ else
61
+ logger.error("Attempted to create a pipeline that already exists", :pipeline_id => pipeline_id)
63
62
  end
63
+ @states.put(pipeline_id, state)
64
+ else
65
+ success = yield
66
+ @states.put(pipeline_id, PipelineState.new(pipeline_id, pipeline)) if success
64
67
  end
65
68
 
66
69
  success
70
+ ensure
71
+ lock.unlock
67
72
  end
68
73
 
69
74
  # Execute the passed termination logic block
@@ -72,15 +77,19 @@ module LogStash
72
77
  #
73
78
  # @yieldparam [Pipeline] the pipeline to terminate
74
79
  def terminate_pipeline(pipeline_id, &stop_block)
75
- @states.compute(pipeline_id) do |_, state|
76
- if state.nil?
77
- logger.error("Attempted to terminate a pipeline that does not exists", :pipeline_id => pipeline_id)
78
- nil
79
- else
80
- yield(state.pipeline)
81
- state
82
- end
80
+ lock = get_lock(pipeline_id)
81
+ lock.lock
82
+
83
+ state = @states.get(pipeline_id)
84
+ if state.nil?
85
+ logger.error("Attempted to terminate a pipeline that does not exists", :pipeline_id => pipeline_id)
86
+ @states.remove(pipeline_id)
87
+ else
88
+ yield(state.pipeline)
89
+ @states.put(pipeline_id, state)
83
90
  end
91
+ ensure
92
+ lock.unlock
84
93
  end
85
94
 
86
95
  # Execute the passed reloading logic block in the context of the reloading state and set new pipeline in state
@@ -91,25 +100,28 @@ module LogStash
91
100
  #
92
101
  # @return [Boolean] new pipeline creation success
93
102
  def reload_pipeline(pipeline_id, &reload_block)
103
+ lock = get_lock(pipeline_id)
104
+ lock.lock
94
105
  success = false
95
106
 
96
- @states.compute(pipeline_id) do |_, state|
97
- if state.nil?
98
- logger.error("Attempted to reload a pipeline that does not exists", :pipeline_id => pipeline_id)
99
- nil
100
- else
101
- state.set_reloading(true)
102
- begin
103
- success, new_pipeline = yield
104
- state.set_pipeline(new_pipeline)
105
- ensure
106
- state.set_reloading(false)
107
- end
108
- state
107
+ state = @states.get(pipeline_id)
108
+ if state.nil?
109
+ logger.error("Attempted to reload a pipeline that does not exists", :pipeline_id => pipeline_id)
110
+ @states.remove(pipeline_id)
111
+ else
112
+ state.set_reloading(true)
113
+ begin
114
+ success, new_pipeline = yield
115
+ state.set_pipeline(new_pipeline)
116
+ ensure
117
+ state.set_reloading(false)
109
118
  end
119
+ @states.put(pipeline_id, state)
110
120
  end
111
121
 
112
- success
122
+ success
123
+ ensure
124
+ lock.unlock
113
125
  end
114
126
 
115
127
  # @param pipeline_id [String, Symbol] the pipeline id
@@ -162,5 +174,11 @@ module LogStash
162
174
  end
163
175
  end
164
176
  end
177
+
178
+ def get_lock(pipeline_id)
179
+ @locks.compute_if_absent(pipeline_id) do |k|
180
+ java.util.concurrent.locks.ReentrantLock.new
181
+ end
182
+ end
165
183
  end
166
184
  end
@@ -44,16 +44,14 @@ module ::LogStash; module Plugins; module Builtin; module Pipeline; class Input
44
44
  @queue << event
45
45
  end
46
46
 
47
- return true
48
- rescue => e
49
- require 'pry'; binding.pry
50
- return true
47
+ true
51
48
  end
52
49
 
53
50
  def stop
54
- # We stop receiving events before we unlisten to prevent races
55
- @running.set(false) if @running # If register wasn't yet called, no @running!
56
51
  pipeline_bus.unlisten(self, address)
52
+ # We stop receiving events _after_ we unlisten to pick up any events sent by upstream outputs that
53
+ # have not yet stopped
54
+ @running.set(false) if @running # If register wasn't yet called, no @running!
57
55
  end
58
56
 
59
57
  def isRunning
@@ -101,6 +101,23 @@ describe ::LogStash::Plugins::Builtin::Pipeline do
101
101
  output.do_close
102
102
  end
103
103
  end
104
+
105
+ it "stopped input should process events until upstream outputs stop" do
106
+ start_input
107
+ output.register
108
+ pipeline_bus.setBlockOnUnlisten(true)
109
+
110
+ output.multi_receive([event])
111
+ expect(queue.pop(true).to_hash_with_metadata).to match(event.to_hash_with_metadata)
112
+
113
+ Thread.new { input.do_stop }
114
+
115
+ sleep 1
116
+ output.multi_receive([event])
117
+ expect(queue.pop(true).to_hash_with_metadata).to match(event.to_hash_with_metadata)
118
+
119
+ output.do_close
120
+ end
104
121
  end
105
122
 
106
123
  describe "one output to multiple inputs" do
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  # alpha and beta qualifiers are now added via VERSION_QUALIFIER environment var
3
- logstash: 7.2.0
4
- logstash-core: 7.2.0
3
+ logstash: 7.2.1
4
+ logstash-core: 7.2.1
5
5
  logstash-core-plugin-api: 2.1.16
6
6
 
7
7
  # jruby must reference a *released* version of jruby which can be downloaded from the official download url
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.0
4
+ version: 7.2.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-20 00:00:00.000000000 Z
11
+ date: 2019-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -17,8 +17,8 @@ dependencies:
17
17
  - !ruby/object:Gem::Version
18
18
  version: '0.12'
19
19
  name: pry
20
- type: :runtime
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
@@ -31,8 +31,8 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: 0.0.19
33
33
  name: stud
34
- type: :runtime
35
34
  prerelease: false
35
+ type: :runtime
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
@@ -45,8 +45,8 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0.6'
47
47
  name: clamp
48
- type: :runtime
49
48
  prerelease: false
49
+ type: :runtime
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
@@ -59,8 +59,8 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0.2'
61
61
  name: filesize
62
- type: :runtime
63
62
  prerelease: false
63
+ type: :runtime
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
@@ -73,8 +73,8 @@ dependencies:
73
73
  - !ruby/object:Gem::Version
74
74
  version: '1'
75
75
  name: gems
76
- type: :runtime
77
76
  prerelease: false
77
+ type: :runtime
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
@@ -87,8 +87,8 @@ dependencies:
87
87
  - !ruby/object:Gem::Version
88
88
  version: '1'
89
89
  name: concurrent-ruby
90
- type: :runtime
91
90
  prerelease: false
91
+ type: :runtime
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
@@ -104,8 +104,8 @@ dependencies:
104
104
  - !ruby/object:Gem::Version
105
105
  version: 1.6.11
106
106
  name: rack
107
- type: :runtime
108
107
  prerelease: false
108
+ type: :runtime
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
111
  - - "~>"
@@ -124,8 +124,8 @@ dependencies:
124
124
  - !ruby/object:Gem::Version
125
125
  version: 1.4.6
126
126
  name: sinatra
127
- type: :runtime
128
127
  prerelease: false
128
+ type: :runtime
129
129
  version_requirements: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - "~>"
@@ -141,8 +141,8 @@ dependencies:
141
141
  - !ruby/object:Gem::Version
142
142
  version: '2'
143
143
  name: puma
144
- type: :runtime
145
144
  prerelease: false
145
+ type: :runtime
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
148
  - - "~>"
@@ -155,8 +155,8 @@ dependencies:
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0.10'
157
157
  name: jruby-openssl
158
- type: :runtime
159
158
  prerelease: false
159
+ type: :runtime
160
160
  version_requirements: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - "~>"
@@ -169,8 +169,8 @@ dependencies:
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0.10'
171
171
  name: chronic_duration
172
- type: :runtime
173
172
  prerelease: false
173
+ type: :runtime
174
174
  version_requirements: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - "~>"
@@ -183,8 +183,8 @@ dependencies:
183
183
  - !ruby/object:Gem::Version
184
184
  version: '1'
185
185
  name: treetop
186
- type: :runtime
187
186
  prerelease: false
187
+ type: :runtime
188
188
  version_requirements: !ruby/object:Gem::Requirement
189
189
  requirements:
190
190
  - - "~>"
@@ -197,8 +197,8 @@ dependencies:
197
197
  - !ruby/object:Gem::Version
198
198
  version: '1'
199
199
  name: i18n
200
- type: :runtime
201
200
  prerelease: false
201
+ type: :runtime
202
202
  version_requirements: !ruby/object:Gem::Requirement
203
203
  requirements:
204
204
  - - "~>"
@@ -211,8 +211,8 @@ dependencies:
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0.8'
213
213
  name: minitar
214
- type: :runtime
215
214
  prerelease: false
215
+ type: :runtime
216
216
  version_requirements: !ruby/object:Gem::Requirement
217
217
  requirements:
218
218
  - - "~>"
@@ -225,8 +225,8 @@ dependencies:
225
225
  - !ruby/object:Gem::Version
226
226
  version: '1'
227
227
  name: rubyzip
228
- type: :runtime
229
228
  prerelease: false
229
+ type: :runtime
230
230
  version_requirements: !ruby/object:Gem::Requirement
231
231
  requirements:
232
232
  - - "~>"
@@ -239,8 +239,8 @@ dependencies:
239
239
  - !ruby/object:Gem::Version
240
240
  version: 0.3.6
241
241
  name: thread_safe
242
- type: :runtime
243
242
  prerelease: false
243
+ type: :runtime
244
244
  version_requirements: !ruby/object:Gem::Requirement
245
245
  requirements:
246
246
  - - "~>"
@@ -253,8 +253,8 @@ dependencies:
253
253
  - !ruby/object:Gem::Version
254
254
  version: 0.4.8
255
255
  name: jrjackson
256
- type: :runtime
257
256
  prerelease: false
257
+ type: :runtime
258
258
  version_requirements: !ruby/object:Gem::Requirement
259
259
  requirements:
260
260
  - - '='
@@ -267,8 +267,8 @@ dependencies:
267
267
  - !ruby/object:Gem::Version
268
268
  version: '5'
269
269
  name: elasticsearch
270
- type: :runtime
271
270
  prerelease: false
271
+ type: :runtime
272
272
  version_requirements: !ruby/object:Gem::Requirement
273
273
  requirements:
274
274
  - - "~>"
@@ -281,8 +281,8 @@ dependencies:
281
281
  - !ruby/object:Gem::Version
282
282
  version: '0.6'
283
283
  name: manticore
284
- type: :runtime
285
284
  prerelease: false
285
+ type: :runtime
286
286
  version_requirements: !ruby/object:Gem::Requirement
287
287
  requirements:
288
288
  - - "~>"
@@ -295,8 +295,8 @@ dependencies:
295
295
  - !ruby/object:Gem::Version
296
296
  version: 0.9.0
297
297
  name: faraday
298
- type: :runtime
299
298
  prerelease: false
299
+ type: :runtime
300
300
  version_requirements: !ruby/object:Gem::Requirement
301
301
  requirements:
302
302
  - - "~>"