fluent-plugin-webhdfs 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -0
- data/Appraisals +6 -0
- data/README.md +1 -0
- data/fluent-plugin-webhdfs.gemspec +2 -2
- data/gemfiles/fluentd_v0.14.gemfile +7 -0
- data/lib/fluent/plugin/out_webhdfs.rb +2 -0
- data/lib/fluent/plugin/webhdfs_compressor_snappy.rb +5 -1
- data/test/plugin/test_compressor.rb +33 -4
- data/test/plugin/test_out_webhdfs.rb +6 -2
- metadata +17 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6037c3f039431852ee3f19e0fde88a37a00636c3
|
4
|
+
data.tar.gz: 4dbc0b1bbaf6d921bcd4331392ed0e5ac980e28b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4f58538cb9ee701da053b7a3d5a3c60f338e25a6de00980b6ed29817c08d37910d84bf9bb314e1936353aa45cd282d10601e8e8fea897c65583513b305ac58b
|
7
|
+
data.tar.gz: 7cc16b12bd77d47b50b0368c7f7dbc58188f9a8e980acb41e1d45428a48f47aade6d3b357c113cdeee8410e3784747300df17707c28f4eaf9107cfd0376c7e24
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -131,6 +131,7 @@ If you want to compress data before storing it:
|
|
131
131
|
</match>
|
132
132
|
|
133
133
|
Note that if you set `compress gzip`, then the suffix `.gz` will be added to path (or `.bz2`, `sz`, `.lzo`).
|
134
|
+
Note that you have to install snappy gem if you want to set `compress snappy`.
|
134
135
|
|
135
136
|
### Namenode HA / Auto retry for WebHDFS known errors
|
136
137
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "fluent-plugin-webhdfs"
|
5
|
-
gem.version = "0.5.
|
5
|
+
gem.version = "0.5.2"
|
6
6
|
gem.authors = ["TAGOMORI Satoshi"]
|
7
7
|
gem.email = ["tagomoris@gmail.com"]
|
8
8
|
gem.summary = %q{Fluentd plugin to write data on HDFS over WebHDFS, with flexible formatting}
|
@@ -18,10 +18,10 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_development_dependency "rake"
|
19
19
|
gem.add_development_dependency "test-unit"
|
20
20
|
gem.add_development_dependency "appraisal"
|
21
|
+
gem.add_development_dependency "snappy", '>= 0.0.13'
|
21
22
|
gem.add_runtime_dependency "fluentd", '>= 0.10.59'
|
22
23
|
gem.add_runtime_dependency "fluent-mixin-plaintextformatter", '>= 0.2.1'
|
23
24
|
gem.add_runtime_dependency "fluent-mixin-config-placeholders", ">= 0.3.0"
|
24
25
|
gem.add_runtime_dependency "webhdfs", '>= 0.6.0'
|
25
26
|
gem.add_runtime_dependency "bzip2-ffi"
|
26
|
-
gem.add_runtime_dependency "snappy", '>= 0.0.13'
|
27
27
|
end
|
@@ -127,6 +127,8 @@ class Fluent::WebHDFSOutput < Fluent::TimeSlicedOutput
|
|
127
127
|
|
128
128
|
begin
|
129
129
|
@compressor = COMPRESSOR_REGISTRY.lookup(@compress || 'text').new
|
130
|
+
rescue Fluent::ConfigError
|
131
|
+
raise
|
130
132
|
rescue
|
131
133
|
$log.warn "#{@comress} not found. Use 'text' instead"
|
132
134
|
@compressor = COMPRESSOR_REGISTRY.lookup('text').new
|
@@ -4,7 +4,11 @@ module Fluent
|
|
4
4
|
WebHDFSOutput.register_compressor('snappy', self)
|
5
5
|
|
6
6
|
def initialize(options = {})
|
7
|
-
|
7
|
+
begin
|
8
|
+
require "snappy"
|
9
|
+
rescue LoadError
|
10
|
+
raise Fluent::ConfigError, "Install snappy before use snappy compressor"
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
def ext
|
@@ -1,24 +1,53 @@
|
|
1
1
|
require "helper"
|
2
2
|
require "fluent/plugin/buf_memory"
|
3
|
-
|
3
|
+
begin
|
4
|
+
require "snappy"
|
5
|
+
rescue LoadError
|
6
|
+
end
|
4
7
|
|
5
8
|
class CompressorTest < Test::Unit::TestCase
|
6
9
|
class Snappy < self
|
10
|
+
|
11
|
+
CONFIG = %[
|
12
|
+
host namenode.local
|
13
|
+
path /hdfs/path/file.%Y%m%d.log
|
14
|
+
]
|
15
|
+
|
7
16
|
def setup
|
17
|
+
omit unless Object.const_defined?(:Snappy)
|
18
|
+
Fluent::Test.setup
|
8
19
|
@compressor = Fluent::WebHDFSOutput::SnappyCompressor.new
|
9
20
|
end
|
10
21
|
|
22
|
+
def create_driver(conf=CONFIG,tag='test')
|
23
|
+
Fluent::Test::OutputTestDriver.new(Fluent::WebHDFSOutput, tag).configure(conf)
|
24
|
+
end
|
25
|
+
|
11
26
|
def test_ext
|
12
27
|
assert_equal(".sz", @compressor.ext)
|
13
28
|
end
|
14
29
|
|
15
30
|
def test_compress
|
16
|
-
|
17
|
-
|
31
|
+
d = create_driver
|
32
|
+
if d.instance.respond_to?(:buffer)
|
33
|
+
buffer = d.instance.buffer
|
34
|
+
else
|
35
|
+
buffer = d.instance.instance_variable_get(:@buffer)
|
36
|
+
end
|
37
|
+
|
38
|
+
if buffer.respond_to?(:generate_chunk)
|
39
|
+
chunk = buffer.generate_chunk("test")
|
40
|
+
chunk.concat("hello snappy\n" * 32 * 1024, 1)
|
41
|
+
else
|
42
|
+
chunk = buffer.new_chunk("test")
|
43
|
+
chunk << "hello snappy\n" * 32 * 1024
|
44
|
+
end
|
45
|
+
|
18
46
|
io = Tempfile.new("snappy-")
|
19
47
|
@compressor.compress(chunk, io)
|
20
48
|
io.open
|
21
|
-
|
49
|
+
chunk_bytesize = chunk.respond_to?(:bytesize) ? chunk.bytesize : chunk.size
|
50
|
+
assert(chunk_bytesize > io.read.bytesize)
|
22
51
|
io.rewind
|
23
52
|
reader = ::Snappy::Reader.new(io)
|
24
53
|
assert_equal(chunk.read, reader.read)
|
@@ -73,11 +73,15 @@ kerberos true
|
|
73
73
|
lzo: ['lzo_command', Fluent::WebHDFSOutput::LZOCommandCompressor])
|
74
74
|
def test_compress(data)
|
75
75
|
compress_type, compressor_class = data
|
76
|
-
|
76
|
+
begin
|
77
|
+
d = create_driver %[
|
77
78
|
namenode server.local:14000
|
78
79
|
path /hdfs/path/file.%Y%m%d.%H%M.log
|
79
80
|
compress #{compress_type}
|
80
|
-
]
|
81
|
+
]
|
82
|
+
rescue Fluent::ConfigError => ex
|
83
|
+
omit ex.message
|
84
|
+
end
|
81
85
|
assert_equal 'server.local', d.instance.instance_eval{ @namenode_host }
|
82
86
|
assert_equal 14000, d.instance.instance_eval{ @namenode_port }
|
83
87
|
assert_equal '/hdfs/path/file.%Y%m%d.%H%M.log', d.instance.path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-webhdfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: snappy
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.13
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.0.13
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: fluentd
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,20 +136,6 @@ dependencies:
|
|
122
136
|
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: snappy
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 0.0.13
|
132
|
-
type: :runtime
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 0.0.13
|
139
139
|
description: For WebHDFS and HttpFs of Hadoop HDFS
|
140
140
|
email:
|
141
141
|
- tagomoris@gmail.com
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- Rakefile
|
153
153
|
- fluent-plugin-webhdfs.gemspec
|
154
154
|
- gemfiles/fluentd_v0.12.gemfile
|
155
|
+
- gemfiles/fluentd_v0.14.gemfile
|
155
156
|
- lib/fluent/plugin/out_webhdfs.rb
|
156
157
|
- lib/fluent/plugin/webhdfs_compressor_bzip2.rb
|
157
158
|
- lib/fluent/plugin/webhdfs_compressor_gzip.rb
|