mysql_binlog 0.3.6 → 0.3.7

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: 964c4ea70ef1f90974e39ebe4886a8a1b3496a03
4
- data.tar.gz: 489ef416fdd77d92e6c030058761cbf4f063f5fa
2
+ SHA256:
3
+ metadata.gz: 68751dcb93a315960a1ea2ec299a9f26eef45678d58828ccd423c4140bbb6636
4
+ data.tar.gz: 2ccb823feaf7f0bc50912ecfb9e08c4f8bb44a14dd4e72c88acb60485ad2a2f6
5
5
  SHA512:
6
- metadata.gz: cff1a9268787b0d5f4b74a221545fca87937159a03a6ce3face47871f20fa679036c041cc0b3b3a61c41643a2a056fa1c89acbf81c2622ef4ae11f9e5fb384ce
7
- data.tar.gz: eb2838fd4a04e4a5a1307e8144c01bb8bb77ae814e7a48d3b8cc69cc93d9b72aab41382429b2aa3654b4ce14db6561d1b541ad063ca9b8a8304fd939248fdc05
6
+ metadata.gz: 50d4c8cb1385c63e6a74ab825f71691cbefbbe66c73786462d690750bd64c8d919c63aa5d3c564c8b8d46d10741a82abe754f482e77416b3ff5c7e1f368abd41
7
+ data.tar.gz: 381f7c4302b0a8d0964e4fcd1b3bcf034ca4401bd6fc68e78768ae7a53931a70b36d7ff2486f72464fd6d5598c0b2723ee375ff762b76efb8647776855cb1c4c
@@ -129,6 +129,7 @@ events_processed = 0
129
129
 
130
130
  events << {
131
131
  timestamp: timestamp,
132
+ size: event[:header][:payload_length],
132
133
  type: event[:type],
133
134
  verb: verb,
134
135
  table: table,
@@ -182,6 +183,8 @@ puts
182
183
 
183
184
  events_by_type = Hash.new(0)
184
185
  events_by_verb_and_table = {}
186
+ size_by_verb_and_table = {}
187
+ size_by_table = Hash.new(0)
185
188
  net_change_by_verb_and_table = {}
186
189
  net_change_by_table = Hash.new(0)
187
190
  events.each do |event|
@@ -189,6 +192,9 @@ events.each do |event|
189
192
  if event[:verb]
190
193
  events_by_verb_and_table[event[:verb]] ||= Hash.new(0)
191
194
  events_by_verb_and_table[event[:verb]][event[:table]] += 1
195
+ size_by_verb_and_table[event[:verb]] ||= Hash.new(0)
196
+ size_by_verb_and_table[event[:verb]][event[:table]] += event[:size]
197
+ size_by_table[event[:table]] += event[:size]
192
198
  net_change_by_verb_and_table[event[:verb]] ||= Hash.new(0)
193
199
  net_change_by_verb_and_table[event[:verb]][event[:table]] += event[:net_change]
194
200
  net_change_by_table[event[:table]] += event[:net_change]
@@ -204,15 +210,27 @@ puts
204
210
  puts "Events by verb and table:"
205
211
  events_by_verb_and_table.sort.each do |verb, table_and_count|
206
212
  puts "%s\n" % [verb]
213
+ puts " %-50s%10s%14s%14s%14s" % [
214
+ "", "Count", "Rate/s", "Net (KiB/s)", "Size (KiB/s)"
215
+ ]
207
216
  table_and_count.sort { |a, b| b[1] <=> a[1] }.each do |table, count|
208
- puts " %-50s%10d%10.2f/s%+10.2f KiB/s" % [
209
- table, count, count.to_f / duration.to_f,
217
+ puts " %-50s%10d%14s%+14.2f%14.2f" % [
218
+ table, count, "%10.2f/s" % [count.to_f / duration.to_f],
210
219
  net_change_by_verb_and_table[verb][table] / 1024.0 / duration.to_f,
220
+ size_by_verb_and_table[verb][table] / 1024.0 / duration.to_f,
211
221
  ]
212
222
  end
213
223
  puts
214
224
  end
215
225
 
226
+ puts "Event payload by table (top 10):"
227
+ size_by_table.sort { |a, b| b[1].abs <=> a[1].abs }.first(10).each do |table, size|
228
+ puts " %-50s%+10.2f KiB/s" % [
229
+ table, size.to_f / 1024.0 / duration.to_f
230
+ ]
231
+ end
232
+ puts
233
+
216
234
  puts "Net change by table (top 10):"
217
235
  net_change_by_table.sort { |a, b| b[1].abs <=> a[1].abs }.first(10).each do |table, net_change|
218
236
  puts " %-50s%+10.2f KiB/s" % [
@@ -220,3 +238,4 @@ net_change_by_table.sort { |a, b| b[1].abs <=> a[1].abs }.first(10).each do |tab
220
238
  ]
221
239
  end
222
240
  puts
241
+
@@ -307,6 +307,8 @@ module MysqlBinlog
307
307
  _query_event_status_updated_db_names
308
308
  when :commit_ts
309
309
  parser.read_uint64
310
+ when :microseconds
311
+ parser.read_uint24
310
312
  else
311
313
  raise "Unknown status type #{status_type_id}"
312
314
  end
@@ -1,3 +1,3 @@
1
1
  module MysqlBinlog
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_binlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Cole
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-10 00:00:00.000000000 Z
11
+ date: 2021-04-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Library for parsing MySQL binary logs in Ruby
14
14
  email: jeremy@jcole.us
@@ -48,8 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  requirements: []
51
- rubyforge_project:
52
- rubygems_version: 2.5.2.3
51
+ rubygems_version: 3.1.4
53
52
  signing_key:
54
53
  specification_version: 4
55
54
  summary: MySQL Binary Log Parser