flydata 0.3.7 → 0.3.8

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
  SHA1:
3
- metadata.gz: df77223c799282a371eb699e729724caa3d5430a
4
- data.tar.gz: 4ef3a2a774c4af5562def918f9a47d544e7cac87
3
+ metadata.gz: 652af727f40585a7cb70d5b1f71fcdd9beda4a7e
4
+ data.tar.gz: f8e94b1dd631c553c787175910695065bcedee65
5
5
  SHA512:
6
- metadata.gz: 6b0dc6d7a68cdf9e3f66d242d87ebad2174ae19815b6e1c460fd26cf89722ce50cc8db478fc2816de096168e185745b98050d4c59b8e41a4fddf3e7ad9a6cccf
7
- data.tar.gz: 410125ce7864d924fc38774324819542184f75f60a5abf1713873e889488156967a54e70eb888a7a0f19b4fe5f26e858ff4368c257074314f455f8ad8efc74a1
6
+ metadata.gz: 2e815f1b604d0ba454e82bbaae84ac13b6173507bc4066a138af3221fdaa3327aed5f636e9ebfc2c061b38eda6e0410e3ea6b57dcfcdca592b07f0cc64a6fc01
7
+ data.tar.gz: bdb92aee00edac39d02d4a374ca4dbf555c4b80672bcaade05801db0a0d3612715b0d19036c65162f8911401d9c7d31a5c9cc7c30730855cf0778eb53e808816
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.7
1
+ 0.3.8
data/flydata.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: flydata 0.3.7 ruby lib
5
+ # stub: flydata 0.3.8 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "flydata"
9
- s.version = "0.3.7"
9
+ s.version = "0.3.8"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Koichi Fujikawa", "Masashi Miyazaki", "Matthew Luu", "Mak Inada", "Sriram NS"]
14
- s.date = "2015-03-05"
14
+ s.date = "2015-03-09"
15
15
  s.description = "FlyData Agent"
16
16
  s.email = "sysadmin@flydata.com"
17
17
  s.executables = ["fdmysqldump", "flydata", "serverinfo"]
@@ -81,7 +81,6 @@ class MysqlBinlogFlydataInput < MysqlBinlogInput
81
81
 
82
82
  table_meta = Mysql::TableMeta.new(
83
83
  mysql_url: mysql_url, database: @database, tables: @tables)
84
- table_meta.update
85
84
 
86
85
  table_revs = tables.inject({}) do |h, table_name|
87
86
  h[table_name] = @sync_fm.table_rev(table_name)
@@ -129,6 +128,7 @@ EOS
129
128
  end
130
129
 
131
130
  def run
131
+ @context.table_meta.update
132
132
  start_kodama(mysql_url) do |c|
133
133
  c.binlog_position_file = @position_file
134
134
  c.connection_retry_limit = @retry_limit
@@ -139,9 +139,12 @@ EOS
139
139
  c.send("on_#{event_type}", &method(:event_listener))
140
140
  end
141
141
  end
142
- rescue
143
- $log.error "unexpected error. exception: #{$!.class.to_s}, error: #{$!.to_s}\n#{$!.backtrace.join("\n")}"
144
- raise
142
+ rescue => e
143
+ # HACK: mysql-replication-listener has a network connection leak bug which doesn't release a connection
144
+ # to MySQL. Rather than fixing the bug, restarting the fluentd process for now.
145
+ $log.warn "kodama died with an error. Restart the process after #{@retry_wait} seconds. error: #{e.class.to_s} '#{e.to_s}'"
146
+ sleep @retry_wait
147
+ Process.kill(:HUP, Process.ppid) # Send SIGHUP to the supervisor to restart fluentd
145
148
  rescue SignalException
146
149
  $log.debug "signal exception. exception: #{$!.class.to_s}, error: #{$!.to_s}"
147
150
  raise
@@ -218,9 +218,9 @@ grammar MysqlAlterTable
218
218
  { action: :convert_charset }
219
219
  end
220
220
  }
221
- / create_table_options_space_separated {
221
+ / ( create_table_options_space_separated ) 1..1 {
222
222
  def action
223
- { action: :default_charset }
223
+ elements[0].action
224
224
  end
225
225
  }
226
226
  / force_sym {
@@ -990,8 +990,13 @@ grammar MysqlAlterTable
990
990
  'tablespace'i ![A-Za-z0-9_]
991
991
  end
992
992
 
993
+ rule engine_sym
994
+ 'engine'i ![A-Za-z0-9_]
995
+ end
996
+
993
997
  rule ident_or_text
994
998
  ident
999
+ / value # This matches TEXT_STRING_sys
995
1000
  # TEXT_STRING # TODO - To be implemented when required
996
1001
  # LEX_HOSTNAME # TODO
997
1002
  end
@@ -1025,13 +1030,38 @@ grammar MysqlAlterTable
1025
1030
  end
1026
1031
 
1027
1032
  rule create_table_options_space_separated
1028
- create_table_option sp create_table_options_space_separated
1029
- / create_table_option
1033
+ create_table_option sp create_table_options_space_separated {
1034
+ def action
1035
+ ret = [create_table_option.action]
1036
+ other_actions = create_table_options_space_separated.action
1037
+ ret + (other_actions.kind_of?(Array) ? other_actions : [other_actions])
1038
+ end
1039
+ }
1040
+ / ( create_table_option ) 1..1 {
1041
+ def action
1042
+ elements[0].action
1043
+ end
1044
+ }
1030
1045
  end
1031
1046
 
1032
1047
  rule create_table_option
1033
- default_charset
1034
- / default_collation
1048
+ default_charset {
1049
+ def action
1050
+ { action: :default_charset }
1051
+ end
1052
+ }
1053
+ / default_collation {
1054
+ def action
1055
+ { action: :default_collate }
1056
+ end
1057
+ }
1058
+ / engine_sym opt_equal nsp storage_engines {
1059
+ def action
1060
+ { action: :storage_engine,
1061
+ support_level: :nonbreaking
1062
+ }
1063
+ end
1064
+ }
1035
1065
  #TODO - There are other rules which need to be implemented when required
1036
1066
  end
1037
1067
 
@@ -1047,6 +1077,10 @@ grammar MysqlAlterTable
1047
1077
  opt_default nsp collate_sym opt_equal nsp collation_name_or_default
1048
1078
  end
1049
1079
 
1080
+ rule storage_engines
1081
+ ident_or_text
1082
+ end
1083
+
1050
1084
  ######## keys
1051
1085
 
1052
1086
  rule alter_key 'alter'i end
@@ -553,7 +553,7 @@ describe 'MysqlAlterTableParser' do
553
553
  type: :alter_table,
554
554
  schema_name: "test_schema",
555
555
  table_name: "test_table",
556
- actions: [action_hash]
556
+ actions: action_hash
557
557
  })
558
558
  end
559
559
  end
@@ -564,20 +564,13 @@ describe 'MysqlAlterTableParser' do
564
564
  end
565
565
  shared_examples "a parser parsing a nonbreaking query" do
566
566
  let(:action_hash) {
567
- {
568
- action: action,
569
- support_level: :nonbreaking,
570
- query: alter_table_action,
571
- }
567
+ Array(action).inject([]) { |ret,a| ret << { action: a, support_level: :nonbreaking, query: alter_table_action } }
572
568
  }
573
569
  it_behaves_like "a parser parsing a single action alter table query"
574
570
  end
575
571
  shared_examples "a parser parsing a breaking query" do
576
572
  let(:action_hash) {
577
- {
578
- action: action,
579
- query: alter_table_action,
580
- }
573
+ Array(action).inject([]) { |ret,a| ret << { action: a, query: alter_table_action } }
581
574
  }
582
575
  it_behaves_like "a parser parsing a single action alter table query"
583
576
  end
@@ -1076,6 +1069,15 @@ describe 'MysqlAlterTableParser' do
1076
1069
  end
1077
1070
  end
1078
1071
  end
1072
+ shared_examples "test storage engines" do |*examples|
1073
+ ["innodb", "MyISAM", "MEMORY", '"InnoDB"', "'myisam'"].each do |storage_engine|
1074
+ context "storage engine is #{storage_engine}" do
1075
+ it_behaves_like *examples do
1076
+ let(:storage_engine) {storage_engine}
1077
+ end
1078
+ end
1079
+ end
1080
+ end
1079
1081
  context 'add index' do
1080
1082
  let(:action) { :add_index }
1081
1083
  context "with a simple add index" do
@@ -1231,11 +1233,11 @@ describe 'MysqlAlterTableParser' do
1231
1233
  let(:alter_table_action) { "ADD#{constraint_keyword} PRIMARY KEY#{key_name}#{using_option} (#{key_list})#{normal_key_options}" }
1232
1234
  let(:action) { :add_primary_key_constraint }
1233
1235
  let(:action_hash) {
1234
- {
1236
+ [{
1235
1237
  action: action,
1236
1238
  keys: expected_key_list,
1237
1239
  query: alter_table_action,
1238
- }
1240
+ }]
1239
1241
  }
1240
1242
 
1241
1243
  it_behaves_like "test constraint keyword",
@@ -1336,23 +1338,32 @@ describe 'MysqlAlterTableParser' do
1336
1338
  it_behaves_like "test charset", "test charsetname", "a parser parsing a breaking query"
1337
1339
  end
1338
1340
  end
1339
- context "default charset" do
1340
- let(:action) { :default_charset }
1341
- context "with collate" do
1342
- let(:alter_table_action) { "#{default}#{charset}=#{charsetname} #{collate}" }
1343
- it_behaves_like "test optional default", "test charset", "test charsetname", "test collate", "a parser parsing a breaking query"
1344
- it_behaves_like "test optional default", "test charset", "test charsetname", "test collate with equals", "a parser parsing a breaking query"
1345
- end
1346
- context "without collate" do
1347
- let(:alter_table_action) { "#{default}#{charset} #{charsetname}" }
1348
- it_behaves_like "test optional default", "test charset", "test charsetname", "a parser parsing a breaking query"
1341
+ context "table options" do
1342
+ context "default charset" do
1343
+ context "with collate" do
1344
+ let(:action) { [:default_charset, :default_collate] }
1345
+ let(:alter_table_action) { "#{default}#{charset}=#{charsetname} #{collate}" }
1346
+ it_behaves_like "test optional default", "test charset", "test charsetname", "test collate", "a parser parsing a breaking query"
1347
+ it_behaves_like "test optional default", "test charset", "test charsetname", "test collate with equals", "a parser parsing a breaking query"
1348
+ end
1349
+ context "without collate" do
1350
+ let(:action) { :default_charset }
1351
+ let(:alter_table_action) { "#{default}#{charset} #{charsetname}" }
1352
+ it_behaves_like "test optional default", "test charset", "test charsetname", "a parser parsing a breaking query"
1353
+ end
1354
+ context "without charset" do
1355
+ #The doc at http://dev.mysql.com/doc/refman/5.6/en/alter-table.html does not indicate that
1356
+ #charset is optional. But this works (tested on mysql 5.5.38)
1357
+ let(:alter_table_action) { "#{default}#{collate}" }
1358
+ let(:action) { :default_collate }
1359
+ it_behaves_like "test optional default","test collate", "a parser parsing a breaking query"
1360
+ it_behaves_like "test optional default","test collate with equals", "a parser parsing a breaking query"
1361
+ end
1349
1362
  end
1350
- context "without charset" do
1351
- #The doc at http://dev.mysql.com/doc/refman/5.6/en/alter-table.html does not indicate that
1352
- #charset is optional. But this works (tested on mysql 5.5.38)
1353
- let(:alter_table_action) { "#{default}#{collate}" }
1354
- it_behaves_like "test optional default","test collate", "a parser parsing a breaking query"
1355
- it_behaves_like "test optional default","test collate with equals", "a parser parsing a breaking query"
1363
+ context "storage engine" do
1364
+ let(:action) { :storage_engine }
1365
+ let(:alter_table_action) { "engine#{equal} #{storage_engine}"}
1366
+ it_behaves_like "test optional equal", "test storage engines", "a parser parsing a nonbreaking query"
1356
1367
  end
1357
1368
  end
1358
1369
  context "force" do
@@ -1698,10 +1709,10 @@ describe 'MysqlAlterTableParser' do
1698
1709
  end
1699
1710
  shared_examples "test parser parsing a change column" do
1700
1711
  let(:action_hash) {
1701
- change_action_hash.merge!({
1712
+ [change_action_hash.merge!({
1702
1713
  action: :change_column,
1703
1714
  query: alter_table_action
1704
- })
1715
+ })]
1705
1716
  }
1706
1717
  it_behaves_like "a parser parsing a single action alter table query"
1707
1718
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flydata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Fujikawa
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-03-05 00:00:00.000000000 Z
15
+ date: 2015-03-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rest-client