flydata 0.6.12 → 0.6.13

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: 181cbcfe32036e4e5e580f5208c183c2aeede5d5
4
- data.tar.gz: d74e286636bafd5a3ade8482cd808c69597ff723
3
+ metadata.gz: 4abef5efd4f51c0f72fc28e582eb3331709e31d3
4
+ data.tar.gz: 2b457b9f88d81ea0e16fc810c1bc5a4e6a7dbf8a
5
5
  SHA512:
6
- metadata.gz: d01fd1622e3573ed4b2989af7ad77a1fd9f8c945bc6d8f959e65818a4733c161e32793c908c51ce71974066bc86db80d69aabff904d18a4336ddc60f95bd40bf
7
- data.tar.gz: f829d5633875735e6fef04eec4fadd7778b9e35eedbc7decbcbea150ebb4a2bf64d91bfcc50550f14f4a59ff8aecc2599cae93bb249e8ec775d2b58a71927f43
6
+ metadata.gz: c6cc67ea772223bc4f8d64dadc8a2e76a118ad5de04f6e165a24696f2f3a0eefc1e1a87c052d48877664fc70bb47c7600fbe5ce8baa5f833e805402e2f95822f
7
+ data.tar.gz: ebaf4bb22696a9b0c8e5013d0792063e7e054134b721e599915562f72372fdd953f61bea596d65e4de6aedd255bcd54c2fd958ced67910979cbfb61c8a801d41
data/Gemfile CHANGED
@@ -14,7 +14,7 @@ gem "slop", '~> 3.4', '>= 3.4.6'
14
14
  gem "treetop", '~> 1.5', '>= 1.5.3'
15
15
  gem "sys-filesystem", '~> 1.1', '>= 1.1.3'
16
16
  gem "io-console", '~> 0.4.2', '>= 0.4.2'
17
- gem "kodama", '~> 0.1', '>= 0.1.11'
17
+ gem "kodama", '~> 0.1', '>= 0.1.12'
18
18
  gem "serverengine", '~> 1.5'
19
19
 
20
20
  group :development do
data/Gemfile.lock CHANGED
@@ -61,8 +61,8 @@ GEM
61
61
  rdoc
62
62
  json (1.8.1)
63
63
  jwt (1.0.0)
64
- kodama (0.1.11)
65
- ruby-binlog (~> 1.0, >= 1.0.9)
64
+ kodama (0.1.12)
65
+ ruby-binlog (~> 1.0, >= 1.0.10)
66
66
  method_source (0.8.2)
67
67
  mime-types (2.3)
68
68
  minitest (4.7.5)
@@ -108,7 +108,7 @@ GEM
108
108
  rspec-mocks (3.0.3)
109
109
  rspec-support (~> 3.0.0)
110
110
  rspec-support (3.0.3)
111
- ruby-binlog (1.0.9)
111
+ ruby-binlog (1.0.10)
112
112
  ruby-prof (0.15.1)
113
113
  serverengine (1.5.10)
114
114
  sigdump (~> 0.2.2)
@@ -138,7 +138,7 @@ DEPENDENCIES
138
138
  io-console (~> 0.4.2, >= 0.4.2)
139
139
  jeweler (~> 1.8, >= 1.8.8)
140
140
  json (~> 1.8, >= 1.8.0)
141
- kodama (~> 0.1, >= 0.1.11)
141
+ kodama (~> 0.1, >= 0.1.12)
142
142
  mysql2 (~> 0.3, >= 0.3.17)
143
143
  pg (~> 0.18.4)
144
144
  protected_attributes (~> 1.0, >= 1.0.8)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.12
1
+ 0.6.13
@@ -1,4 +1,5 @@
1
1
  require 'flydata-core/table_def/base'
2
+ require 'flydata-core/string_utils'
2
3
 
3
4
  module FlydataCore
4
5
  module TableDef
@@ -101,6 +102,7 @@ class MysqlTableDef < Base
101
102
  position = :before_create_table
102
103
 
103
104
  io.each_line do |line|
105
+ line = FlydataCore::StringUtils.replace_invalid_utf8_char(line)
104
106
  case position
105
107
  when :before_create_table
106
108
  if line =~ /CREATE TABLE `(.*?)`/
@@ -128,6 +128,19 @@ describe MysqlTableDef do
128
128
  ]
129
129
  )
130
130
  end
131
+
132
+ context 'when column comment contains includes invalid chars' do
133
+ let(:dump_file_io) { file_io('mysqldump_test_table_column_comment_including_invalid_char.dump') }
134
+ it 'comment should be set with replaced chars' do
135
+ expect(subject[:columns]).to eq(
136
+ [
137
+ {:column=>"id", :type=>"int4(11)", :not_null=>true, :default=>"'0'",
138
+ :comment=>"a?2BY???i", :primary_key=>true},
139
+ {:column=>"value", :type=>"text", :comment=>"あいうえお"}
140
+ ]
141
+ )
142
+ end
143
+ end
131
144
  end
132
145
 
133
146
  context 'when table has multiple pk' do
@@ -0,0 +1,41 @@
1
+ -- MySQL dump 10.13 Distrib 5.6.13, for osx10.9 (x86_64)
2
+ --
3
+ -- Host: localhost Database: masashi_test
4
+ -- ------------------------------------------------------
5
+ -- Server version 5.6.13-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_column_comment`
20
+ --
21
+
22
+ DROP TABLE IF EXISTS `test_table_column_comment`;
23
+ /*!40101 SET @saved_cs_client = @@character_set_client */;
24
+ /*!40101 SET character_set_client = utf8 */;
25
+ CREATE TABLE `test_table_column_comment` (
26
+ `id` int(11) NOT NULL DEFAULT '0' COMMENT 'a�2BY���i',
27
+ `value` text COMMENT 'あいうえお',
28
+ PRIMARY KEY (`id`)
29
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='column comment test';
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 2014-04-25 13:24:35
data/flydata.gemspec CHANGED
Binary file
@@ -280,7 +280,8 @@ EOS
280
280
  # - Entry method
281
281
  def check(options = {})
282
282
  context = source.source_pos
283
- status, pos_mismatch_tables, gap_tables = _check(context, options)
283
+ status, corrupt_master_pos_files, pos_mismatch_tables, gap_tables =
284
+ _check(context, options)
284
285
 
285
286
  if status.include? :OK
286
287
  message = "\nNo errors are found. Sync is clean.\n"
@@ -296,6 +297,9 @@ EOS
296
297
  if status.include? :ABNORMAL_SHUTDOWN
297
298
  message += " - Agent was not shut down correctly\n"
298
299
  end
300
+ if status.include? :CORRUPT_MASTER_POS
301
+ message += " - Master source position is corrupted\n"
302
+ end
299
303
  if gap_tables
300
304
  message += " - Sync data is missing for the following table(s)\n"
301
305
  gap_tables.each do |bt|
@@ -462,6 +466,13 @@ EOS
462
466
  next
463
467
  end
464
468
  if tables.empty?
469
+ # Find the latest source pos to which all table data is up to date
470
+ if table_status_hash[table]["seq"] == 0
471
+ # this table's source pos is from the initial sync. It can't
472
+ # be used for determining the latest source pos because it can be
473
+ # newer than the correct cont sync source pos.
474
+ next
475
+ end
465
476
  if sent_source_pos.nil? || sent_source_pos < table_source_pos
466
477
  sent_source_pos = table_source_pos
467
478
  end
@@ -332,6 +332,7 @@ EOS
332
332
  state_create_table_columns = Proc.new do
333
333
  start_pos = dump_io.pos
334
334
  line = readline_proc.call
335
+ line = FlydataCore::StringUtils.replace_invalid_utf8_char(line)
335
336
 
336
337
  # `author_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
337
338
  if line.start_with?("\`")
@@ -280,7 +280,7 @@ DROP TABLE IF EXISTS `users_login`;
280
280
  CREATE TABLE `users_login` (
281
281
  `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'users id',
282
282
  `login_count` int(10) unsigned DEFAULT '0' COMMENT 'login count',
283
- `comment` varchar(255) DEFAULT NULL COMMENT 'comment',
283
+ `comment` varchar(255) DEFAULT NULL COMMENT 'comment\xED\xB1\x22end',
284
284
  `create_time` datetime NOT NULL COMMENT 'create time',
285
285
  `update_time` datetime NOT NULL COMMENT 'update time',
286
286
  PRIMARY KEY (`user_id`)
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.6.12
4
+ version: 0.6.13
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-03-09 00:00:00.000000000 Z
15
+ date: 2016-03-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rest-client
@@ -262,7 +262,7 @@ dependencies:
262
262
  requirements:
263
263
  - - '>='
264
264
  - !ruby/object:Gem::Version
265
- version: 0.1.11
265
+ version: 0.1.12
266
266
  - - ~>
267
267
  - !ruby/object:Gem::Version
268
268
  version: '0.1'
@@ -272,7 +272,7 @@ dependencies:
272
272
  requirements:
273
273
  - - '>='
274
274
  - !ruby/object:Gem::Version
275
- version: 0.1.11
275
+ version: 0.1.12
276
276
  - - ~>
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0.1'
@@ -590,6 +590,7 @@ files:
590
590
  - flydata-core/spec/table_def/mysqldump_test_foreign_key.dump
591
591
  - flydata-core/spec/table_def/mysqldump_test_table_all.dump
592
592
  - flydata-core/spec/table_def/mysqldump_test_table_column_comment.dump
593
+ - flydata-core/spec/table_def/mysqldump_test_table_column_comment_including_invalid_char.dump
593
594
  - flydata-core/spec/table_def/mysqldump_test_table_enum.dump
594
595
  - flydata-core/spec/table_def/mysqldump_test_table_multi_pk.dump
595
596
  - flydata-core/spec/table_def/mysqldump_test_table_no_pk.dump