ecco 0.5.0-java → 1.0.0-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
- SHA1:
3
- metadata.gz: 84fe8c1083c6c56837721f68472ed1c251b44da3
4
- data.tar.gz: 0b2c7d8450fa67482bf3762cef869f211ec40b6b
2
+ SHA256:
3
+ metadata.gz: bcc0014afbb807fd4af02e4d2d28df3db7dabbc13b40aebca03902d1bb9ae2e4
4
+ data.tar.gz: 9985341f1e8b0d2f9c2c28825181463dcf19f87fa79cb6e66510ba040774a28d
5
5
  SHA512:
6
- metadata.gz: d413840d24fad29536c09f05e2667f5838b37f291db7fbe34e3b4417e872fd48f8cb6af7f8013a8a8c8f6e91f4a6e440d439a23114e71bc3e4a032b382d78359
7
- data.tar.gz: 8d398553a7d376e60883565d3a81df6c171e96cb618f9afcd0d68923710187f7acacbdcf259a547935b7584dc6198be71378e93b222b9777b90b2e321d31b1cb
6
+ metadata.gz: b488e13f695d9d3f41ae1ee28b8d0630506130f66d8b992058c067a51f82a70d6528201c5c53889dbcede9b9b8e8216e953e846f7a15a7f1d279876e8f7ac2da
7
+ data.tar.gz: 950e8a354dfc1f2bbd72a638cc18a823d52f51c310a20e186df8b87ff192652e03349be27a91f9b3a9c8acc3bd337ffbb445ce303b01a259ba811f732b8ee233
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ build:
9
+ env:
10
+ JRUBY_OPTS: '-J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -Xcompile.invokedynamic=false'
11
+ JAVA_OPTS: ${{ matrix.java_opts }}
12
+
13
+ runs-on: ubuntu-18.04
14
+
15
+ strategy:
16
+ matrix:
17
+ include:
18
+ - mysql: 5-7
19
+ java_opts: '-Djava.security.properties=docker/ecco-java.security' # Enable TLS 1.1, required by MySQL 5.7
20
+ - mysql: 8-0
21
+ java_opts: ''
22
+
23
+ steps:
24
+ - name: Checkout code
25
+ uses: actions/checkout@v2
26
+
27
+ - name: Start MySQL container
28
+ run: docker-compose -f docker-compose-mysql-base.yml -f docker-compose-mysql-${{ matrix.mysql }}.yml up -d
29
+
30
+ - name: Setup Ruby
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: jruby-9.2.18.0
34
+ bundler-cache: true
35
+
36
+ - name: Run tests
37
+ run: bin/all_specs
data/.gitignore CHANGED
@@ -8,4 +8,3 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  .env
11
- .vagrant
data/CHANGELOG.md ADDED
@@ -0,0 +1,134 @@
1
+ # Changelog
2
+
3
+ ## [v0.8.0](https://github.com/twingly/ecco/tree/v0.8.0) (2020-10-23)
4
+
5
+ [Full Changelog](https://github.com/twingly/ecco/compare/v0.7.0...v0.8.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Drop MySQL 5.5 support [\#45](https://github.com/twingly/ecco/issues/45)
10
+ - Update Vagrant box to ubuntu/bionic64 [\#39](https://github.com/twingly/ecco/issues/39)
11
+
12
+ **Closed issues:**
13
+
14
+ - Update mysql-binlog-connector [\#18](https://github.com/twingly/ecco/issues/18)
15
+
16
+ **Merged pull requests:**
17
+
18
+ - Run tests on Travis CI against MySQL 5.6/5.7/8.0 [\#53](https://github.com/twingly/ecco/pull/53) ([Chrizpy](https://github.com/Chrizpy))
19
+ - Update JRuby to 9.2.13.0 [\#50](https://github.com/twingly/ecco/pull/50) ([Chrizpy](https://github.com/Chrizpy))
20
+ - Update mysql-binlog-connector-java to 0.21.0 [\#48](https://github.com/twingly/ecco/pull/48) ([walro](https://github.com/walro))
21
+ - Drop JRuby 9.1 support [\#47](https://github.com/twingly/ecco/pull/47) ([walro](https://github.com/walro))
22
+ - Drop offical support for MySQL 5.5 [\#46](https://github.com/twingly/ecco/pull/46) ([walro](https://github.com/walro))
23
+ - Bump rake version [\#44](https://github.com/twingly/ecco/pull/44) ([walro](https://github.com/walro))
24
+ - Update mysql-binlog-connector-java to 0.20.1 [\#43](https://github.com/twingly/ecco/pull/43) ([roback](https://github.com/roback))
25
+ - Run MySQL 5.6 in Docker on Travis CI [\#42](https://github.com/twingly/ecco/pull/42) ([walro](https://github.com/walro))
26
+ - Replace Vagrant with Docker \(Compose\) [\#40](https://github.com/twingly/ecco/pull/40) ([walro](https://github.com/walro))
27
+ - Update mysql-binlog-connector to 0.19.1 [\#38](https://github.com/twingly/ecco/pull/38) ([roback](https://github.com/roback))
28
+ - Use JRuby 9.2.7.0 on Travis CI [\#37](https://github.com/twingly/ecco/pull/37) ([roback](https://github.com/roback))
29
+ - Run Travis CI tests on 9.2.6.0 [\#36](https://github.com/twingly/ecco/pull/36) ([walro](https://github.com/walro))
30
+ - Update mysql-binlog-connector to 0.19.0 [\#35](https://github.com/twingly/ecco/pull/35) ([roback](https://github.com/roback))
31
+ - Update mysql-binlog-connector dependency to 0.18.0 [\#34](https://github.com/twingly/ecco/pull/34) ([walro](https://github.com/walro))
32
+ - Run latest JRuby on Travis and ensure we stick to bundler 1.x [\#33](https://github.com/twingly/ecco/pull/33) ([walro](https://github.com/walro))
33
+ - Test with latest version of JRuby 9.2.x [\#31](https://github.com/twingly/ecco/pull/31) ([walro](https://github.com/walro))
34
+ - Test with the latest rubies [\#30](https://github.com/twingly/ecco/pull/30) ([walro](https://github.com/walro))
35
+ - Accessor methods for connect\_timeout and heartbeat\_interval [\#28](https://github.com/twingly/ecco/pull/28) ([roback](https://github.com/roback))
36
+ - Update mysql-binlog-connector dependency to 0.16.1 [\#27](https://github.com/twingly/ecco/pull/27) ([walro](https://github.com/walro))
37
+
38
+ ## [v0.7.0](https://github.com/twingly/ecco/tree/v0.7.0) (2016-10-07)
39
+
40
+ [Full Changelog](https://github.com/twingly/ecco/compare/v0.6.1...v0.7.0)
41
+
42
+ **Implemented enhancements:**
43
+
44
+ - Extend on\_save\_position with information about the event [\#23](https://github.com/twingly/ecco/issues/23)
45
+
46
+ **Merged pull requests:**
47
+
48
+ - Expose event information in on\_save\_position [\#24](https://github.com/twingly/ecco/pull/24) ([dentarg](https://github.com/dentarg))
49
+ - Add changelog [\#21](https://github.com/twingly/ecco/pull/21) ([dentarg](https://github.com/dentarg))
50
+
51
+ ## [v0.6.1](https://github.com/twingly/ecco/tree/v0.6.1) (2016-07-18)
52
+
53
+ [Full Changelog](https://github.com/twingly/ecco/compare/v0.6.0...v0.6.1)
54
+
55
+ **Merged pull requests:**
56
+
57
+ - MySQL 5.6 support [\#20](https://github.com/twingly/ecco/pull/20) ([jage](https://github.com/jage))
58
+ - Use standard rvm key for jruby version [\#19](https://github.com/twingly/ecco/pull/19) ([walro](https://github.com/walro))
59
+ - Improve rake task description [\#17](https://github.com/twingly/ecco/pull/17) ([jage](https://github.com/jage))
60
+
61
+ ## [v0.6.0](https://github.com/twingly/ecco/tree/v0.6.0) (2015-12-04)
62
+
63
+ [Full Changelog](https://github.com/twingly/ecco/compare/v0.5.0...v0.6.0)
64
+
65
+ **Closed issues:**
66
+
67
+ - Feature: Ecco::Client\#connected? [\#14](https://github.com/twingly/ecco/issues/14)
68
+
69
+ **Merged pull requests:**
70
+
71
+ - Implement Ecco::Client\#connected? [\#15](https://github.com/twingly/ecco/pull/15) ([jage](https://github.com/jage))
72
+
73
+ ## [v0.5.0](https://github.com/twingly/ecco/tree/v0.5.0) (2015-11-26)
74
+
75
+ [Full Changelog](https://github.com/twingly/ecco/compare/v0.4.1...v0.5.0)
76
+
77
+ **Fixed bugs:**
78
+
79
+ - Trying to connect to non-existent position behaves strange? [\#8](https://github.com/twingly/ecco/issues/8)
80
+
81
+ **Merged pull requests:**
82
+
83
+ - Add keep alive getters and setters [\#11](https://github.com/twingly/ecco/pull/11) ([dentarg](https://github.com/dentarg))
84
+ - Helper method for java root logger [\#10](https://github.com/twingly/ecco/pull/10) ([dentarg](https://github.com/dentarg))
85
+ - Add \#on\_communication\_failure [\#9](https://github.com/twingly/ecco/pull/9) ([walro](https://github.com/walro))
86
+
87
+ ## [v0.4.1](https://github.com/twingly/ecco/tree/v0.4.1) (2015-11-19)
88
+
89
+ [Full Changelog](https://github.com/twingly/ecco/compare/v0.4.0...v0.4.1)
90
+
91
+ **Implemented enhancements:**
92
+
93
+ - Ensure that we handle "on\_row\_event" before "on\_save\_position" [\#5](https://github.com/twingly/ecco/issues/5)
94
+
95
+ **Merged pull requests:**
96
+
97
+ - Make sure row\_event happens before save\_event [\#7](https://github.com/twingly/ecco/pull/7) ([roback](https://github.com/roback))
98
+ - Minor refactoring [\#6](https://github.com/twingly/ecco/pull/6) ([dentarg](https://github.com/dentarg))
99
+
100
+ ## [v0.4.0](https://github.com/twingly/ecco/tree/v0.4.0) (2015-11-18)
101
+
102
+ [Full Changelog](https://github.com/twingly/ecco/compare/v0.3.1...v0.4.0)
103
+
104
+ **Implemented enhancements:**
105
+
106
+ - Integration tests [\#2](https://github.com/twingly/ecco/issues/2)
107
+
108
+ **Merged pull requests:**
109
+
110
+ - Add integration tests [\#3](https://github.com/twingly/ecco/pull/3) ([roback](https://github.com/roback))
111
+
112
+ ## [v0.3.1](https://github.com/twingly/ecco/tree/v0.3.1) (2015-11-09)
113
+
114
+ [Full Changelog](https://github.com/twingly/ecco/compare/v0.3.0...v0.3.1)
115
+
116
+ ## [v0.3.0](https://github.com/twingly/ecco/tree/v0.3.0) (2015-11-09)
117
+
118
+ [Full Changelog](https://github.com/twingly/ecco/compare/v0.2.0...v0.3.0)
119
+
120
+ **Merged pull requests:**
121
+
122
+ - Implement basic functionality [\#1](https://github.com/twingly/ecco/pull/1) ([walro](https://github.com/walro))
123
+
124
+ ## [v0.2.0](https://github.com/twingly/ecco/tree/v0.2.0) (2015-10-27)
125
+
126
+ [Full Changelog](https://github.com/twingly/ecco/compare/v0.1.0...v0.2.0)
127
+
128
+ ## [v0.1.0](https://github.com/twingly/ecco/tree/v0.1.0) (2015-10-27)
129
+
130
+ [Full Changelog](https://github.com/twingly/ecco/compare/2296b8e6dadf9b7c4daa6d8fbe08fc78de8f8fc4...v0.1.0)
131
+
132
+
133
+
134
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Ecco
2
2
 
3
- [![Build Status](https://travis-ci.org/twingly/ecco.svg?branch=master)](https://travis-ci.org/twingly/ecco)
3
+ [![GitHub Build Status](https://github.com/twingly/ecco/workflows/CI/badge.svg?branch=master)](https://github.com/twingly/ecco/actions)
4
4
 
5
- MySQL replication binlog parser using [mysql-binlog-connector-java].
5
+ MySQL (5.7 and 8.0) replication binlog parser using [mysql-binlog-connector-java].
6
6
 
7
7
  ## Installation
8
8
 
@@ -46,8 +46,8 @@ client.on_row_event do |row_event|
46
46
  puts "Row event: #{database} #{table} #{type} #{second_column}"
47
47
  end
48
48
 
49
- client.on_save_position do |filename, position|
50
- puts "Save event: #{filename} #{position}"
49
+ client.on_save_position do |filename, position, event_type_name|
50
+ puts "Saved #{event_type_name} event: #{filename} #{position}"
51
51
  end
52
52
 
53
53
  client.on_communication_failure do |client, error|
@@ -65,7 +65,7 @@ client.start
65
65
 
66
66
  To download a new version of [mysql-binlog-connector-java]
67
67
 
68
- rake maven:dependencies
68
+ bundle exec rake maven:dependencies
69
69
 
70
70
  Note: You need Maven to download
71
71
 
@@ -91,25 +91,42 @@ The integration tests don't run by default. To run all the tests, including inte
91
91
 
92
92
  The tests needs a MySQL server with replication enabled.
93
93
 
94
- Ecco includes a Vagrant machine, that can be used for this. Note that your Vagrant host need to have [Ansible] installed as it is used for provisioning.
94
+ Ecco includes multiple Docker Compose definitions that can be used for this, one per supported MySQL version.
95
95
 
96
- Just start it before running the tests
96
+ Start the desired version before running the tests:
97
97
 
98
- vagrant up
98
+ ```shell
99
+ # MySQL 5.7
100
+ docker-compose -f docker-compose-mysql-base.yml -f docker-compose-mysql-5-7.yml up
99
101
 
100
- *Note: Stop any local mysql servers first as it forwards mysql to localhost:3306.*
102
+ # MySQL 8.0
103
+ docker-compose -f docker-compose-mysql-base.yml -f docker-compose-mysql-8-0.yml up
104
+ ```
105
+
106
+ *Note: Stop any local MySQL server first, otherwise there will be port collisions*
101
107
 
102
108
  ## Release
103
109
 
104
- To release a new version, update the version number in `version.rb`, and then run
110
+ To release a new version, make a commit bumping the version number in `version.rb`, and then run
105
111
 
106
112
  bundle exec rake release
107
113
 
108
114
  which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
109
115
 
116
+ Update the changelog with [GitHub Changelog Generator]:
117
+
118
+ github_changelog_generator
119
+
120
+ Preparations you might have to do:
121
+
122
+ * `gem install github_changelog_generator` if you don't have it
123
+ * set `CHANGELOG_GITHUB_TOKEN` to a personal access token to increase your GitHub API rate limit
124
+
125
+ Make a commit with the changelog changes and push.
126
+
110
127
  ## License
111
128
 
112
129
  The gem is available as open source under the terms of the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
113
130
 
114
- [mysql-binlog-connector-java]: https://github.com/shyiko/mysql-binlog-connector-java
115
- [Ansible]: http://www.ansible.com/
131
+ [mysql-binlog-connector-java]: https://github.com/osheroff/mysql-binlog-connector-java
132
+ [GitHub Changelog Generator]: https://github.com/skywinder/github-changelog-generator/
data/Rakefile CHANGED
@@ -1,11 +1,13 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
 
4
+ desc "Run non-integration specs"
4
5
  RSpec::Core::RakeTask.new(:spec) do |task|
5
6
  task.exclude_pattern = "spec/integration/*_spec.rb"
6
7
  end
7
8
 
8
9
  namespace :spec do
10
+ desc "Run all specs (including integration)"
9
11
  RSpec::Core::RakeTask.new(:all)
10
12
  end
11
13
 
@@ -0,0 +1,5 @@
1
+ version: "3.7"
2
+
3
+ services:
4
+ db:
5
+ image: mysql:5.7
@@ -0,0 +1,5 @@
1
+ version: "3.7"
2
+
3
+ services:
4
+ db:
5
+ image: mysql:8.0
@@ -0,0 +1,13 @@
1
+ # https://docs.docker.com/compose/extends/#adding-and-overriding-configuration
2
+
3
+ version: "3.7"
4
+
5
+ services:
6
+ db:
7
+ volumes:
8
+ - ./docker/ecco-my.cnf:/etc/mysql/conf.d/ecco-my.cnf
9
+ ports:
10
+ - 3306:3306
11
+ environment:
12
+ MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
13
+ MYSQL_DATABASE: ecco_test
@@ -0,0 +1,3 @@
1
+ jdk.tls.disabledAlgorithms=SSLv3, TLSv1, RC4, DES, MD5withRSA, \
2
+ DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
3
+ include jdk.disabled.namedCurves
@@ -2,4 +2,3 @@
2
2
  log-bin=mysql-bin
3
3
  server-id=1
4
4
  binlog-format=ROW
5
- bind-address=0.0.0.0
data/ecco.gemspec CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.10"
23
- spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "bundler", ">= 2.1.0"
23
+ spec.add_development_dependency "rake", "~> 12"
24
24
  spec.add_development_dependency "rspec"
25
25
  spec.add_development_dependency "sequel"
26
26
  spec.add_development_dependency "jdbc-mysql"
data/lib/ecco/client.rb CHANGED
@@ -3,6 +3,7 @@ require "ecco/row_event_listener"
3
3
  require "ecco/save_event_listener"
4
4
  require "ecco/lifecycle_failure_listener"
5
5
  require "ecco/error"
6
+ require "forwardable"
6
7
 
7
8
  module Ecco
8
9
  class Client
@@ -12,10 +13,25 @@ module Ecco
12
13
  def_delegators :@client, :set_server_id, :get_server_id
13
14
  def_delegators :@client, :set_keep_alive, :is_keep_alive
14
15
  def_delegators :@client, :set_keep_alive_interval, :get_keep_alive_interval
15
- def_delegators :@client, :set_keep_alive_connect_timeout, :get_keep_alive_connect_timeout
16
+ def_delegators :@client, :set_heartbeat_interval, :get_heartbeat_interval
17
+ def_delegators :@client, :set_connect_timeout, :get_connect_timeout
16
18
  def_delegators :@client, :set_binlog_filename, :get_binlog_filename
17
19
  def_delegators :@client, :set_binlog_position, :get_binlog_position
18
20
 
21
+ def get_keep_alive_connect_timeout
22
+ warn "[DEPRECATION] `#{__method__}` is deprecated. "\
23
+ "Please use `get_connect_timeout` instead."
24
+
25
+ get_connect_timeout
26
+ end
27
+
28
+ def set_keep_alive_connect_timeout(timeout)
29
+ warn "[DEPRECATION] `#{__method__}` is deprecated. "\
30
+ "Please use `set_connect_timeout` instead."
31
+
32
+ set_connect_timeout(timeout)
33
+ end
34
+
19
35
  java_import com.github.shyiko.mysql.binlog.BinaryLogClient
20
36
  java_import java.io.IOException
21
37
 
@@ -54,6 +70,10 @@ module Ecco
54
70
  @client.connect(connect_timeout)
55
71
  end
56
72
 
73
+ def connected?
74
+ @client.is_connected
75
+ end
76
+
57
77
  def stop
58
78
  @client.disconnect
59
79
  end
@@ -3,15 +3,35 @@ module Ecco
3
3
  include com.github.shyiko.mysql.binlog.BinaryLogClient::EventListener
4
4
  java_import com.github.shyiko.mysql.binlog.event.EventType
5
5
 
6
+ WRITE_EVENTS = { EventType::WRITE_ROWS => "WRITE_ROWS", EventType::EXT_WRITE_ROWS => "WRITE_ROWS" }
7
+ UPDATE_EVENTS = { EventType::UPDATE_ROWS => "UPDATE_ROWS", EventType::EXT_UPDATE_ROWS => "UPDATE_ROWS" }
8
+ DELETE_EVENTS = { EventType::DELETE_ROWS => "DELETE_ROWS" , EventType::EXT_DELETE_ROWS => "DELETE_ROWS" }
9
+ QUERY_EVENTS = { EventType::QUERY => "QUERY"}
10
+ ROTATE_EVENTS = { EventType::ROTATE => "ROTATE"}
11
+
12
+ TABLE_EVENT = EventType::TABLE_MAP
13
+
6
14
  attr_writer :callback
7
15
 
8
- def initialize(client)
16
+ def initialize(client, events_of_interest)
9
17
  @client = client
18
+
19
+ @events_of_interest = events_of_interest.reduce(&:merge)
20
+ @accepted_events = @events_of_interest.keys
21
+
10
22
  @callback = Proc.new {}
11
23
  end
12
24
 
13
25
  def on_event(event)
14
26
  raise NotImplementedError
15
27
  end
28
+
29
+ def accepted_events
30
+ @accepted_events
31
+ end
32
+
33
+ def event_type_to_string(type)
34
+ @events_of_interest.fetch(type)
35
+ end
16
36
  end
17
37
  end
@@ -3,18 +3,8 @@ require "ecco/row_event"
3
3
 
4
4
  module Ecco
5
5
  class RowEventListener < EventListener
6
- ROW_EVENTS = [
7
- EventType::WRITE_ROWS,
8
- EventType::UPDATE_ROWS,
9
- EventType::DELETE_ROWS,
10
- ]
11
-
12
- def table_event
13
- EventType::TABLE_MAP
14
- end
15
-
16
- def accepted_events
17
- ROW_EVENTS
6
+ def initialize(client)
7
+ super(client, events_of_interest)
18
8
  end
19
9
 
20
10
  def on_event(event)
@@ -22,13 +12,13 @@ module Ecco
22
12
  type = event.get_header.get_event_type
23
13
 
24
14
  case type
25
- when table_event
15
+ when TABLE_EVENT
26
16
  @table_map_event = event
27
17
  when *accepted_events
28
18
  row_event = Ecco::RowEvent.new
29
- row_event.type = type.to_s
30
19
  row_event.table_id = data.get_table_id
31
20
  row_event.rows = data.rows
21
+ row_event.type = event_type_to_string(type)
32
22
 
33
23
  if @table_map_event
34
24
  table_event_data = @table_map_event.get_data
@@ -40,5 +30,11 @@ module Ecco
40
30
  @callback.call(row_event)
41
31
  end
42
32
  end
33
+
34
+ private
35
+
36
+ def events_of_interest
37
+ [WRITE_EVENTS, UPDATE_EVENTS, DELETE_EVENTS]
38
+ end
43
39
  end
44
40
  end
@@ -2,28 +2,26 @@ require "ecco/event_listener"
2
2
 
3
3
  module Ecco
4
4
  class SaveEventListener < EventListener
5
- SAVE_EVENTS = [
6
- EventType::QUERY,
7
- EventType::ROTATE,
8
- EventType::WRITE_ROWS,
9
- EventType::UPDATE_ROWS,
10
- EventType::DELETE_ROWS,
11
- ]
12
-
13
- def accepted_events
14
- SAVE_EVENTS
5
+ def initialize(client)
6
+ super(client, events_of_interest)
15
7
  end
16
8
 
17
9
  def on_event(event)
18
10
  type = event.get_header.get_event_type
19
-
20
11
  case type
21
12
  when *accepted_events
22
- filename = @client.get_binlog_filename
23
- position = @client.get_binlog_position
13
+ filename = @client.get_binlog_filename
14
+ position = @client.get_binlog_position
15
+ event_type_name = event_type_to_string(type)
24
16
 
25
- @callback.call(filename, position)
17
+ @callback.call(filename, position, event_type_name)
26
18
  end
27
19
  end
20
+
21
+ private
22
+
23
+ def events_of_interest
24
+ [WRITE_EVENTS, UPDATE_EVENTS, DELETE_EVENTS, QUERY_EVENTS, ROTATE_EVENTS]
25
+ end
28
26
  end
29
27
  end
data/lib/ecco/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Ecco
2
- VERSION = "0.5.0"
3
- MYSQL_BINLOG_CONNECTOR_VERSION = "0.2.4"
2
+ VERSION = "1.0.0"
3
+ MYSQL_BINLOG_CONNECTOR_VERSION = "0.25.1"
4
4
  end
data/pom.xml CHANGED
@@ -12,9 +12,9 @@
12
12
 
13
13
  <dependencies>
14
14
  <dependency>
15
- <groupId>com.github.shyiko</groupId>
15
+ <groupId>com.zendesk</groupId>
16
16
  <artifactId>mysql-binlog-connector-java</artifactId>
17
- <version>0.2.4</version>
17
+ <version>0.25.1</version>
18
18
  </dependency>
19
19
  </dependencies>
20
20
  </project>
metadata CHANGED
@@ -1,35 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: java
6
6
  authors:
7
7
  - Twingly AB
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-26 00:00:00.000000000 Z
11
+ date: 2021-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
16
+ - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '1.10'
18
+ version: 2.1.0
19
19
  name: bundler
20
20
  prerelease: false
21
21
  type: :development
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.10'
26
+ version: 2.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '10.0'
32
+ version: '12'
33
33
  name: rake
34
34
  prerelease: false
35
35
  type: :development
@@ -37,7 +37,7 @@ dependencies:
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '12'
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
@@ -87,17 +87,22 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".github/workflows/ci.yml"
90
91
  - ".gitignore"
91
92
  - ".rspec"
92
93
  - ".ruby-version"
93
- - ".travis.yml"
94
+ - CHANGELOG.md
94
95
  - Gemfile
95
96
  - README.md
96
97
  - Rakefile
97
- - Vagrantfile
98
98
  - bin/all_specs
99
99
  - bin/console
100
100
  - bin/specs
101
+ - docker-compose-mysql-5-7.yml
102
+ - docker-compose-mysql-8-0.yml
103
+ - docker-compose-mysql-base.yml
104
+ - docker/ecco-java.security
105
+ - docker/ecco-my.cnf
101
106
  - ecco.gemspec
102
107
  - lib/ecco.rb
103
108
  - lib/ecco/client.rb
@@ -108,10 +113,8 @@ files:
108
113
  - lib/ecco/row_event_listener.rb
109
114
  - lib/ecco/save_event_listener.rb
110
115
  - lib/ecco/version.rb
111
- - lib/ext/mysql-binlog-connector-java-0.2.4.jar
116
+ - lib/ext/mysql-binlog-connector-java-0.25.1.jar
112
117
  - pom.xml
113
- - vagrant/files/ecco-my.cnf
114
- - vagrant/playbook.yml
115
118
  homepage: https://github.com/twingly/ecco
116
119
  licenses:
117
120
  - Apache-2.0
@@ -131,8 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
134
  - !ruby/object:Gem::Version
132
135
  version: '0'
133
136
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.4.8
137
+ rubygems_version: 3.1.6
136
138
  signing_key:
137
139
  specification_version: 4
138
140
  summary: MySQL replication binlog parser.
data/.travis.yml DELETED
@@ -1,34 +0,0 @@
1
- sudo: true
2
-
3
- language: ruby
4
-
5
- services:
6
- - mysql
7
-
8
- before_install:
9
- - rvm get head
10
- - rvm use jruby-9.0.3.0 --install
11
- - printf "[mysqld]\nlog-bin=mysql-bin\nserver-id=1\nbinlog-format=ROW\n" | sudo tee /etc/mysql/conf.d/binlog.cnf
12
- - sudo service mysql restart
13
- - mysql -u root -e 'create database ecco_test;'
14
- - gem install bundler -v 1.10.6
15
-
16
- env:
17
- global:
18
- - DATABASE_USER=root
19
- - DATABASE_PASS=""
20
- - DATABASE_URL=jdbc:mysql://localhost:3306/ecco_test
21
-
22
- script: bin/all_specs
23
-
24
- notifications:
25
- email: false
26
- hipchat:
27
- on_success: never
28
- on_failure: change
29
- template:
30
- - '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}
31
- (<a href="%{build_url}">Details</a>/<a href="%{compare_url}">Change view</a>)'
32
- format: html
33
- rooms:
34
- secure: J7yYVGr6NQ0rOA6WdOVxiB4XxPJJDcQG7R0fgAXxtAzQNun+QHLBH9Yu7NN7kaJrVU69oIMrAw2e7EGSh9mnQ3fmGyA/z9Xu5+3GYjGuN3QDLGA8kbnDggIeo8vZrTZYL9aITVHMUH/6oKwAtg4Q5Tx4ftguj4zvMMWiZTFHuv05V0FgyoQkSggKLE3w8ZndEjZfaBbtgUeN/eGeAl2oeP8w53eM4ebh2+VNYNVGr+5zr1VGkkXz1SoRT3YEJtSjH0DvinZDrsU3VZZY9hIcUKu3dzhPuwZFMIDGshDxVqf/0XADOFUqgYFeHmg64O+ikIye4MiuBKw/miqSvx6lZSdjlsYyHruYFCbjcZue/WIKAw5nWZNQ+YZmzxMWZV4czImO8q2ljMOXUluVgW78mZMYsqzsoE5tX6PVO4I7aVL4L9mnb01nPDAPgJAXCGfudOkHfUi6jaVTkvLqSJvifbCzhsRvaPCA2VAQGUTssv9pm2YkCP5rOOeasU+XgJtLJif8Uv1g/zNjNajNU19A1PLCSNgdvX381Dgd3NS/DjMtNtgTXxGjSpHwQM54aL/lp6a2XhCpSpBZBcBz01KQJGsgLUgDDQJSzO1e8OdiP6YQHIGEA0OM4Wfoq2I3TLWMSlGSzJBvUBHJwstPMjTbH+1HM2AOY80orVHQWzttZlc=
data/Vagrantfile DELETED
@@ -1,11 +0,0 @@
1
- Vagrant.configure("2") do |config|
2
- config.vm.define "ecco-test" do |ubuntu|
3
- ubuntu.vm.hostname = "ecco-test"
4
- ubuntu.vm.box = "ubuntu/trusty64"
5
- ubuntu.vm.provision :ansible do |ansible|
6
- ansible.playbook = "vagrant/playbook.yml"
7
- end
8
-
9
- ubuntu.vm.network :forwarded_port, host: 3306, guest: 3306
10
- end
11
- end
data/vagrant/playbook.yml DELETED
@@ -1,27 +0,0 @@
1
- ---
2
- - hosts: all
3
- sudo: yes
4
- tasks:
5
-
6
- - name: Update package cache
7
- apt: update_cache=yes
8
-
9
- - name: Install ansible dependencies
10
- apt: name={{ item }}
11
- with_items:
12
- - python-mysqldb
13
-
14
- - name: Install mysql server
15
- apt: name=mysql-server state=present
16
-
17
- - name: Copy mysql config file
18
- copy: src=files/ecco-my.cnf dest=/etc/mysql/conf.d/
19
-
20
- - name: Allow mysql root connection from remote hosts
21
- mysql_user: name=root password="" host=% priv=*.*:ALL state=present
22
-
23
- - name: Restart mysql
24
- service: name=mysql state=restarted
25
-
26
- - name: Create database
27
- mysql_db: name=ecco_test