flydata 0.5.20 → 0.5.21

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: 2731322ee5aa072665e488692665d0ba9732f720
4
- data.tar.gz: 681f290e03fdaeccf47ecb80d17d1a039d528458
3
+ metadata.gz: 516813af4ea0557232dfd85e16c84b3666fa6576
4
+ data.tar.gz: 8fa4a979e70fde765532a000952f1deab76a0973
5
5
  SHA512:
6
- metadata.gz: c443a473619d395c61bb6e08b6ce5de4b0c874efecafe0a24bff411c28287aa4a6e0b5d33537a316be7428a7f9700f9f519d781cfcf16d2c808fc93e6832fa96
7
- data.tar.gz: 860cd66add7614fdbc5f68bba8be6a41adcfbaf704a02caa4bb22c3aca85f6b82261147ab52eaa3e2edea379ae02b7c04b13df812ffcbcab716bf720f5478ceb
6
+ metadata.gz: b3eac9c57d1adced1b2657d12797fd076744f8659f032017c6826f92b6f6b1f7b7a6a40bdc476a9fd369402da50eeb92bc9c6022a712b9a6fa70c00648c55a1d
7
+ data.tar.gz: 25f4a8c298d41f3efdbf9f9560c2d215699af1ebfad086fd8d52ae51a00004a8893bdc288ef0ac7331f7d96030a542e1ec18cf941991907ca8ec8e1daee082b2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.20
1
+ 0.5.21
data/flydata.gemspec CHANGED
Binary file
@@ -560,7 +560,6 @@ EOS
560
560
 
561
561
  # Don't call the method unless init sync needs to be run for a table
562
562
  def sync_mysql_to_redshift(de, options = {})
563
- FlydataCore::Event::ApiEventSender.instance.send_event("init_sync", "started", {"tables"=>target_tables}, de['id'])
564
563
  dp = flydata.data_port.get
565
564
  sync_fm = create_sync_file_manager(de)
566
565
 
@@ -655,6 +654,10 @@ EOM
655
654
  log_info_stdout("Setting binary log position and exporting data from the database.")
656
655
  log_info_stdout("This process can take hours depending on data size and load on your database. Please be patient...")
657
656
  sync_fm.save_sync_info(@full_initial_sync, target_tables)
657
+ # This notification will be uncommented after init_sync_finish email integration is released
658
+ #unless options[:sync_resumed]
659
+ # FlydataCore::Event::ApiEventSender.instance.send_event("init_sync", "started", {"tables" => target_tables}, de['id'])
660
+ #end
658
661
  dump_generator = Flydata::Parser::Mysql::MysqlDumpGeneratorNoMasterData.new(de['mysql_data_entry_preference'].merge('tables' => target_tables))
659
662
  if file_dump
660
663
  binlog_pos = nil
@@ -156,7 +156,7 @@ class MysqlBinlogFlydataInput < MysqlBinlogInput
156
156
  when :event_arrived_finally
157
157
  $log.info "Binary log event has come at #{timestamp}"
158
158
  when :event_idle_timeout
159
- $log.error "No binary log event since #{timestamp}. Restart the process."
159
+ $log.warn "No binary log event since #{timestamp}. Restarting the process."
160
160
  Process.kill(:HUP, Process.ppid)
161
161
  end
162
162
  end
@@ -14,7 +14,10 @@ module Mysql
14
14
  end
15
15
 
16
16
  def process(record)
17
- $log.warn("DROP DATABASE detected. A full re-sync is required to provide sync consistency")
17
+ #Issuing warning message only for the current database.
18
+ if record["db_name"] == @context.database
19
+ $log.warn("DROP DATABASE detected. A full re-sync is required to provide sync consistency. db_name: #{record["db_name"]}")
20
+ end
18
21
  #NOTE: No emit_record here because this record should not be sent to data servers for now
19
22
  end
20
23
  end
@@ -4,52 +4,44 @@ require 'flydata/fluent-plugins/mysql/shared_query_handler_context'
4
4
 
5
5
  module Mysql
6
6
  describe DropDatabaseQueryHandler do
7
+ let(:subject_object) { described_class.new(context) }
7
8
  include_context "query handler context"
8
9
 
9
- describe '#process' do
10
- let(:drop_database_query) { "DROP database foo" }
10
+ let(:drop_keyword) { "DATABASE" }
11
+ let(:drop_database_query) { "DROP #{drop_keyword} #{database}" }
11
12
 
13
+ describe '#process' do
14
+ subject { subject_object.process(record) }
12
15
  before do
13
- allow(record).to receive(:[]).with("query").and_return(drop_database_query)
14
- allow(record).to receive(:[]).with("normalized_query").and_return(drop_database_query)
16
+ expect(Fluent::Engine).to receive(:emit).never
15
17
  end
16
18
 
17
- shared_examples "process drop database queries correctly" do
18
- let(:expected_record) do
19
- {
20
- query: drop_database_query,
21
- type: :drop_database,
22
- respect_order: true,
23
- src_pos: "#{current_binlog_file}\t#{next_position - event_length}",
24
- v: flydata_record_version
25
- }
19
+ shared_examples "test different dbs" do
20
+ context "for the target db" do
21
+ let(:database) { target_database }
22
+
23
+ it "shows a warning message" do
24
+ expect($log).to receive(:warn).with("DROP DATABASE detected. A full re-sync is required to provide sync consistency. db_name: #{record["db_name"]}").once
25
+ subject
26
+ end
26
27
  end
27
-
28
- context "for the registered database" do
29
- it "should call Fluent's emit with appropriate params" do
30
- # Should mock up the method to return true
31
- #expect(Fluent::Engine).to receive(:emit).with(tag, timestamp, expected_record)
32
- expect(Fluent::Engine).to receive(:emit).never
33
- expect($log).to receive(:warn)
34
- expect(subject.process(record))
28
+ context "for another db" do
29
+ let(:database) { "another_db" }
30
+ it "does not show a warning message" do
31
+ expect($log).not_to receive(:warn)
32
+ subject
35
33
  end
36
34
  end
37
35
  end
38
36
 
39
- shared_examples "skip processing queries" do
40
- it "should not call Fluent's emit" do
41
- expect(Fluent::Engine).to receive(:emit).never
42
- subject.process(record)
43
- end
37
+ context "with drop database query" do
38
+ let(:drop_keyword) { "DATABASE" }
39
+ include_examples "test different dbs"
44
40
  end
45
41
 
46
- context "drop database queries with database keyword" do
47
- let(:drop_database_query) { "DROP DATABASE foo" }
48
- include_examples "process drop database queries correctly"
49
- end
50
- context "drop database queries with schema keyword" do
51
- let(:drop_database_query) { "DROP SCHEMA foo" }
52
- include_examples "process drop database queries correctly"
42
+ context "with drop schema query" do
43
+ let(:drop_keyword) { "SCHEMA" }
44
+ include_examples "test different dbs"
53
45
  end
54
46
  end
55
47
  end
@@ -1,6 +1,7 @@
1
1
  module Mysql
2
2
  shared_context "query handler context" do
3
- let(:database) { "testdb" }
3
+ let(:target_database) { "testdb" }
4
+ let(:database) { target_database }
4
5
  let(:table) { "foo" }
5
6
  let(:seq) { 200 }
6
7
  let(:sync_fm) do
@@ -18,7 +19,7 @@ module Mysql
18
19
  let(:context) do
19
20
  r = double('context')
20
21
  allow(r).to receive(:sync_fm).and_return(sync_fm)
21
- allow(r).to receive(:database).and_return(database)
22
+ allow(r).to receive(:database).and_return(target_database)
22
23
  allow(r).to receive(:tables).and_return([table])
23
24
  allow(r).to receive(:table_meta).and_return(table_meta)
24
25
  allow(r).to receive(:current_binlog_file).and_return(current_binlog_file)
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.5.20
4
+ version: 0.5.21
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-11-20 00:00:00.000000000 Z
15
+ date: 2015-11-25 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rest-client
@@ -743,7 +743,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
743
743
  version: '0'
744
744
  requirements: []
745
745
  rubyforge_project:
746
- rubygems_version: 2.4.3
746
+ rubygems_version: 2.0.14.1
747
747
  signing_key:
748
748
  specification_version: 4
749
749
  summary: FlyData Agent