fluent-plugin-mysql-replicator 1.0.1 → 1.0.2
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 +5 -5
- data/README.md +2 -2
- data/fluent-plugin-mysql-replicator.gemspec +1 -1
- data/lib/fluent/plugin/in_mysql_replicator_multi.rb +16 -4
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5c523ddf1d5052d11c6c7a0f7e9172d319c881257d791a0006cd1a6601f5a948
|
4
|
+
data.tar.gz: ca9f218dfa56543f141d8911578250194281bfbad16d8f5ed6b4980120d99c8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5266cd4f824e781d53eaa613c37f260c7814badcee87fb6c49a1321e9c9ac8bc8d9505b2ea800f3a8ccde237b2b0eeb808e187463996c2b1aecc93065128869
|
7
|
+
data.tar.gz: 70834ef8629d34bbd53aa1ff9d66ba706d6df5b48cd310d8a554c7d25628682633860123f63855e851482abda385e6288c4fcd01da848cbffc56bc0525553968
|
data/README.md
CHANGED
@@ -31,13 +31,13 @@ install with gem or fluent-gem command as:
|
|
31
31
|
|
32
32
|
`````
|
33
33
|
# for system installed fluentd
|
34
|
-
$ gem install fluent-plugin-mysql-replicator -v 1.0.
|
34
|
+
$ gem install fluent-plugin-mysql-replicator -v 1.0.2
|
35
35
|
|
36
36
|
# for td-agent2
|
37
37
|
$ sudo td-agent-gem install fluent-plugin-mysql-replicator -v 0.6.1
|
38
38
|
|
39
39
|
# for td-agent3
|
40
|
-
$ sudo td-agent-gem install fluent-plugin-mysql-replicator -v 1.0.
|
40
|
+
$ sudo td-agent-gem install fluent-plugin-mysql-replicator -v 1.0.2
|
41
41
|
`````
|
42
42
|
|
43
43
|
## Included plugins
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = "fluent-plugin-mysql-replicator"
|
4
|
-
s.version = "1.0.
|
4
|
+
s.version = "1.0.2"
|
5
5
|
s.authors = ["Kentaro Yoshida"]
|
6
6
|
s.email = ["y.ken.studio@gmail.com"]
|
7
7
|
s.homepage = "https://github.com/y-ken/fluent-plugin-mysql-replicator"
|
@@ -1,9 +1,11 @@
|
|
1
|
-
require 'fluent/input'
|
1
|
+
require 'fluent/plugin/input'
|
2
2
|
|
3
3
|
module Fluent::Plugin
|
4
|
-
class MysqlReplicatorMultiInput < Fluent::Input
|
4
|
+
class MysqlReplicatorMultiInput < Fluent::Plugin::Input
|
5
5
|
Fluent::Plugin.register_input('mysql_replicator_multi', self)
|
6
6
|
|
7
|
+
helpers :thread
|
8
|
+
|
7
9
|
def initialize
|
8
10
|
require 'mysql2'
|
9
11
|
require 'digest/sha1'
|
@@ -34,6 +36,7 @@ module Fluent::Plugin
|
|
34
36
|
@mutex = Mutex.new
|
35
37
|
@manager_db = get_manager_connection
|
36
38
|
@manager_db.query("SET SESSION wait_timeout=1800;")
|
39
|
+
@running = true
|
37
40
|
@threads << thread_create(:in_mysql_replicator_flusher) {
|
38
41
|
@hash_table_bulk_insert = []
|
39
42
|
@hash_table_bulk_insert_last_time = Time.now
|
@@ -51,7 +54,13 @@ module Fluent::Plugin
|
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
57
|
+
def stop
|
58
|
+
@running = false
|
59
|
+
super
|
60
|
+
end
|
61
|
+
|
54
62
|
def shutdown
|
63
|
+
@threads.each(&:join)
|
55
64
|
super
|
56
65
|
end
|
57
66
|
|
@@ -73,7 +82,7 @@ module Fluent::Plugin
|
|
73
82
|
}
|
74
83
|
primary_key = config['primary_key']
|
75
84
|
previous_id = current_id = nil
|
76
|
-
|
85
|
+
while @running
|
77
86
|
rows_count = 0
|
78
87
|
start_time = Time.now
|
79
88
|
unless config['prepared_query'].nil?
|
@@ -214,7 +223,7 @@ module Fluent::Plugin
|
|
214
223
|
|
215
224
|
def hash_table_flusher
|
216
225
|
begin
|
217
|
-
|
226
|
+
while @running
|
218
227
|
if @hash_table_bulk_insert.empty? || @bulk_insert_timeout > (Time.now - @hash_table_bulk_insert_last_time)
|
219
228
|
sleep @bulk_insert_timeout
|
220
229
|
next
|
@@ -223,6 +232,9 @@ module Fluent::Plugin
|
|
223
232
|
flush_hash_table
|
224
233
|
}
|
225
234
|
end
|
235
|
+
@mutex.synchronize {
|
236
|
+
flush_hash_table
|
237
|
+
}
|
226
238
|
rescue StandardError => e
|
227
239
|
@mutex.synchronize {
|
228
240
|
log.error "mysql_replicator_multi: failed to flush buffered query. :config=>#{masked_config}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-mysql-replicator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kentaro Yoshida
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -149,11 +149,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
|
-
|
153
|
-
rubygems_version: 2.6.11
|
152
|
+
rubygems_version: 3.1.6
|
154
153
|
signing_key:
|
155
154
|
specification_version: 4
|
156
155
|
summary: Fluentd input plugin to track insert/update/delete event from MySQL database
|
157
156
|
server. Not only that, it could multiple table replication and generate nested document
|
158
157
|
for Elasticsearch/Solr. It's comming support replicate to another RDB/noSQL.
|
159
|
-
test_files:
|
158
|
+
test_files:
|
159
|
+
- test/helper.rb
|
160
|
+
- test/plugin/test_in_mysql_replicator.rb
|
161
|
+
- test/plugin/test_in_mysql_replicator_multi.rb
|
162
|
+
- test/plugin/test_out_mysql_replicator_elasticsearch.rb
|
163
|
+
- test/plugin/test_out_mysql_replicator_solr.rb
|