fluent-plugin-cassandra-json 0.1.2 → 0.1.3

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: 8f0a54cd332017c0ef51daa42703420d01cc81163a08c65bfc265c1672fea7d4
4
- data.tar.gz: e74da50b90ac352caba817515223a17dea06eeac53011aa433c261a5e2160e9d
3
+ metadata.gz: 124d011ac7e9cef45d13531d991010f90583bc7d121ec8dcfa0ef48997582aa0
4
+ data.tar.gz: 46ea571783aee03416d936d992673869fa117e4fbefc14616c636560f0cd536e
5
5
  SHA512:
6
- metadata.gz: a1e5f642dc19ae1811f9f556a39e941fa4754e19bc7ac127a9dba64bab4abd285df56448b5b311c23bbec647ee0ff488d22acff81205728ac391c6e4431e9aca
7
- data.tar.gz: d46fd63678806d8f7f194fc7044403142dd5954c70b8b4f459f41430efe7b822fae3e571b94626ce038618cfee54a3c5f40d6662eebad63ebd958b0d6f0a194b
6
+ metadata.gz: 6a138f83bf458a88754680f515a28631984b5f44b2fdea011a270a4c1a57df4c02fdff4f0b6782b4a5c669b4071bd11abcf6996c7edd515ca00ef586d00bc4bc
7
+ data.tar.gz: bd7aa50cbf401906f39d4b0bdfad226d59022cdb122c87211a270998bead1e802df59ec7ccb8d35c5aa4779b7b8a4490b096bea1821f28415bbf3d29ad0266df
data/README.md CHANGED
@@ -83,6 +83,10 @@ Use IF NOT EXIST option on INSERT
83
83
 
84
84
  Use TTL option on INSERT
85
85
 
86
+ ### idempotent (bool) (optional)
87
+
88
+ Specify whether this statement can be retried safely on timeout
89
+
86
90
  ### skip_invalid_rows (bool) (optional)
87
91
 
88
92
  Treat request as success, even if invalid rows exist
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "fluent-plugin-cassandra-json"
6
- spec.version = "0.1.2"
6
+ spec.version = "0.1.3"
7
7
  spec.authors = ["joker1007"]
8
8
  spec.email = ["kakyoin.hierophant@gmail.com"]
9
9
 
@@ -48,6 +48,8 @@ module Fluent
48
48
  desc: "Use IF NOT EXIST option on INSERT"
49
49
  config_param :ttl, :integer, default: nil,
50
50
  desc: "Use TTL option on INSERT"
51
+ config_param :idempotent, :bool, default: false,
52
+ desc: "Specify whether this statement can be retried safely on timeout"
51
53
 
52
54
  config_param :skip_invalid_rows, :bool, default: true,
53
55
  desc: "Treat request as success, even if invalid rows exist"
@@ -76,13 +78,15 @@ module Fluent
76
78
  super
77
79
 
78
80
  @cluster = Cassandra.cluster(@cluster_options)
79
- @session = @cluster.connect(@keyspace)
81
+ end
82
+
83
+ def session
84
+ Thread.current[:session] ||= @cluster.connect(@keyspace)
80
85
  end
81
86
 
82
87
  def close
83
88
  super
84
89
 
85
- @session.close
86
90
  @cluster.close
87
91
  end
88
92
 
@@ -110,7 +114,7 @@ module Fluent
110
114
  cql << " IF NOT EXISTS" if @if_not_exists
111
115
  cql << " USING TTL #{@ttl}" if @ttl && @ttl > 0
112
116
  @log.debug(cql)
113
- future = @session.execute_async(cql, consistency: @consistency)
117
+ future = session.execute_async(cql, consistency: @consistency, idempotent: @idempotent)
114
118
  future.on_failure do |error|
115
119
  if @skip_invalid_rows
116
120
  @log.warn("failed to insert", record: line, error: error)
@@ -16,6 +16,7 @@ class CassandraJsonOutputTest < Test::Unit::TestCase
16
16
  port #{ENV.fetch("CASSANDRA_PORT", "9042")}
17
17
  keyspace test_keyspace
18
18
  table test_table
19
+ idempotent true
19
20
  ]
20
21
 
21
22
  test "write data" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-cassandra-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - joker1007
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-16 00:00:00.000000000 Z
11
+ date: 2018-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.7.4
140
+ rubygems_version: 2.7.7
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Insert data to cassandra plugin for fluentd (Use INSERT JSON).