flydata 0.2.26 → 0.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31c9862228f6affa3e27e1ffbe4bbd7bd330774e
|
4
|
+
data.tar.gz: 5a447f0bb5cc7db2997d90580d7b59360834743f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bdec134c9d33a26ab24c734220ba639465f2b7f1bc6e49333beebf80a6ee73794d603566aa5ca429b296718f1cdaa52d4ee98d5044b96981a60d64aeca724df
|
7
|
+
data.tar.gz: 7242fb4e8e3d1c19da49557238921b5ee5f91b7891f5710d39a136ed25127781c0db7269aece6ab08d167d53196dea16fbf98ddb07ef7b28c82b46d0c38d474d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.27
|
@@ -173,6 +173,10 @@ class TableRevisionError < RecordDeliveryError
|
|
173
173
|
def err_code; ErrorCode::TABLE_REVISION_ERROR; end
|
174
174
|
end
|
175
175
|
|
176
|
+
# Table's revision is lower than the record's revision. Should catch up soon.
|
177
|
+
class StaleTableRevisionError < TableRevisionError
|
178
|
+
end
|
179
|
+
|
176
180
|
# Unsupported ALTER TABLE which breaks the tables sync consistency.
|
177
181
|
class BreakingAlterTableError < RecordDeliveryError
|
178
182
|
def err_code; ErrorCode::BREAKING_ALTER_TABLE_ERROR; end
|
@@ -219,14 +219,18 @@ EOS
|
|
219
219
|
end
|
220
220
|
|
221
221
|
APACHE_TIMESTAMP_REGEXP = Regexp.new('^(?<apache_time_format>\[[0-3]\d\/\D{3}\/[1-2]\d{3}:[0-2]\d:[0-5]\d:[0-5]\d ?[\+\-]\d{2}:?\d{2}\])$')
|
222
|
+
TIME_REGEXP = Regexp.new('^(?<sign>-)?(?<hour>\d{2,3}):(?<minute>[0-5][0-9]):(?<second>[0-5][0-9](\.\d+)?)$')
|
222
223
|
|
223
224
|
def self.parse_timestamp(value)
|
225
|
+
return nil if value.to_s.empty?
|
224
226
|
if value.kind_of?(Integer) or /^\d+$/ === value
|
225
227
|
# Unix epoch in UTC
|
226
228
|
t = DateTime.strptime(value.to_s, '%s')
|
227
229
|
elsif APACHE_TIMESTAMP_REGEXP.match(value)
|
228
230
|
# apache time format
|
229
231
|
t = DateTime.strptime(value, "[%d/%b/%Y:%H:%M:%S %Z]")
|
232
|
+
elsif time_match = TIME_REGEXP.match(value)
|
233
|
+
t = convert_time_into_timestamp(time_match)
|
230
234
|
else
|
231
235
|
t = DateTime.parse(value)
|
232
236
|
end
|
@@ -241,6 +245,16 @@ EOS
|
|
241
245
|
end
|
242
246
|
end
|
243
247
|
|
248
|
+
STANDARD_DATETIME = DateTime.new(1, 1, 1)
|
249
|
+
|
250
|
+
def self.convert_time_into_timestamp(time_match)
|
251
|
+
sign = time_match[:sign] ? -1 : 1
|
252
|
+
STANDARD_DATETIME.dup +
|
253
|
+
sign * Rational(time_match[:hour].to_i, 24) +
|
254
|
+
sign * Rational(time_match[:minute].to_i, 1440) +
|
255
|
+
sign * Rational(time_match[:second].to_f, 86400)
|
256
|
+
end
|
257
|
+
|
244
258
|
def self.parse_date(value)
|
245
259
|
dt = Date.parse(value)
|
246
260
|
dt.strftime('%Y-%m-%d')
|
@@ -450,6 +450,149 @@ EOT
|
|
450
450
|
end
|
451
451
|
end
|
452
452
|
|
453
|
+
describe '.parse_timestamp' do
|
454
|
+
let(:value) { nil }
|
455
|
+
subject { described_class.parse_timestamp(value) }
|
456
|
+
|
457
|
+
context 'with w3c format value' do
|
458
|
+
context 'with sec' do
|
459
|
+
let(:value) { '1997-07-16T19:20:01+01:00' }
|
460
|
+
it { is_expected.to eq('1997-07-16 18:20:01.000000') }
|
461
|
+
end
|
462
|
+
context 'with millisec' do
|
463
|
+
let(:value) { '1997-07-16T19:20:01+01:00' }
|
464
|
+
it { is_expected.to eq('1997-07-16 18:20:01.000000') }
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
context 'with twitter format value' do
|
469
|
+
let(:value) { 'Sat Sep 17 14:48:57 +0900 2011' }
|
470
|
+
it { is_expected.to eq('2011-09-17 05:48:57.000000') }
|
471
|
+
end
|
472
|
+
|
473
|
+
context 'with redshift support format value' do
|
474
|
+
context 'with sec' do
|
475
|
+
let(:value) { '2012-01-23 19:20:15' }
|
476
|
+
it { is_expected.to eq('2012-01-23 19:20:15.000000') }
|
477
|
+
end
|
478
|
+
|
479
|
+
context 'with millisec' do
|
480
|
+
let(:value) { '2012-01-23 19:20:15.243' }
|
481
|
+
it { is_expected.to eq('2012-01-23 19:20:15.243000') }
|
482
|
+
end
|
483
|
+
context 'with nanosec' do
|
484
|
+
let(:value) { '2012-1-23 10:40:5.243312' }
|
485
|
+
it { is_expected.to eq('2012-01-23 10:40:05.243312') }
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
context 'with apache format value' do
|
490
|
+
let(:value) { '[13/Sep/2006:07:01:53 -0700]' }
|
491
|
+
it { is_expected.to eq('2006-09-13 14:01:53.000000') }
|
492
|
+
end
|
493
|
+
|
494
|
+
context 'with timezone value' do
|
495
|
+
context 'with sec' do
|
496
|
+
let(:value) { '2012-01-23 19:20:15 +0100' }
|
497
|
+
it { is_expected.to eq('2012-01-23 18:20:15.000000') }
|
498
|
+
end
|
499
|
+
|
500
|
+
context 'with millisec' do
|
501
|
+
let(:value) { '2012-1-23 10:40:5.243 +0230' }
|
502
|
+
it { is_expected.to eq('2012-01-23 08:10:05.243000') }
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
506
|
+
context 'with unix epoch time' do
|
507
|
+
context 'with string type' do
|
508
|
+
let(:value) { '1400705967' }
|
509
|
+
it { is_expected.to eq('2014-05-21 20:59:27.000000') }
|
510
|
+
end
|
511
|
+
|
512
|
+
context 'with integer type' do
|
513
|
+
let(:value) { 1400705967 }
|
514
|
+
it { is_expected.to eq('2014-05-21 20:59:27.000000') }
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
context 'with all zero string' do
|
519
|
+
context 'without fraction' do
|
520
|
+
let(:value) { '0000-00-00 00:00:00' }
|
521
|
+
it { is_expected.to eq('0001-01-01 00:00:00.000000') }
|
522
|
+
end
|
523
|
+
|
524
|
+
context 'with fraction' do
|
525
|
+
let(:value) { '0000-00-00 00:00:00.000000' }
|
526
|
+
it { is_expected.to eq('0001-01-01 00:00:00.000000') }
|
527
|
+
end
|
528
|
+
end
|
529
|
+
|
530
|
+
context 'with time value' do
|
531
|
+
context 'when value is positive' do
|
532
|
+
context 'with sec' do
|
533
|
+
let(:value) { '23:01:24' }
|
534
|
+
it { is_expected.to eq('0001-01-01 23:01:24.000000') }
|
535
|
+
end
|
536
|
+
|
537
|
+
context 'with msec' do
|
538
|
+
let(:value) { '23:01:24.123456' }
|
539
|
+
it { is_expected.to eq('0001-01-01 23:01:24.123456') }
|
540
|
+
end
|
541
|
+
end
|
542
|
+
|
543
|
+
context 'when value is bigger than 24 hour' do
|
544
|
+
let(:value) { '28:01:24' }
|
545
|
+
it { is_expected.to eq('0001-01-02 04:01:24.000000') }
|
546
|
+
end
|
547
|
+
|
548
|
+
context 'when value is mysql max value' do
|
549
|
+
let(:value) { '838:59:59' }
|
550
|
+
it { is_expected.to eq('0001-02-04 22:59:59.000000') }
|
551
|
+
end
|
552
|
+
|
553
|
+
context 'when value is mysql min value' do
|
554
|
+
let(:value) { '-838:59:59' }
|
555
|
+
it { is_expected.to eq('0000-11-27 01:00:01.000000') }
|
556
|
+
end
|
557
|
+
|
558
|
+
context 'when value is zero time' do
|
559
|
+
let(:value) { '00:00:00' }
|
560
|
+
it { is_expected.to eq('0001-01-01 00:00:00.000000') }
|
561
|
+
end
|
562
|
+
|
563
|
+
context 'when value is negative' do
|
564
|
+
context 'with sec' do
|
565
|
+
let(:value) { '-03:01:24' }
|
566
|
+
it { is_expected.to eq('0000-12-31 20:58:36.000000') }
|
567
|
+
end
|
568
|
+
|
569
|
+
context 'with msec' do
|
570
|
+
let(:value) { '-03:01:24.123' }
|
571
|
+
it { is_expected.to eq('0000-12-31 20:58:35.876999') } # floating-point arithmetic(only negative value)
|
572
|
+
end
|
573
|
+
|
574
|
+
context 'with nsec' do
|
575
|
+
let(:value) { '-03:01:24.123456' }
|
576
|
+
it { is_expected.to eq('0000-12-31 20:58:35.876543') } # floating-point arithmetic(only negative value)
|
577
|
+
end
|
578
|
+
end
|
579
|
+
end
|
580
|
+
|
581
|
+
context 'with nil value' do
|
582
|
+
let(:value){ nil }
|
583
|
+
it { is_expected.to be_nil }
|
584
|
+
end
|
585
|
+
|
586
|
+
context 'with empty string' do
|
587
|
+
let(:value){ '' }
|
588
|
+
it { is_expected.to be_nil }
|
589
|
+
end
|
590
|
+
|
591
|
+
context 'with invalid value' do
|
592
|
+
let(:value) { 'abcd' }
|
593
|
+
it { expect{subject}.to raise_error(ArgumentError) }
|
594
|
+
end
|
595
|
+
end
|
453
596
|
end
|
454
597
|
|
455
598
|
end
|
data/flydata.gemspec
CHANGED
@@ -2,16 +2,14 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: flydata 0.2.26 ruby lib
|
6
5
|
|
7
6
|
Gem::Specification.new do |s|
|
8
7
|
s.name = "flydata"
|
9
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.27"
|
10
9
|
|
11
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
11
|
s.authors = ["Koichi Fujikawa", "Masashi Miyazaki", "Matthew Luu", "Mak Inada", "Sriram NS"]
|
14
|
-
s.date = "
|
12
|
+
s.date = "2015-01-08"
|
15
13
|
s.description = "FlyData Agent"
|
16
14
|
s.email = "sysadmin@flydata.com"
|
17
15
|
s.executables = ["fdmysqldump", "flydata", "serverinfo"]
|
@@ -146,7 +144,8 @@ Gem::Specification.new do |s|
|
|
146
144
|
]
|
147
145
|
s.homepage = "http://flydata.com/"
|
148
146
|
s.licenses = ["All right reserved."]
|
149
|
-
s.
|
147
|
+
s.require_paths = ["lib"]
|
148
|
+
s.rubygems_version = "2.0.14"
|
150
149
|
s.summary = "FlyData Agent"
|
151
150
|
|
152
151
|
if s.respond_to? :specification_version then
|
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.
|
4
|
+
version: 0.2.27
|
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:
|
15
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rest-client
|
@@ -566,7 +566,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
566
566
|
version: '0'
|
567
567
|
requirements: []
|
568
568
|
rubyforge_project:
|
569
|
-
rubygems_version: 2.
|
569
|
+
rubygems_version: 2.0.14
|
570
570
|
signing_key:
|
571
571
|
specification_version: 4
|
572
572
|
summary: FlyData Agent
|