flydata 0.2.18 → 0.2.19

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: e60423bcd2e535f420b6cffae38bb02d4c4183b8
4
- data.tar.gz: eff1e3250db8d8e036c977f7c5c0fb50232d4fe2
3
+ metadata.gz: eb04da6c165e8ace6ac6b7089c73eca79d2d1fc1
4
+ data.tar.gz: 77794c3f97103bd4090a70bdceb6036eb8e488ab
5
5
  SHA512:
6
- metadata.gz: e30e9303ae3bfa61ccd55eda8837c3606b6502e3523cd4d476068f4ac34b7814ed4fd4858e3af0327705d6f26d2a17d3ec205277acfd92844c919f15ecce15be
7
- data.tar.gz: d26ad0a84abdeaac414f75c357a5a10f5b6c918659f7be55cd17603940c8d9bf76bbe67535f2ed75ce891723c01554a2c6d2bbcc167282cc0380b6ace81fd748
6
+ metadata.gz: 305c9ace6887dcf12a1fa4dd62830e41c11a87b42acd0efa06a0032b28dabccdacafc9945e9fd7b4b6d23eb872db347481ca7f605b814363a2d39c34a425340c
7
+ data.tar.gz: 76a51648a3e4ba7b363072e99c397b7b8542a0b57135cc494de51d5a4d65fda5f81cc263d0ffbe2a006e3f1e0591073187580e65f6e5ac05cebdedb22356b736
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.18
1
+ 0.2.19
data/circle.yml ADDED
@@ -0,0 +1,24 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.0.0-p481
4
+
5
+ dependencies:
6
+ pre:
7
+ - sudo dpkg -l |grep libboost|grep 1.48|awk '{print $2}'|xargs sudo apt-get purge -y
8
+ - sudo apt-get autoremove
9
+ - sudo apt-get install -y libboost-system1.54.0
10
+ - sudo apt-get install -y libboost-system1.54-dev
11
+ - sudo apt-get install -y libboost-thread1.54.0
12
+ - sudo apt-get install -y libboost-thread1.54-dev
13
+ - sudo apt-get install -y libboost1.54-dev
14
+ - wget --no-check-certificate -O mysql-replication-listener.zip https://github.com/hapyrus/mysql-replication-listener/archive/master.zip
15
+ - unzip mysql-replication-listener.zip
16
+ - cd mysql-replication-listener-master; cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DBoost_NO_BOOST_CMAKE=ON .; make -j4; sudo make install
17
+
18
+ database:
19
+ override:
20
+ - touch circle.yml
21
+
22
+ test:
23
+ override:
24
+ - bundle exec rspec
@@ -138,10 +138,10 @@ EOS
138
138
  if default_value.upcase == "CURRENT_TIMESTAMP"
139
139
  'SYSDATE'
140
140
  else
141
- "'#{self.parse_timestamp(default_value)}'"
141
+ "'#{self.parse_timestamp(remove_single_quote(default_value))}'"
142
142
  end
143
143
  when 'date'
144
- "'#{self.parse_date(default_value)}'"
144
+ "'#{self.parse_date(remove_single_quote(default_value))}'"
145
145
  else
146
146
  if !default_value.kind_of?(String)
147
147
  "'#{default_value}'"
@@ -159,6 +159,11 @@ EOS
159
159
  end
160
160
  end
161
161
 
162
+ def self.remove_single_quote(value)
163
+ return value unless value.kind_of?(String)
164
+ /^'.*'$/.match(value) ? value[1..-2] : value
165
+ end
166
+
162
167
  def self.primary_key_sql(flydata_tabledef)
163
168
  pks = flydata_tabledef[:columns].select{|col| col[:primary_key]}.collect{|col| col[:column]}
164
169
  pks.empty? ? nil : " PRIMARY KEY (#{pks.join(',')})"
@@ -271,13 +271,13 @@ EOT
271
271
  let(:not_null_default_sql) { " DEFAULT '0000-01-01'" }
272
272
 
273
273
  context 'when default_value is normal' do
274
- let(:default_value) { '2014-10-17' }
275
- let(:default_value_sql) { "'#{default_value}'" }
274
+ let(:default_value) { "'2014-10-17'" }
275
+ let(:default_value_sql) { default_value }
276
276
  it_behaves_like *examples
277
277
  end
278
278
 
279
279
  context 'when default_value is 0000-00-00' do
280
- let(:default_value) { '0000-00-00' }
280
+ let(:default_value) { "'0000-00-00'" }
281
281
  let(:default_value_sql) { "'0001-01-01'" }
282
282
  it_behaves_like *examples
283
283
  end
@@ -292,8 +292,8 @@ EOT
292
292
  let(:not_null_default_sql) { " DEFAULT '0000-01-01'" }
293
293
 
294
294
  context 'when default_value is normal' do
295
- let(:default_value) { '2014-10-17 22:22:22' }
296
- let(:default_value_sql) { "'#{default_value}.000000'" }
295
+ let(:default_value) { "'2014-10-17 22:22:22'" }
296
+ let(:default_value_sql) { "'2014-10-17 22:22:22.000000'" }
297
297
  it_behaves_like *examples
298
298
  end
299
299
 
@@ -304,7 +304,7 @@ EOT
304
304
  end
305
305
 
306
306
  context 'when default_value is 0000-00-00 00:00:00' do
307
- let(:default_value) { '0000-00-00 00:00:00' }
307
+ let(:default_value) { "'0000-00-00 00:00:00'" }
308
308
  let(:default_value_sql) { "'0001-01-01 00:00:00.000000'" }
309
309
  it_behaves_like *examples
310
310
  end
data/flydata.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "flydata"
8
- s.version = "0.2.18"
8
+ s.version = "0.2.19"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Koichi Fujikawa", "Masashi Miyazaki", "Matthew Luu", "Mak Inada", "Sriram NS"]
12
- s.date = "2014-11-27"
12
+ s.date = "2014-12-03"
13
13
  s.description = "FlyData Agent"
14
14
  s.email = "sysadmin@flydata.com"
15
15
  s.executables = ["fdmysqldump", "flydata", "serverinfo"]
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "bin/fdmysqldump",
28
28
  "bin/flydata",
29
29
  "bin/serverinfo",
30
+ "circle.yml",
30
31
  "flydata-core/.gitignore",
31
32
  "flydata-core/.rspec",
32
33
  "flydata-core/.travis.yml",
@@ -195,7 +195,7 @@ module Flydata
195
195
  worker = Thread.new do
196
196
  begin
197
197
  flydata.data_entry.cleanup_sync(de['id'], tables)
198
- rescue RestClient::RequestTimeout
198
+ rescue RestClient::RequestTimeout, RestClient::GatewayTimeout
199
199
  # server is taking time to cleanup. Try again
200
200
  retry
201
201
  end
@@ -196,6 +196,13 @@ grammar MysqlAlterTable
196
196
  }
197
197
  end
198
198
  }
199
+ / rename_sym sp key_or_index sp field_ident sp to_sym sp field_ident {
200
+ def action
201
+ { action: :rename_key_or_index,
202
+ support_level: :nonbreaking,
203
+ }
204
+ end
205
+ }
199
206
  / rename_sym opt_to nsp table_ident {
200
207
  def action
201
208
  { action: :rename_table }
@@ -44,8 +44,27 @@ module Flydata
44
44
  end
45
45
  end
46
46
 
47
+ subject { Sync.new }
48
+ describe '#cleanup_sync_server' do
49
+ let(:rest_client) { double('rest_client') }
50
+
51
+ context "when rest client throws timeout errors" do
52
+ before do
53
+ allow(RestClient::Resource).to receive(:new).and_return(rest_client)
54
+ end
55
+ it "should retry in case of RestClient::RequestTimeout" do
56
+ expect(rest_client).to receive(:post).and_raise(RestClient::RequestTimeout)
57
+ expect(rest_client).to receive(:post).and_return("{}")
58
+ subject.send(:cleanup_sync_server, default_data_entry)
59
+ end
60
+ it "should retry in case of RestClient::GatewayTimeout" do
61
+ expect(rest_client).to receive(:post).and_raise(RestClient::GatewayTimeout)
62
+ expect(rest_client).to receive(:post).and_return("{}")
63
+ subject.send(:cleanup_sync_server, default_data_entry)
64
+ end
65
+ end
66
+ end
47
67
  describe '#do_generate_table_ddl' do
48
- subject { Sync.new }
49
68
  shared_examples 'throws an error' do
50
69
  it "throws an error" do
51
70
  expect {
@@ -1307,6 +1307,12 @@ describe 'MysqlAlterTableParser' do
1307
1307
  end
1308
1308
  end
1309
1309
  end
1310
+ context "rename key or index" do
1311
+ let(:alter_table_action) { "rename#{key_or_index}#{identifier} TO#{identifier}" }
1312
+ let(:action) { :rename_key_or_index }
1313
+
1314
+ it_behaves_like "test key or index", "test field identifier", "a parser parsing a nonbreaking query"
1315
+ end
1310
1316
  context "order by" do
1311
1317
  let(:action) { :order_table }
1312
1318
  context "with single column" do
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.2.18
4
+ version: 0.2.19
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: 2014-11-27 00:00:00.000000000 Z
15
+ date: 2014-12-03 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rest-client
@@ -412,6 +412,7 @@ files:
412
412
  - bin/fdmysqldump
413
413
  - bin/flydata
414
414
  - bin/serverinfo
415
+ - circle.yml
415
416
  - flydata-core/.gitignore
416
417
  - flydata-core/.rspec
417
418
  - flydata-core/.travis.yml