logstash-input-jdbc 4.3.5 → 4.3.6

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
  SHA256:
3
- metadata.gz: f382c4428bc37a74fdfae0aac1a97eca218555266c01cb76a4c6f6de5e7e3ad1
4
- data.tar.gz: 70d0027fac72146ee098c78f46c7bac8f3d8feb2139f9e6238eb44da1ba3de8f
3
+ metadata.gz: db57db7385391c5b71ad8e3918e2201d95266b2cc07229e25c24c13407b670bd
4
+ data.tar.gz: 59a3aa5b8ebdc0dfe720f24c47d7be493ffd1966078fa672aa950246edfd68c3
5
5
  SHA512:
6
- metadata.gz: 471770e1b701221c9e0b5897c00313276a28f138a5831c9f1a027ca0655951115542a19edc32a4f4bbe634d9a96f969cc45e9d48d4269f72a1780ad6063b468b
7
- data.tar.gz: af300cbd6b078c2d9efcfefc5482480a21e020708fd8e71036c234183dd81e734ab1775b69c9810f0f8e1d13d04dae485979b46857d8d7d773a533b9413b550b
6
+ metadata.gz: 391446d84ff005ca302cb7bd2a07b40c00e9fb75a870a5b9835e8b80b7f2b58fdaaa0527fcb03e3cb9704f3bbfbfdc6c1aad945da0afaef7a29d31391eb93114
7
+ data.tar.gz: 1ba8c5ccf76bee3a841b139c0fa8c162f549c3002ac47cbfa1a4e6422d3227ae59e4850af25fb441164a3467a766ee30ec03b75c5f88d6ebede7b200611e0afc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.3.6
2
+ - [#274](https://github.com/logstash-plugins/logstash-input-jdbc/issues/274) Fix regression with 4.3.5 that can result in NULL :sql_last_value depending on timestamp format
3
+
1
4
  ## 4.3.5
2
5
  - [#140](https://github.com/logstash-plugins/logstash-input-jdbc/issues/140) Fix long standing bug where setting jdbc_default_timezone loses milliseconds. Force all usage of sql_last_value to be typed according to the settings.
3
6
 
@@ -69,6 +69,8 @@ module LogStash module PluginMixins
69
69
  def set_value(value)
70
70
  if value.respond_to?(:to_datetime)
71
71
  @value = value.to_datetime
72
+ else
73
+ @value = DateTime.parse(value)
72
74
  end
73
75
  end
74
76
  end
@@ -81,6 +83,8 @@ module LogStash module PluginMixins
81
83
  def set_value(value)
82
84
  if value.respond_to?(:to_time)
83
85
  @value = value.to_time
86
+ else
87
+ @value = DateTime.parse(value).to_time
84
88
  end
85
89
  end
86
90
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-jdbc'
3
- s.version = '4.3.5'
3
+ s.version = '4.3.6'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Creates events from JDBC data"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -259,6 +259,8 @@ describe LogStash::Inputs::Jdbc do
259
259
  end
260
260
 
261
261
  plugin.stop
262
+ runner.join
263
+ Timecop.return
262
264
  end
263
265
 
264
266
  end
@@ -739,6 +741,65 @@ describe LogStash::Inputs::Jdbc do
739
741
  end
740
742
  end
741
743
 
744
+ context "when previous runs are to be respected upon successful query execution (by time string)" do
745
+
746
+ let(:settings) do
747
+ { "statement" => "SELECT custom_time FROM test_table WHERE custom_time > :sql_last_value",
748
+ "use_column_value" => true,
749
+ "tracking_column" => "custom_time",
750
+ "tracking_column_type" => "timestamp",
751
+ "last_run_metadata_path" => Stud::Temporary.pathname }
752
+ end
753
+
754
+ let(:last_run_time) { '2010-03-19T14:48:40.483Z' }
755
+
756
+ before do
757
+ File.write(settings["last_run_metadata_path"], YAML.dump(last_run_time))
758
+ test_table = db[:test_table]
759
+ test_table.insert(:num => 0, :custom_time => Time.now.utc)
760
+ plugin.register
761
+ end
762
+
763
+ after do
764
+ plugin.stop
765
+ end
766
+
767
+ it "should respect last run metadata" do
768
+ plugin.run(queue)
769
+ expect(plugin.instance_variable_get("@value_tracker").value).to be > DateTime.parse(last_run_time).to_time
770
+ end
771
+ end
772
+
773
+ context "when previous runs are to be respected upon successful query execution (by date/time string)" do
774
+
775
+ let(:settings) do
776
+ { "statement" => "SELECT custom_time FROM test_table WHERE custom_time > :sql_last_value",
777
+ "use_column_value" => true,
778
+ "tracking_column" => "custom_time",
779
+ "tracking_column_type" => "timestamp",
780
+ "jdbc_default_timezone" => "UTC", #this triggers the last_run_time to be treated as date/time
781
+ "last_run_metadata_path" => Stud::Temporary.pathname }
782
+ end
783
+
784
+ let(:last_run_time) { '2010-03-19T14:48:40.483Z' }
785
+
786
+ before do
787
+ File.write(settings["last_run_metadata_path"], YAML.dump(last_run_time))
788
+ test_table = db[:test_table]
789
+ test_table.insert(:num => 0, :custom_time => Time.now.utc)
790
+ plugin.register
791
+ end
792
+
793
+ after do
794
+ plugin.stop
795
+ end
796
+
797
+ it "should respect last run metadata" do
798
+ plugin.run(queue)
799
+ expect(plugin.instance_variable_get("@value_tracker").value).to be > DateTime.parse(last_run_time)
800
+ end
801
+ end
802
+
742
803
  context "when previous runs are to be respected upon successful query execution (by column)" do
743
804
 
744
805
  let(:settings) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-jdbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.5
4
+ version: 4.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-27 00:00:00.000000000 Z
11
+ date: 2018-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement