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 +4 -4
- data/VERSION +1 -1
- data/flydata.gemspec +0 -0
- data/lib/flydata/command/sync.rb +4 -1
- data/lib/flydata/fluent-plugins/in_mysql_binlog_flydata.rb +1 -1
- data/lib/flydata/fluent-plugins/mysql/drop_database_query_handler.rb +4 -1
- data/spec/flydata/fluent-plugins/mysql/drop_database_query_handler_spec.rb +25 -33
- data/spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb +3 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 516813af4ea0557232dfd85e16c84b3666fa6576
|
4
|
+
data.tar.gz: 8fa4a979e70fde765532a000952f1deab76a0973
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3eac9c57d1adced1b2657d12797fd076744f8659f032017c6826f92b6f6b1f7b7a6a40bdc476a9fd369402da50eeb92bc9c6022a712b9a6fa70c00648c55a1d
|
7
|
+
data.tar.gz: 25f4a8c298d41f3efdbf9f9560c2d215699af1ebfad086fd8d52ae51a00004a8893bdc288ef0ac7331f7d96030a542e1ec18cf941991907ca8ec8e1daee082b2
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.21
|
data/flydata.gemspec
CHANGED
Binary file
|
data/lib/flydata/command/sync.rb
CHANGED
@@ -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.
|
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
|
-
|
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
|
-
|
10
|
-
|
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
|
-
|
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 "
|
18
|
-
|
19
|
-
{
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
29
|
-
it "
|
30
|
-
|
31
|
-
|
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
|
-
|
40
|
-
|
41
|
-
|
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
|
47
|
-
let(:
|
48
|
-
include_examples "
|
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(:
|
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(
|
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.
|
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-
|
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.
|
746
|
+
rubygems_version: 2.0.14.1
|
747
747
|
signing_key:
|
748
748
|
specification_version: 4
|
749
749
|
summary: FlyData Agent
|