flydata 0.7.7 → 0.7.8
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-core/lib/flydata-core/table_def/base.rb +1 -1
- data/flydata-core/lib/flydata-core/table_def/mysql_table_def.rb +40 -1
- data/flydata-core/lib/flydata-core/table_def/redshift_table_def.rb +3 -3
- data/flydata-core/spec/table_def/mysql_table_def_spec.rb +43 -3
- data/flydata-core/spec/table_def/mysql_to_redshift_table_def_spec.rb +106 -0
- data/flydata-core/spec/table_def/mysqldump_test_blackhole_engine.dump +41 -0
- data/flydata-core/spec/table_def/mysqldump_test_memory_engine.dump +41 -0
- data/flydata-core/spec/table_def/mysqldump_test_null_uk.dump +56 -0
- data/flydata-core/spec/table_def/mysqldump_test_table_only_uk.dump +52 -0
- data/flydata-core/spec/table_def/mysqldump_test_view1.dump +57 -0
- data/flydata-core/spec/table_def/mysqldump_test_view_and_table.dump +80 -0
- data/flydata.gemspec +0 -0
- data/lib/flydata/source/sync_generate_table_ddl.rb +1 -1
- data/lib/flydata/source_mysql/mysql_compatibility_check.rb +0 -7
- data/spec/flydata/command/sync_spec.rb +2 -2
- data/spec/flydata/fluent-plugins/in_mysql_binlog_flydata_spec.rb +2 -2
- data/spec/flydata/fluent-plugins/in_postgresql_query_based_flydata_spec.rb +2 -2
- data/spec/flydata/source_mysql/mysql_compatibility_check_spec.rb +1 -48
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d9438eb32d8d567ad63149916961bde54cdf52c
|
4
|
+
data.tar.gz: dd2f138fd9f823e1cbee1d2d091262a6a008f336
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af5eb23ccfa7691ff8a28c4767d256f988cb72377073b994bcaa7d45f94e38223253151e6702a10b5184ed28c37e22feac3c8e1eebd6792680341cddb24457e4
|
7
|
+
data.tar.gz: 5385e752f2531d6bea7ad8c739c1b0a485e20e1e600872319902238e4cef0b96096288192ddc9463b53afc363617e0c23a02fe0814cb33b84d01f0d8c5db891c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.8
|
@@ -135,7 +135,7 @@ class Base
|
|
135
135
|
|
136
136
|
def self.check_pk(table_name, columns, options)
|
137
137
|
unless pk_exist?(columns) || options[:skip_primary_key_check]
|
138
|
-
raise TableDefError, {error: "
|
138
|
+
raise TableDefError, {error: "No primary key defined", table: table_name}
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -94,6 +94,7 @@ class MysqlTableDef < Base
|
|
94
94
|
default_charset = nil
|
95
95
|
default_source_charset = nil
|
96
96
|
comment = nil
|
97
|
+
tabledef_error = nil
|
97
98
|
|
98
99
|
position = :before_create_table
|
99
100
|
|
@@ -106,6 +107,22 @@ class MysqlTableDef < Base
|
|
106
107
|
table_name = $1
|
107
108
|
table_def += line.chomp
|
108
109
|
next
|
110
|
+
elsif line =~ /CREATE ALGORITHM/
|
111
|
+
# /*!50001 CREATE ALGORITHM=UNDEFINED */
|
112
|
+
# /*!50013 DEFINER=`admin`@`%` SQL SECURITY DEFINER */
|
113
|
+
# /*!50001 VIEW `sample_view` AS select distinct `sample`.`name` AS `name` from `sample` */;
|
114
|
+
if line =~ /VIEW `(.*?)`/
|
115
|
+
# VIEW definition is given in the same line
|
116
|
+
table_name = $1
|
117
|
+
tabledef_error = {error: "VIEW is not supported", table: table_name}
|
118
|
+
position = :tabledef_error
|
119
|
+
next
|
120
|
+
elsif line =~ /;/
|
121
|
+
next
|
122
|
+
else
|
123
|
+
position = :in_create_algorithm
|
124
|
+
next
|
125
|
+
end
|
109
126
|
end
|
110
127
|
|
111
128
|
when :in_create_table
|
@@ -123,7 +140,11 @@ class MysqlTableDef < Base
|
|
123
140
|
parse_key(line, columns)
|
124
141
|
#) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='test table';
|
125
142
|
elsif stripped_line.start_with?(')')
|
126
|
-
if line =~ /
|
143
|
+
if line =~ /ENGINE\s*=\s*(BLACKHOLE|MEMORY)\s/
|
144
|
+
tabledef_error = {error: "#{$1} STORATE ENGINE table is not supported", table: table_name}
|
145
|
+
position = :tabledef_error
|
146
|
+
next
|
147
|
+
elsif line =~ /DEFAULT CHARSET\s*=\s*([a-z0-9]+)/
|
127
148
|
default_source_charset = $1
|
128
149
|
default_charset = flydata_charset(default_source_charset)
|
129
150
|
end
|
@@ -140,10 +161,28 @@ class MysqlTableDef < Base
|
|
140
161
|
# "Unknown table definition. Skip. (#{line})"
|
141
162
|
end
|
142
163
|
|
164
|
+
when :in_create_algorithm
|
165
|
+
#/*!50001 VIEW `sample_view` AS select distinct `sample`.`name` AS `name` from `sample` */;
|
166
|
+
if line =~ /VIEW `(.*?)`/
|
167
|
+
table_name = $1
|
168
|
+
tabledef_error = {error: "VIEW is not supported", table: table_name}
|
169
|
+
position = :tabledef_error
|
170
|
+
next
|
171
|
+
elsif line =~ /;/
|
172
|
+
position = :before_create_table
|
173
|
+
next
|
174
|
+
else
|
175
|
+
# Skip.
|
176
|
+
end
|
177
|
+
|
178
|
+
when :tabledef_error
|
179
|
+
raise TableDefError, tabledef_error
|
180
|
+
|
143
181
|
when :after_create_table
|
144
182
|
break
|
145
183
|
end
|
146
184
|
end
|
185
|
+
|
147
186
|
position == :after_create_table ? [table_def, table_name, columns, column_def, unique_keys, default_charset, default_source_charset, comment] : nil
|
148
187
|
end
|
149
188
|
|
@@ -63,7 +63,7 @@ class RedshiftTableDef
|
|
63
63
|
tabledef += drop_backup_table_sql(flydata_tabledef, schema_name, options) unless options[:ctl_only]
|
64
64
|
rescue => e
|
65
65
|
# Catch errors from generating schema. Generally an unsupported data type
|
66
|
-
raise TableDefError, {error: "
|
66
|
+
raise TableDefError, {error: "Errors generating schema. Please contact us for further instructions", table: flydata_tabledef[:table_name]}
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -197,8 +197,8 @@ EOS
|
|
197
197
|
|
198
198
|
unless options[:skip_primary_key_check]
|
199
199
|
unless pk_def
|
200
|
-
$log.error "
|
201
|
-
raise "
|
200
|
+
$log.error "No primary key defined in table: #{flydata_tabledef[:table_name]}"
|
201
|
+
raise "No primary key defined"
|
202
202
|
end
|
203
203
|
end
|
204
204
|
lines << pk_def if pk_def
|
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'flydata-core/table_def'
|
3
|
+
require 'logger'
|
4
|
+
$log = Logger.new(STDOUT)
|
3
5
|
|
4
6
|
module FlydataCore
|
5
7
|
module TableDef
|
6
8
|
|
7
|
-
|
8
9
|
describe MysqlTableDef do
|
9
10
|
|
10
11
|
# file full path which exists in same directory.
|
@@ -110,13 +111,52 @@ describe MysqlTableDef do
|
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
113
|
-
context 'when table does not have primary key' do
|
114
|
+
context 'when table does not have either primary key or unique key' do
|
114
115
|
let(:dump_file_io) { file_io('mysqldump_test_table_no_pk.dump') }
|
115
116
|
it 'should raise an error' do
|
116
117
|
expect{subject}.to raise_error(FlydataCore::TableDefError)
|
117
118
|
end
|
118
119
|
end
|
119
120
|
|
121
|
+
context 'when table does not have primary key but has unique key' do
|
122
|
+
let(:dump_file_io) { file_io('mysqldump_test_table_only_uk.dump') }
|
123
|
+
it 'should not raise an error' do
|
124
|
+
expect{subject}.not_to raise_error
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'should create pk_override from uk' do
|
128
|
+
expect(subject[:pk_override]).to eq( ['id'] )
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'when table which has a unique key using NULL column' do
|
133
|
+
let(:dump_file_io) { file_io('mysqldump_test_null_uk.dump') }
|
134
|
+
it 'should raise an error' do
|
135
|
+
expect{subject}.to raise_error(FlydataCore::TableDefError)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context 'when table is VIEW (unsupported)' do
|
140
|
+
let(:dump_file_io) { file_io('mysqldump_test_view1.dump') }
|
141
|
+
it 'should raise an error' do
|
142
|
+
expect{subject}.to raise_error(FlydataCore::TableDefError)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'when table is MEMORY ENGINE (unsupported)' do
|
147
|
+
let(:dump_file_io) { file_io('mysqldump_test_memory_engine.dump') }
|
148
|
+
it 'should raise an error' do
|
149
|
+
expect{subject}.to raise_error(FlydataCore::TableDefError)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
context 'when table is BLACKHOLE ENGINE (unsupported)' do
|
154
|
+
let(:dump_file_io) { file_io('mysqldump_test_blackhole_engine.dump') }
|
155
|
+
it 'should raise an error' do
|
156
|
+
expect{subject}.to raise_error(FlydataCore::TableDefError)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
120
160
|
context 'when column has comment' do
|
121
161
|
let(:dump_file_io) { file_io('mysqldump_test_table_column_comment.dump') }
|
122
162
|
it 'comment should be set' do
|
@@ -143,7 +183,7 @@ describe MysqlTableDef do
|
|
143
183
|
end
|
144
184
|
end
|
145
185
|
|
146
|
-
context 'when table has multiple pk' do
|
186
|
+
context 'when table has multiple-column pk' do
|
147
187
|
let(:dump_file_io) { file_io('mysqldump_test_table_multi_pk.dump') }
|
148
188
|
it 'multi pk should be set' do
|
149
189
|
expect(subject[:columns]).to eq(
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'flydata-core/table_def'
|
3
3
|
require 'timecop'
|
4
|
+
require 'logger'
|
5
|
+
$log = Logger.new(STDOUT)
|
4
6
|
|
5
7
|
module FlydataCore
|
6
8
|
module TableDef
|
@@ -748,6 +750,60 @@ EOT
|
|
748
750
|
end
|
749
751
|
end
|
750
752
|
|
753
|
+
context 'with mysqldump_test_table_only_uk.dump' do
|
754
|
+
let(:dump_file_name) { 'mysqldump_test_table_only_uk.dump' }
|
755
|
+
|
756
|
+
it 'should return ddl using unique key as primary key' do
|
757
|
+
expect(subject).to eq( <<EOT )
|
758
|
+
CREATE TABLE IF NOT EXISTS "flydata_ctl_columns"(
|
759
|
+
id integer NOT NULL IDENTITY(1,1),
|
760
|
+
table_name varchar(128) NOT NULL,
|
761
|
+
column_name varchar(128) NOT NULL,
|
762
|
+
src_data_type varchar(1024) NOT NULL,
|
763
|
+
revision int NOT NULL DEFAULT 1,
|
764
|
+
ordinal_position int NOT NULL,
|
765
|
+
PRIMARY KEY(id)
|
766
|
+
) DISTKEY(table_name) SORTKEY(table_name);
|
767
|
+
CREATE TABLE IF NOT EXISTS "flydata_ctl_tables"(
|
768
|
+
id integer NOT NULL IDENTITY(1,1),
|
769
|
+
table_name varchar(128) NOT NULL,
|
770
|
+
attribute varchar(128) NOT NULL,
|
771
|
+
value varchar(max),
|
772
|
+
created_at timestamp DEFAULT SYSDATE,
|
773
|
+
PRIMARY KEY(id)
|
774
|
+
) DISTKEY(table_name) SORTKEY(table_name);
|
775
|
+
BEGIN;
|
776
|
+
DROP TABLE IF EXISTS "only_uk_flydata20160125232857";
|
777
|
+
CREATE TABLE IF NOT EXISTS "only_uk" (
|
778
|
+
"id" numeric(20,0),
|
779
|
+
"tag" varchar(129) DEFAULT NULL,
|
780
|
+
"comment" varchar(72),
|
781
|
+
PRIMARY KEY ("id")
|
782
|
+
) DISTKEY("id") SORTKEY("id");
|
783
|
+
ALTER TABLE "only_uk" RENAME TO "only_uk_flydata20160125232857";
|
784
|
+
CREATE TABLE "only_uk" (
|
785
|
+
"id" numeric(20,0),
|
786
|
+
"tag" varchar(129) DEFAULT NULL,
|
787
|
+
"comment" varchar(72),
|
788
|
+
PRIMARY KEY ("id")
|
789
|
+
) DISTKEY("id") SORTKEY("id");
|
790
|
+
DELETE FROM "flydata_ctl_columns" WHERE table_name = 'only_uk';
|
791
|
+
INSERT INTO "flydata_ctl_columns" (table_name, column_name, src_data_type, ordinal_position) VALUES
|
792
|
+
('only_uk', 'id', 'int8(20) unsigned', 1),
|
793
|
+
('only_uk', 'tag', 'varchar(129)', 2),
|
794
|
+
('only_uk', 'comment', 'varchar(72)', 3);
|
795
|
+
DELETE FROM "flydata_ctl_tables" WHERE table_name = 'only_uk';
|
796
|
+
INSERT INTO "flydata_ctl_tables" (table_name, attribute, value) VALUES
|
797
|
+
('only_uk', 'cs', 'ISO_8859_1'),
|
798
|
+
('only_uk', 'revision', 1),
|
799
|
+
('only_uk', 'src_ddl', 'CREATE TABLE `only_uk` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `tag` varchar(43) DEFAULT NULL, `comment` varchar(24) NOT NULL, UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;'),
|
800
|
+
('only_uk', 'pk_override', 'id');
|
801
|
+
COMMIT;
|
802
|
+
DROP TABLE IF EXISTS "only_uk_flydata20160125232857";
|
803
|
+
EOT
|
804
|
+
end
|
805
|
+
end
|
806
|
+
|
751
807
|
context 'with mysqldump_test_unsigned.dump' do
|
752
808
|
let(:dump_file_name) { 'mysqldump_test_unsigned.dump' }
|
753
809
|
|
@@ -818,6 +874,56 @@ INSERT INTO "flydata_ctl_tables" (table_name, attribute, value) VALUES
|
|
818
874
|
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;".split("\n").join}');
|
819
875
|
COMMIT;
|
820
876
|
DROP TABLE IF EXISTS "zerofill_table_flydata20160125232857";
|
877
|
+
EOT
|
878
|
+
end
|
879
|
+
end
|
880
|
+
|
881
|
+
context 'with mysqldump_test_view_and_table.dump' do
|
882
|
+
let(:dump_file_name) { 'mysqldump_test_view_and_table.dump' }
|
883
|
+
|
884
|
+
it 'should return ddl including queries only for a table, and no queries for a view' do
|
885
|
+
expect(subject).to eq( <<EOT )
|
886
|
+
CREATE TABLE IF NOT EXISTS "flydata_ctl_columns"(
|
887
|
+
id integer NOT NULL IDENTITY(1,1),
|
888
|
+
table_name varchar(128) NOT NULL,
|
889
|
+
column_name varchar(128) NOT NULL,
|
890
|
+
src_data_type varchar(1024) NOT NULL,
|
891
|
+
revision int NOT NULL DEFAULT 1,
|
892
|
+
ordinal_position int NOT NULL,
|
893
|
+
PRIMARY KEY(id)
|
894
|
+
) DISTKEY(table_name) SORTKEY(table_name);
|
895
|
+
CREATE TABLE IF NOT EXISTS "flydata_ctl_tables"(
|
896
|
+
id integer NOT NULL IDENTITY(1,1),
|
897
|
+
table_name varchar(128) NOT NULL,
|
898
|
+
attribute varchar(128) NOT NULL,
|
899
|
+
value varchar(max),
|
900
|
+
created_at timestamp DEFAULT SYSDATE,
|
901
|
+
PRIMARY KEY(id)
|
902
|
+
) DISTKEY(table_name) SORTKEY(table_name);
|
903
|
+
BEGIN;
|
904
|
+
DROP TABLE IF EXISTS "test_table_flydata20160125232857";
|
905
|
+
CREATE TABLE IF NOT EXISTS "test_table" (
|
906
|
+
"id" int4,
|
907
|
+
"tag" varchar(144) DEFAULT NULL,
|
908
|
+
PRIMARY KEY ("id")
|
909
|
+
) DISTKEY("id") SORTKEY("id");
|
910
|
+
ALTER TABLE "test_table" RENAME TO "test_table_flydata20160125232857";
|
911
|
+
CREATE TABLE "test_table" (
|
912
|
+
"id" int4,
|
913
|
+
"tag" varchar(144) DEFAULT NULL,
|
914
|
+
PRIMARY KEY ("id")
|
915
|
+
) DISTKEY("id") SORTKEY("id");
|
916
|
+
DELETE FROM "flydata_ctl_columns" WHERE table_name = 'test_table';
|
917
|
+
INSERT INTO "flydata_ctl_columns" (table_name, column_name, src_data_type, ordinal_position) VALUES
|
918
|
+
('test_table', 'id', 'int4(11)', 1),
|
919
|
+
('test_table', 'tag', 'varchar(144)', 2);
|
920
|
+
DELETE FROM "flydata_ctl_tables" WHERE table_name = 'test_table';
|
921
|
+
INSERT INTO "flydata_ctl_tables" (table_name, attribute, value) VALUES
|
922
|
+
('test_table', 'cs', 'ISO_8859_1'),
|
923
|
+
('test_table', 'revision', 1),
|
924
|
+
('test_table', 'src_ddl', 'CREATE TABLE `test_table` ( `id` int(11) NOT NULL AUTO_INCREMENT, `tag` varchar(48) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;');
|
925
|
+
COMMIT;
|
926
|
+
DROP TABLE IF EXISTS "test_table_flydata20160125232857";
|
821
927
|
EOT
|
822
928
|
end
|
823
929
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
-- MySQL dump 10.13 Distrib 5.5.46, for debian-linux-gnu (x86_64)
|
2
|
+
--
|
3
|
+
-- Host: rdss-chie.c6dj7ech9e6t.us-east-1.rds.amazonaws.com Database: synctest
|
4
|
+
-- ------------------------------------------------------
|
5
|
+
-- Server version 5.6.23-log
|
6
|
+
|
7
|
+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
8
|
+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
9
|
+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
10
|
+
/*!40101 SET NAMES utf8 */;
|
11
|
+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
12
|
+
/*!40103 SET TIME_ZONE='+00:00' */;
|
13
|
+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
14
|
+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
15
|
+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
16
|
+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
17
|
+
|
18
|
+
--
|
19
|
+
-- Table structure for table `blackhole_table`
|
20
|
+
--
|
21
|
+
|
22
|
+
DROP TABLE IF EXISTS `blackhole_table`;
|
23
|
+
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
24
|
+
/*!40101 SET character_set_client = utf8 */;
|
25
|
+
CREATE TABLE `blackhole_table` (
|
26
|
+
`id` int(11) NOT NULL,
|
27
|
+
`tag` char(10) DEFAULT NULL,
|
28
|
+
PRIMARY KEY (`id`)
|
29
|
+
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1;
|
30
|
+
/*!40101 SET character_set_client = @saved_cs_client */;
|
31
|
+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
32
|
+
|
33
|
+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
34
|
+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
35
|
+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
36
|
+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
37
|
+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
38
|
+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
39
|
+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
40
|
+
|
41
|
+
-- Dump completed on 2016-07-01 18:30:41
|
@@ -0,0 +1,41 @@
|
|
1
|
+
-- MySQL dump 10.13 Distrib 5.5.46, for debian-linux-gnu (x86_64)
|
2
|
+
--
|
3
|
+
-- Host: rdss-chie.c6dj7ech9e6t.us-east-1.rds.amazonaws.com Database: synctest
|
4
|
+
-- ------------------------------------------------------
|
5
|
+
-- Server version 5.6.23-log
|
6
|
+
|
7
|
+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
8
|
+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
9
|
+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
10
|
+
/*!40101 SET NAMES utf8 */;
|
11
|
+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
12
|
+
/*!40103 SET TIME_ZONE='+00:00' */;
|
13
|
+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
14
|
+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
15
|
+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
16
|
+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
17
|
+
|
18
|
+
--
|
19
|
+
-- Table structure for table `memory_table`
|
20
|
+
--
|
21
|
+
|
22
|
+
DROP TABLE IF EXISTS `memory_table`;
|
23
|
+
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
24
|
+
/*!40101 SET character_set_client = utf8 */;
|
25
|
+
CREATE TABLE `memory_table` (
|
26
|
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
27
|
+
`tag` varchar(24) DEFAULT NULL,
|
28
|
+
PRIMARY KEY (`id`)
|
29
|
+
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
30
|
+
/*!40101 SET character_set_client = @saved_cs_client */;
|
31
|
+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
32
|
+
|
33
|
+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
34
|
+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
35
|
+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
36
|
+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
37
|
+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
38
|
+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
39
|
+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
40
|
+
|
41
|
+
-- Dump completed on 2016-07-01 18:31:14
|
@@ -0,0 +1,56 @@
|
|
1
|
+
-- MySQL dump 10.13 Distrib 5.6.25, for Linux (x86_64)
|
2
|
+
--
|
3
|
+
-- Host: localhost Database: synctest
|
4
|
+
-- ------------------------------------------------------
|
5
|
+
-- Server version 5.6.23-log
|
6
|
+
|
7
|
+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
8
|
+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
9
|
+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
10
|
+
/*!40101 SET NAMES utf8 */;
|
11
|
+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
12
|
+
/*!40103 SET TIME_ZONE='+00:00' */;
|
13
|
+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
14
|
+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
15
|
+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
16
|
+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
17
|
+
|
18
|
+
--
|
19
|
+
-- Table structure for table `null_uk`
|
20
|
+
--
|
21
|
+
|
22
|
+
DROP TABLE IF EXISTS `null_uk`;
|
23
|
+
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
24
|
+
/*!40101 SET character_set_client = utf8 */;
|
25
|
+
CREATE TABLE `null_uk` (
|
26
|
+
`id` int(11) DEFAULT '0',
|
27
|
+
`field` int(11) DEFAULT '0',
|
28
|
+
`uid` int(11) NOT NULL DEFAULT '0',
|
29
|
+
`null_id` int(11) DEFAULT NULL,
|
30
|
+
UNIQUE KEY `null_id` (`null_id`),
|
31
|
+
UNIQUE KEY `id` (`id`),
|
32
|
+
UNIQUE KEY `multi_id` (`id`,`uid`),
|
33
|
+
KEY `id_2` (`id`)
|
34
|
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
35
|
+
/*!40101 SET character_set_client = @saved_cs_client */;
|
36
|
+
|
37
|
+
--
|
38
|
+
-- Dumping data for table `null_uk`
|
39
|
+
--
|
40
|
+
|
41
|
+
LOCK TABLES `null_uk` WRITE;
|
42
|
+
/*!40000 ALTER TABLE `null_uk` DISABLE KEYS */;
|
43
|
+
INSERT INTO `null_uk` VALUES (NULL,0,0,NULL),(NULL,0,0,NULL),(NULL,0,0,NULL),(NULL,0,0,NULL);
|
44
|
+
/*!40000 ALTER TABLE `null_uk` ENABLE KEYS */;
|
45
|
+
UNLOCK TABLES;
|
46
|
+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
47
|
+
|
48
|
+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
49
|
+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
50
|
+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
51
|
+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
52
|
+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
53
|
+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
54
|
+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
55
|
+
|
56
|
+
-- Dump completed on 2016-07-01 23:56:08
|
@@ -0,0 +1,52 @@
|
|
1
|
+
-- MySQL dump 10.13 Distrib 5.6.25, for Linux (x86_64)
|
2
|
+
--
|
3
|
+
-- Host: localhost Database: synctest
|
4
|
+
-- ------------------------------------------------------
|
5
|
+
-- Server version 5.6.23-log
|
6
|
+
|
7
|
+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
8
|
+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
9
|
+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
10
|
+
/*!40101 SET NAMES utf8 */;
|
11
|
+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
12
|
+
/*!40103 SET TIME_ZONE='+00:00' */;
|
13
|
+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
14
|
+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
15
|
+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
16
|
+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
17
|
+
|
18
|
+
--
|
19
|
+
-- Table structure for table `only_uk`
|
20
|
+
--
|
21
|
+
|
22
|
+
DROP TABLE IF EXISTS `only_uk`;
|
23
|
+
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
24
|
+
/*!40101 SET character_set_client = utf8 */;
|
25
|
+
CREATE TABLE `only_uk` (
|
26
|
+
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
27
|
+
`tag` varchar(43) DEFAULT NULL,
|
28
|
+
`comment` varchar(24) NOT NULL,
|
29
|
+
UNIQUE KEY `id` (`id`)
|
30
|
+
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
|
31
|
+
/*!40101 SET character_set_client = @saved_cs_client */;
|
32
|
+
|
33
|
+
--
|
34
|
+
-- Dumping data for table `only_uk`
|
35
|
+
--
|
36
|
+
|
37
|
+
LOCK TABLES `only_uk` WRITE;
|
38
|
+
/*!40000 ALTER TABLE `only_uk` DISABLE KEYS */;
|
39
|
+
INSERT INTO `only_uk` VALUES (1,'test DDE',1),(2,'test DDE',2);
|
40
|
+
/*!40000 ALTER TABLE `only_uk` ENABLE KEYS */;
|
41
|
+
UNLOCK TABLES;
|
42
|
+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
43
|
+
|
44
|
+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
45
|
+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
46
|
+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
47
|
+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
48
|
+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
49
|
+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
50
|
+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
51
|
+
|
52
|
+
-- Dump completed on 2016-07-01 21:03:42
|
@@ -0,0 +1,57 @@
|
|
1
|
+
-- MySQL dump 10.13 Distrib 5.6.25, for Linux (x86_64)
|
2
|
+
--
|
3
|
+
-- Host: localhost Database: synctest
|
4
|
+
-- ------------------------------------------------------
|
5
|
+
-- Server version 5.6.23-log
|
6
|
+
|
7
|
+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
8
|
+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
9
|
+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
10
|
+
/*!40101 SET NAMES utf8 */;
|
11
|
+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
12
|
+
/*!40103 SET TIME_ZONE='+00:00' */;
|
13
|
+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
14
|
+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
15
|
+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
16
|
+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
17
|
+
|
18
|
+
--
|
19
|
+
-- Temporary view structure for view `sample_view`
|
20
|
+
--
|
21
|
+
|
22
|
+
DROP TABLE IF EXISTS `sample_view`;
|
23
|
+
/*!50001 DROP VIEW IF EXISTS `sample_view`*/;
|
24
|
+
SET @saved_cs_client = @@character_set_client;
|
25
|
+
SET character_set_client = utf8;
|
26
|
+
/*!50001 CREATE VIEW `sample_view` AS SELECT
|
27
|
+
1 AS `name`*/;
|
28
|
+
SET character_set_client = @saved_cs_client;
|
29
|
+
|
30
|
+
--
|
31
|
+
-- Final view structure for view `sample_view`
|
32
|
+
--
|
33
|
+
|
34
|
+
/*!50001 DROP VIEW IF EXISTS `sample_view`*/;
|
35
|
+
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
36
|
+
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
37
|
+
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
38
|
+
/*!50001 SET character_set_client = utf8 */;
|
39
|
+
/*!50001 SET character_set_results = utf8 */;
|
40
|
+
/*!50001 SET collation_connection = utf8_general_ci */;
|
41
|
+
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
42
|
+
/*!50013 DEFINER=`admin`@`%` SQL SECURITY DEFINER */
|
43
|
+
/*!50001 VIEW `sample_view` AS select distinct `sample`.`name` AS `name` from `sample` */;
|
44
|
+
/*!50001 SET character_set_client = @saved_cs_client */;
|
45
|
+
/*!50001 SET character_set_results = @saved_cs_results */;
|
46
|
+
/*!50001 SET collation_connection = @saved_col_connection */;
|
47
|
+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
48
|
+
|
49
|
+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
50
|
+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
51
|
+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
52
|
+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
53
|
+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
54
|
+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
55
|
+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
56
|
+
|
57
|
+
-- Dump completed on 2016-07-01 6:50:24
|
@@ -0,0 +1,80 @@
|
|
1
|
+
-- MySQL dump 10.13 Distrib 5.6.25, for Linux (x86_64)
|
2
|
+
--
|
3
|
+
-- Host: localhost Database: synctest
|
4
|
+
-- ------------------------------------------------------
|
5
|
+
-- Server version 5.6.23-log
|
6
|
+
|
7
|
+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
8
|
+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
9
|
+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
10
|
+
/*!40101 SET NAMES utf8 */;
|
11
|
+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
12
|
+
/*!40103 SET TIME_ZONE='+00:00' */;
|
13
|
+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
14
|
+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
15
|
+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
16
|
+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
17
|
+
|
18
|
+
--
|
19
|
+
-- Table structure for table `test_table`
|
20
|
+
--
|
21
|
+
|
22
|
+
DROP TABLE IF EXISTS `test_table`;
|
23
|
+
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
24
|
+
/*!40101 SET character_set_client = utf8 */;
|
25
|
+
CREATE TABLE `test_table` (
|
26
|
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
27
|
+
`tag` varchar(48) DEFAULT NULL,
|
28
|
+
PRIMARY KEY (`id`)
|
29
|
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
30
|
+
/*!40101 SET character_set_client = @saved_cs_client */;
|
31
|
+
|
32
|
+
--
|
33
|
+
-- Dumping data for table `test_table`
|
34
|
+
--
|
35
|
+
|
36
|
+
LOCK TABLES `test_table` WRITE;
|
37
|
+
/*!40000 ALTER TABLE `test_table` DISABLE KEYS */;
|
38
|
+
/*!40000 ALTER TABLE `test_table` ENABLE KEYS */;
|
39
|
+
UNLOCK TABLES;
|
40
|
+
|
41
|
+
--
|
42
|
+
-- Temporary view structure for view `sample_view`
|
43
|
+
--
|
44
|
+
|
45
|
+
DROP TABLE IF EXISTS `sample_view`;
|
46
|
+
/*!50001 DROP VIEW IF EXISTS `sample_view`*/;
|
47
|
+
SET @saved_cs_client = @@character_set_client;
|
48
|
+
SET character_set_client = utf8;
|
49
|
+
/*!50001 CREATE VIEW `sample_view` AS SELECT
|
50
|
+
1 AS `name`*/;
|
51
|
+
SET character_set_client = @saved_cs_client;
|
52
|
+
|
53
|
+
--
|
54
|
+
-- Final view structure for view `sample_view`
|
55
|
+
--
|
56
|
+
|
57
|
+
/*!50001 DROP VIEW IF EXISTS `sample_view`*/;
|
58
|
+
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
59
|
+
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
60
|
+
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
61
|
+
/*!50001 SET character_set_client = utf8 */;
|
62
|
+
/*!50001 SET character_set_results = utf8 */;
|
63
|
+
/*!50001 SET collation_connection = utf8_general_ci */;
|
64
|
+
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
65
|
+
/*!50013 DEFINER=`admin`@`%` SQL SECURITY DEFINER */
|
66
|
+
/*!50001 VIEW `sample_view` AS select distinct `sample`.`name` AS `name` from `sample` */;
|
67
|
+
/*!50001 SET character_set_client = @saved_cs_client */;
|
68
|
+
/*!50001 SET character_set_results = @saved_cs_results */;
|
69
|
+
/*!50001 SET collation_connection = @saved_col_connection */;
|
70
|
+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
71
|
+
|
72
|
+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
73
|
+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
74
|
+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
75
|
+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
76
|
+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
77
|
+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
78
|
+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
79
|
+
|
80
|
+
-- Dump completed on 2016-07-01 22:47:38
|
data/flydata.gemspec
CHANGED
Binary file
|
@@ -48,7 +48,7 @@ class SyncGenerateTableDdl < Component
|
|
48
48
|
end
|
49
49
|
|
50
50
|
if missing_tables
|
51
|
-
missing_tables.each {|missing_table| error_list << { error: "
|
51
|
+
missing_tables.each {|missing_table| error_list << { error: "Table does not exist in the #{data_source_type_display_name}", table: missing_table } }
|
52
52
|
end
|
53
53
|
|
54
54
|
[flydata_tabledefs, error_list, uk_as_pk_override]
|
@@ -78,13 +78,6 @@ module SourceMysql
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
# If table_type='VIEW' or engine='MEMORY', raise error.
|
82
|
-
def check_mysql_table_types
|
83
|
-
return if @tables.empty?
|
84
|
-
option = @db_opts.dup.merge(tables: @tables)
|
85
|
-
FlydataCore::Mysql::TableTypeChecker.new(option).do_check
|
86
|
-
end
|
87
|
-
|
88
81
|
def run_mysql_retention_check
|
89
82
|
FlydataCore::Mysql::NonRdsRetentionChecker.new(@db_opts).do_check
|
90
83
|
end
|
@@ -202,9 +202,9 @@ module Flydata
|
|
202
202
|
let(:invalid_tables_str) { 'error_fullsync_1,error_append_2' }
|
203
203
|
let(:tbl_attrs_for_invalid_tables) {[
|
204
204
|
{"table_name"=>"error_fullsync_1", "status"=>"init_sync_pending",
|
205
|
-
"invalid_table_reason"=>"
|
205
|
+
"invalid_table_reason"=>"No primary key defined"},
|
206
206
|
{"table_name"=>"error_append_2", "omit_events"=>["delete"], "status"=>"init_sync_pending",
|
207
|
-
"invalid_table_reason"=>"
|
207
|
+
"invalid_table_reason"=>"Table does not exist in the MySQL database"},
|
208
208
|
]}
|
209
209
|
|
210
210
|
let(:pk_override_hash) { {"Users"=>["id"]} }
|
@@ -17,7 +17,7 @@ module Fluent
|
|
17
17
|
tables test_table,test_table_1,test_table_2
|
18
18
|
tables_append_only test_table_3,error_table_4
|
19
19
|
pk_override {"test_table_1":["id1","id2"],"test_table_3":["uid"]}
|
20
|
-
table_attributes [{"table_name":"test_table","status":"init_sync_completed"},{"table_name":"test_table_1","status":"init_sync_completed","pk_override":["id1","id2"]},{"table_name":"test_table_2","status":"init_sync_pending"},{"table_name":"test_table_3","omit_events":["delete"],"status":"init_sync_pending","uk_as_pk":["uid"]},{"table_name":"error_table_4","omit_events":["delete"],"status":"init_sync_pending","invalid_table_reason":"
|
20
|
+
table_attributes [{"table_name":"test_table","status":"init_sync_completed"},{"table_name":"test_table_1","status":"init_sync_completed","pk_override":["id1","id2"]},{"table_name":"test_table_2","status":"init_sync_pending"},{"table_name":"test_table_3","omit_events":["delete"],"status":"init_sync_pending","uk_as_pk":["uid"]},{"table_name":"error_table_4","omit_events":["delete"],"status":"init_sync_pending","invalid_table_reason":"Table does not exist in the MySQL database"}]
|
21
21
|
position_file #{TEST_POSITION_FILE}
|
22
22
|
host localhost
|
23
23
|
port 3306
|
@@ -244,7 +244,7 @@ EOT
|
|
244
244
|
{"table_name"=>"test_table_1", "status"=>"init_sync_completed", "pk_override"=>["id1", "id2"]},
|
245
245
|
{"table_name"=>"test_table_2", "status"=>"init_sync_pending"},
|
246
246
|
{"table_name"=>"test_table_3", "omit_events"=>["delete"], "status"=>"init_sync_pending", "uk_as_pk"=>["uid"]},
|
247
|
-
{"table_name"=>"error_table_4", "omit_events"=>["delete"], "status"=>"init_sync_pending", "invalid_table_reason"=>"
|
247
|
+
{"table_name"=>"error_table_4", "omit_events"=>["delete"], "status"=>"init_sync_pending", "invalid_table_reason"=>"Table does not exist in the MySQL database"}]
|
248
248
|
}
|
249
249
|
before do
|
250
250
|
Test.configure_plugin(plugin, config)
|
@@ -16,7 +16,7 @@ module Fluent
|
|
16
16
|
tables test_table,test_table_1,test_table_2
|
17
17
|
tables_append_only test_table_3,error_table_4
|
18
18
|
pk_override {"test_table_1":["id1","id2"],"test_table_3":["uid"]}
|
19
|
-
table_attributes [{"table_name":"test_table","status":"init_sync_completed"},{"table_name":"test_table_1","status":"init_sync_completed","pk_override":["id1","id2"]},{"table_name":"test_table_2","status":"init_sync_pending"},{"table_name":"test_table_3","omit_events":["delete"],"status":"init_sync_pending","uk_as_pk":["uid"]},{"table_name":"error_table_4","omit_events":["delete"],"status":"init_sync_pending","invalid_table_reason":"
|
19
|
+
table_attributes [{"table_name":"test_table","status":"init_sync_completed"},{"table_name":"test_table_1","status":"init_sync_completed","pk_override":["id1","id2"]},{"table_name":"test_table_2","status":"init_sync_pending"},{"table_name":"test_table_3","omit_events":["delete"],"status":"init_sync_pending","uk_as_pk":["uid"]},{"table_name":"error_table_4","omit_events":["delete"],"status":"init_sync_pending","invalid_table_reason":"Table does not exist in the MySQL database"}]
|
20
20
|
position_file #{TEST_POSITION_FILE}
|
21
21
|
host localhost
|
22
22
|
port 5433
|
@@ -39,7 +39,7 @@ EOT
|
|
39
39
|
{"table_name"=>"test_table_1", "status"=>"init_sync_completed", "pk_override"=>["id1", "id2"]},
|
40
40
|
{"table_name"=>"test_table_2", "status"=>"init_sync_pending"},
|
41
41
|
{"table_name"=>"test_table_3", "omit_events"=>["delete"], "status"=>"init_sync_pending", "uk_as_pk"=>["uid"]},
|
42
|
-
{"table_name"=>"error_table_4", "omit_events"=>["delete"], "status"=>"init_sync_pending", "invalid_table_reason"=>"
|
42
|
+
{"table_name"=>"error_table_4", "omit_events"=>["delete"], "status"=>"init_sync_pending", "invalid_table_reason"=>"Table does not exist in the MySQL database"}]
|
43
43
|
}
|
44
44
|
before do
|
45
45
|
create_file(TEST_POSITION_FILE, "1001:1001:\t\t")
|
@@ -41,7 +41,7 @@ module SourceMysql
|
|
41
41
|
it "calls all check methods" do
|
42
42
|
%w(compatibility56_variable mysql_user_compat mysql_protocol_tcp_compat
|
43
43
|
mysql_parameters_compat rds_master_status mysql_binlog_retention
|
44
|
-
|
44
|
+
writing_permissions).each do |method_name|
|
45
45
|
expect(subject_object).to receive("check_#{method_name}".to_sym)
|
46
46
|
end
|
47
47
|
|
@@ -194,53 +194,6 @@ module SourceMysql
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
-
describe "#check_mysql_table_types" do
|
198
|
-
subject { subject_object.check_mysql_table_types }
|
199
|
-
|
200
|
-
let(:de_hash) do
|
201
|
-
{ "host" => "test",
|
202
|
-
"port" => 1234,
|
203
|
-
"username" => "test",
|
204
|
-
"password" => "password",
|
205
|
-
"database" => "test_db",
|
206
|
-
"tables"=>["normal_table", "engine_table", "view_table"] }
|
207
|
-
end
|
208
|
-
let(:normal_table) { {"table_name"=>"normal_table", "table_type"=>"BASE TABLE", "engine"=>"InnoDB"} }
|
209
|
-
let(:engine_table) { {"table_name"=>"engine_table", "table_type"=>"BASE TABLE", "engine"=>"MEMORY"} }
|
210
|
-
let(:blackhole_table) { {"table_name"=>"blackhole_table", "table_type"=>"BASE TABLE", "engine"=>"BLACKHOLE"} }
|
211
|
-
let(:view) { {"table_name"=>"view_table", "table_type"=>"VIEW", "engine"=>nil} }
|
212
|
-
let(:error) { FlydataCore::MysqlCompatibilityError }
|
213
|
-
let(:base_error_msg) { "FlyData does not support VIEW and MEMORY,BLACKHOLE STORAGE ENGINE table. Remove following tables from data entry: %s" }
|
214
|
-
before do
|
215
|
-
allow(client).to receive(:query).and_return(table_list)
|
216
|
-
allow(client).to receive(:escape).and_return("aaa")
|
217
|
-
end
|
218
|
-
context "where data entry has VIEW and MEMORY engine table" do
|
219
|
-
let(:error_msg) { base_error_msg % engine_table['table_name'] + ', ' + view['table_name'] }
|
220
|
-
let(:table_list) { [ engine_table, view ] }
|
221
|
-
it { expect{subject}.to raise_error(error, /#{error_msg}/) }
|
222
|
-
end
|
223
|
-
context "where data entry has MEMORY engine table" do
|
224
|
-
let(:error_msg) { base_error_msg % engine_table['table_name'] }
|
225
|
-
let(:table_list) { [ engine_table ] }
|
226
|
-
it { expect{subject}.to raise_error(error, /#{error_msg}/) }
|
227
|
-
end
|
228
|
-
context "where data entry has BLACKHOLE engine table" do
|
229
|
-
let(:error_msg) { base_error_msg % blackhole_table['table_name'] }
|
230
|
-
let(:table_list) { [ blackhole_table ] }
|
231
|
-
it { expect{subject}.to raise_error(error, /#{error_msg}/) }
|
232
|
-
end
|
233
|
-
context "where data entry has the VIEW" do
|
234
|
-
let(:error_msg) { base_error_msg % view['table_name'] }
|
235
|
-
let(:table_list) { [ view ] }
|
236
|
-
it { expect{subject}.to raise_error(error, /#{error_msg}/) }
|
237
|
-
end
|
238
|
-
context "where data entry does not have either VIEW and ENGINE table" do
|
239
|
-
let(:table_list) { [ normal_table ] }
|
240
|
-
it { expect{subject}.to_not raise_error }
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
197
|
describe "#check_rds_master_status" do
|
245
198
|
subject { subject_object.check_rds_master_status }
|
246
199
|
|
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.7.
|
4
|
+
version: 0.7.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: 2016-
|
15
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rest-client
|
@@ -590,6 +590,7 @@ files:
|
|
590
590
|
- flydata-core/spec/table_def/mysql_table_def_spec.rb
|
591
591
|
- flydata-core/spec/table_def/mysql_to_redshift_table_def_spec.rb
|
592
592
|
- flydata-core/spec/table_def/mysqldump_test_bit_table.dump
|
593
|
+
- flydata-core/spec/table_def/mysqldump_test_blackhole_engine.dump
|
593
594
|
- flydata-core/spec/table_def/mysqldump_test_col_comment_with_AUTO_INCREMENT_keyword.dump
|
594
595
|
- flydata-core/spec/table_def/mysqldump_test_col_comment_with_not_null_keyword.dump
|
595
596
|
- flydata-core/spec/table_def/mysqldump_test_col_comment_with_unique_keyword.dump
|
@@ -597,16 +598,21 @@ files:
|
|
597
598
|
- flydata-core/spec/table_def/mysqldump_test_col_name_with_space.dump
|
598
599
|
- flydata-core/spec/table_def/mysqldump_test_column_charset.dump
|
599
600
|
- flydata-core/spec/table_def/mysqldump_test_foreign_key.dump
|
601
|
+
- flydata-core/spec/table_def/mysqldump_test_memory_engine.dump
|
602
|
+
- flydata-core/spec/table_def/mysqldump_test_null_uk.dump
|
600
603
|
- flydata-core/spec/table_def/mysqldump_test_table_all.dump
|
601
604
|
- flydata-core/spec/table_def/mysqldump_test_table_column_comment.dump
|
602
605
|
- flydata-core/spec/table_def/mysqldump_test_table_column_comment_including_invalid_char.dump
|
603
606
|
- flydata-core/spec/table_def/mysqldump_test_table_enum.dump
|
604
607
|
- flydata-core/spec/table_def/mysqldump_test_table_multi_pk.dump
|
605
608
|
- flydata-core/spec/table_def/mysqldump_test_table_no_pk.dump
|
609
|
+
- flydata-core/spec/table_def/mysqldump_test_table_only_uk.dump
|
606
610
|
- flydata-core/spec/table_def/mysqldump_test_unique_key.dump
|
607
611
|
- flydata-core/spec/table_def/mysqldump_test_unique_key2.dump
|
608
612
|
- flydata-core/spec/table_def/mysqldump_test_unique_key3.dump
|
609
613
|
- flydata-core/spec/table_def/mysqldump_test_unsigned.dump
|
614
|
+
- flydata-core/spec/table_def/mysqldump_test_view1.dump
|
615
|
+
- flydata-core/spec/table_def/mysqldump_test_view_and_table.dump
|
610
616
|
- flydata-core/spec/table_def/postgresql_table_def_spec.rb
|
611
617
|
- flydata-core/spec/table_def/redshift_table_def_spec.rb
|
612
618
|
- flydata-core/spec/table_def/sync_redshift_table_def_spec.rb
|