fluentd 0.14.22.rc1 → 0.14.22.rc2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cabaaf075c80b44f6b8f77efb057ad809212f871
4
- data.tar.gz: 7092d208bb92fe4992764dbe418b117976a7ba66
3
+ metadata.gz: 2e01e6085ba9a64e0d45542f56d76ea2f1cbd0ec
4
+ data.tar.gz: ecc01811bfe9bd014e42b2f338475428aecec35c
5
5
  SHA512:
6
- metadata.gz: 235273ae1d58e4e3c3be98642805cb9d62ac3df2c75cc94622ee78bf62b65e5927aec1ad9ba2043f4c06b65abed6a490340243fb1b82d42e6e0e8e9bd8d4a500
7
- data.tar.gz: dcab5670899cb22e7914cffcb2a31f590d054f31ec44b500720cbbc02e59c4f22a9da02b2078035dc5dbf7eea625c34f60f8002eb9c83271c60f0b02883a0a9c
6
+ metadata.gz: 9f1895eea93d665cd36160f1290c9d6898b7f065477e60a873792ae17769412bf4ede53455bc10fc9338c71cf1b8dc8a18f1638237b3195b21a7448beec06243
7
+ data.tar.gz: c19abd745f755d4fc27b8702b7ccd8f0e312ab6fd13c53bdd5b6bf577c19a283d5979c3744de4fffff4c88947d39d7cbc0376edf314de511c844c543af718deb
@@ -156,6 +156,18 @@ module Fluent
156
156
  @_state.terminate
157
157
  end
158
158
 
159
+ def called_in_test?
160
+ caller_locations.each do |location|
161
+ # Thread::Backtrace::Location#path returns base filename or absolute path.
162
+ # #absolute_path returns absolute_path always.
163
+ # https://bugs.ruby-lang.org/issues/12159
164
+ if location.absolute_path =~ /\/test_[^\/]+\.rb$/ # location.path =~ /test_.+\.rb$/
165
+ return true
166
+ end
167
+ end
168
+ false
169
+ end
170
+
159
171
  def inspect
160
172
  # Plugin instances are sometimes too big to dump because it may have too many thins (buffer,storage, ...)
161
173
  # Original commit comment says that:
@@ -66,7 +66,7 @@ module Fluent
66
66
  end
67
67
 
68
68
  type_of_owner = Plugin.lookup_type_from_class(@_owner.class)
69
- if @@buffer_paths.has_key?(@path) && !buffer_path_for_test?
69
+ if @@buffer_paths.has_key?(@path) && !called_in_test?
70
70
  type_using_this_path = @@buffer_paths[@path]
71
71
  raise ConfigError, "Other '#{type_using_this_path}' plugin already use same buffer path: type = #{type_of_owner}, buffer path = #{@path}"
72
72
  end
@@ -114,18 +114,6 @@ module Fluent
114
114
  @multi_workers_available
115
115
  end
116
116
 
117
- def buffer_path_for_test?
118
- caller_locations.each do |location|
119
- # Thread::Backtrace::Location#path returns base filename or absolute path.
120
- # #absolute_path returns absolute_path always.
121
- # https://bugs.ruby-lang.org/issues/12159
122
- if location.absolute_path =~ /\/test_[^\/]+\.rb$/ # location.path =~ /test_.+\.rb$/
123
- return true
124
- end
125
- end
126
- false
127
- end
128
-
129
117
  def start
130
118
  FileUtils.mkdir_p File.dirname(@path), mode: @dir_permission
131
119
 
@@ -170,10 +158,14 @@ module Fluent
170
158
  def generate_chunk(metadata)
171
159
  # FileChunk generates real path with unique_id
172
160
  if @file_permission
173
- Fluent::Plugin::Buffer::FileChunk.new(metadata, @path, :create, perm: @file_permission, compress: @compress)
161
+ chunk = Fluent::Plugin::Buffer::FileChunk.new(metadata, @path, :create, perm: @file_permission, compress: @compress)
174
162
  else
175
- Fluent::Plugin::Buffer::FileChunk.new(metadata, @path, :create, compress: @compress)
163
+ chunk = Fluent::Plugin::Buffer::FileChunk.new(metadata, @path, :create, compress: @compress)
176
164
  end
165
+
166
+ log.debug "Created new chunk", chunk_id: dump_unique_id_hex(chunk.unique_id), metadata: metadata
167
+
168
+ return chunk
177
169
  end
178
170
  end
179
171
  end
@@ -313,22 +313,24 @@ module Fluent
313
313
 
314
314
  def enqueue_chunk(metadata)
315
315
  log.trace "enqueueing chunk", instance: self.object_id, metadata: metadata
316
- synchronize do
317
- chunk = @stage.delete(metadata)
318
- return nil unless chunk
316
+ chunk = synchronize do
317
+ @stage.delete(metadata)
318
+ end
319
+ return nil unless chunk
319
320
 
320
- chunk.synchronize do
321
+ chunk.synchronize do
322
+ synchronize do
321
323
  if chunk.empty?
322
324
  chunk.close
323
325
  else
324
326
  @queue << chunk
325
327
  @queued_num[metadata] = @queued_num.fetch(metadata, 0) + 1
326
- chunk.enqueued! if chunk.respond_to?(:enqueued!)
328
+ chunk.enqueued!
327
329
  end
330
+ bytesize = chunk.bytesize
331
+ @stage_size -= bytesize
332
+ @queue_size += bytesize
328
333
  end
329
- bytesize = chunk.bytesize
330
- @stage_size -= bytesize
331
- @queue_size += bytesize
332
334
  end
333
335
  nil
334
336
  end
@@ -340,7 +342,7 @@ module Fluent
340
342
  metadata = chunk.metadata
341
343
  @queue << chunk
342
344
  @queued_num[metadata] = @queued_num.fetch(metadata, 0) + 1
343
- chunk.enqueued! if chunk.respond_to?(:enqueued!)
345
+ chunk.enqueued!
344
346
  end
345
347
  @queue_size += chunk.bytesize
346
348
  end
@@ -348,17 +350,18 @@ module Fluent
348
350
 
349
351
  def enqueue_all
350
352
  log.trace "enqueueing all chunks in buffer", instance: self.object_id
351
- synchronize do
352
- if block_given?
353
- @stage.keys.each do |metadata|
354
- chunk = @stage[metadata]
355
- v = yield metadata, chunk
356
- enqueue_chunk(metadata) if v
357
- end
358
- else
359
- @stage.keys.each do |metadata|
360
- enqueue_chunk(metadata)
361
- end
353
+ if block_given?
354
+ synchronize{ @stage.keys }.each do |metadata|
355
+ # NOTE: The following line might cause data race depending on Ruby implementations except CRuby
356
+ # cf. https://github.com/fluent/fluentd/pull/1721#discussion_r146170251
357
+ chunk = @stage[metadata]
358
+ next unless chunk
359
+ v = yield metadata, chunk
360
+ enqueue_chunk(metadata) if v
361
+ end
362
+ else
363
+ synchronize{ @stage.keys }.each do |metadata|
364
+ enqueue_chunk(metadata)
362
365
  end
363
366
  end
364
367
  end
@@ -87,6 +87,8 @@ module Fluent::Plugin
87
87
 
88
88
  attr_reader :paths
89
89
 
90
+ @@pos_file_paths = {}
91
+
90
92
  def configure(conf)
91
93
  compat_parameters_convert(conf, :parser)
92
94
  parser_config = conf.elements('parse').first
@@ -109,7 +111,13 @@ module Fluent::Plugin
109
111
  end
110
112
 
111
113
  # TODO: Use plugin_root_dir and storage plugin to store positions if available
112
- unless @pos_file
114
+ if @pos_file
115
+ if @@pos_file_paths.has_key?(@pos_file) && !called_in_test?
116
+ plugin_id_using_this_path = @@pos_file_paths[@pos_file]
117
+ raise Fluent::ConfigError, "Other 'in_tail' plugin already use same pos_file path: plugin_id = #{plugin_id_using_this_path}, pos_file path = #{@pos_file}"
118
+ end
119
+ @@pos_file_paths[@pos_file] = self.plugin_id
120
+ else
113
121
  $log.warn "'pos_file PATH' parameter is not set to a 'tail' source."
114
122
  $log.warn "this parameter is highly recommended to save the position to resume tailing."
115
123
  end
@@ -513,7 +513,7 @@ module Fluent
513
513
  install_main_process_signal_handlers
514
514
 
515
515
  # This is the only log messsage for @standalone_worker
516
- $log.info "starting fluentd-#{Fluent::VERSION} without supervision", pid: Process.pid if @standalone_worker
516
+ $log.info "starting fluentd-#{Fluent::VERSION} without supervision", pid: Process.pid, ruby: RUBY_VERSION if @standalone_worker
517
517
 
518
518
  main_process do
519
519
  create_socket_manager if @standalone_worker
@@ -535,7 +535,7 @@ module Fluent
535
535
  end
536
536
 
537
537
  def dry_run_cmd
538
- $log.info "starting fluentd-#{Fluent::VERSION} as dry run mode"
538
+ $log.info "starting fluentd-#{Fluent::VERSION} as dry run mode", ruby: RUBY_VERSION
539
539
  @system_config.suppress_config_dump = true
540
540
  dry_run
541
541
  exit 0
@@ -571,7 +571,7 @@ module Fluent
571
571
  dry_run
572
572
 
573
573
  Process.setproctitle("supervisor:#{@process_name}") if @process_name
574
- $log.info "starting fluentd-#{Fluent::VERSION}", pid: Process.pid
574
+ $log.info "starting fluentd-#{Fluent::VERSION}", pid: Process.pid, ruby: RUBY_VERSION
575
575
 
576
576
  rubyopt = ENV["RUBYOPT"]
577
577
  fluentd_spawn_cmd = [ServerEngine.ruby_bin_path, "-Eascii-8bit:ascii-8bit"]
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '0.14.22.rc1'
19
+ VERSION = '0.14.22.rc2'
20
20
 
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluentd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.22.rc1
4
+ version: 0.14.22.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-13 00:00:00.000000000 Z
11
+ date: 2017-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -740,7 +740,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
740
740
  version: 1.3.1
741
741
  requirements: []
742
742
  rubyforge_project:
743
- rubygems_version: 2.6.12
743
+ rubygems_version: 2.6.13
744
744
  signing_key:
745
745
  specification_version: 4
746
746
  summary: Fluentd event collector