logstash-integration-jdbc 5.1.8 → 5.1.10
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 +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/logstash/plugin_mixins/jdbc/common.rb +17 -14
- data/logstash-integration-jdbc.gemspec +1 -1
- data/spec/inputs/jdbc_spec.rb +25 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f3116d5abaa413fd73af725208c422a1cf98961ce7095c4d88fd7f14cb6c59d
|
|
4
|
+
data.tar.gz: 0ef2f5fd309236b8ec0e14bb38d275e26b3d2002cdb172a2d30d53682606ddec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d701317b4edbe221b2dd9a66d6e2591a0a78e8b9502373860656a5d95f552eee06ae752904687b58b2dfda274dc7c20e5da3e5bebbefbd98c538c107f49bec7a
|
|
7
|
+
data.tar.gz: 22a9383f113f01025ba2f694cd61845aa4ed08474efc70cb37694993babb9ec7d6ac3d95291bbf2fe5b22835a8923ab1802061d861da2e59d5b0e3041f7b18ed
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 5.1.10
|
|
2
|
+
- Refactor: to explicit Java (driver) class name loading [#96](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/96),
|
|
3
|
+
the change is expected to provide a more robust fix for the driver loading issue [#83](https://github.com/logstash-plugins/logstash-integration-jdbc/issues/83).
|
|
4
|
+
|
|
5
|
+
- Fix: regression due returning the Java driver class [#98](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/98)
|
|
6
|
+
|
|
7
|
+
## 5.1.9 (yanked)
|
|
8
|
+
- Refactor: to explicit Java (driver) class name loading [#96](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/96),
|
|
9
|
+
the change is expected to provide a more robust fix for the driver loading issue [#83](https://github.com/logstash-plugins/logstash-integration-jdbc/issues/83).
|
|
10
|
+
|
|
1
11
|
## 5.1.8
|
|
2
12
|
- Fix the blocking pipeline reload and shutdown when connectivity issues happen [#85](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/85)
|
|
3
13
|
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
require 'jruby'
|
|
1
2
|
|
|
2
3
|
module LogStash module PluginMixins module Jdbc
|
|
3
4
|
module Common
|
|
4
5
|
|
|
5
6
|
private
|
|
6
7
|
|
|
8
|
+
# NOTE: using the JRuby mechanism to load classes (through JavaSupport)
|
|
9
|
+
# makes the lock redundant although it does not hurt to have it around.
|
|
7
10
|
DRIVERS_LOADING_LOCK = java.util.concurrent.locks.ReentrantLock.new()
|
|
8
11
|
|
|
9
12
|
def complete_sequel_opts(defaults = {})
|
|
@@ -30,16 +33,16 @@ module LogStash module PluginMixins module Jdbc
|
|
|
30
33
|
begin
|
|
31
34
|
load_driver_jars
|
|
32
35
|
begin
|
|
33
|
-
@driver_impl =
|
|
34
|
-
rescue
|
|
35
|
-
#
|
|
36
|
+
@driver_impl = load_jdbc_driver_class
|
|
37
|
+
rescue => e # catch java.lang.ClassNotFoundException, potential errors
|
|
38
|
+
# (e.g. ExceptionInInitializerError or LinkageError) won't get caught
|
|
36
39
|
message = if jdbc_driver_library_set?
|
|
37
40
|
"Are you sure you've included the correct jdbc driver in :jdbc_driver_library?"
|
|
38
41
|
else
|
|
39
42
|
":jdbc_driver_library is not set, are you sure you included " +
|
|
40
43
|
"the proper driver client libraries in your classpath?"
|
|
41
44
|
end
|
|
42
|
-
raise LogStash::PluginLoadingError, "#{e}. #{message}
|
|
45
|
+
raise LogStash::PluginLoadingError, "#{e.inspect}. #{message}"
|
|
43
46
|
end
|
|
44
47
|
ensure
|
|
45
48
|
DRIVERS_LOADING_LOCK.unlock()
|
|
@@ -71,16 +74,16 @@ module LogStash module PluginMixins module Jdbc
|
|
|
71
74
|
!@jdbc_driver_library.nil? && !@jdbc_driver_library.empty?
|
|
72
75
|
end
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
end
|
|
77
|
+
def load_jdbc_driver_class
|
|
78
|
+
# sub a potential: 'Java::org::my.Driver' to 'org.my.Driver'
|
|
79
|
+
klass = @jdbc_driver_class.gsub('::', '.').sub(/^Java\./, '')
|
|
80
|
+
# NOTE: JRuby's Java::JavaClass.for_name which considers the custom class-loader(s)
|
|
81
|
+
# in 9.3 the API changed and thus to avoid surprises we go down to the Java API :
|
|
82
|
+
klass = JRuby.runtime.getJavaSupport.loadJavaClass(klass) # throws ClassNotFoundException
|
|
83
|
+
# unfortunately we can not simply return the wrapped java.lang.Class instance as
|
|
84
|
+
# Sequel assumes to be able to do a `driver_class.new` which only works on the proxy,
|
|
85
|
+
org.jruby.javasupport.Java.getProxyClass(JRuby.runtime, klass)
|
|
84
86
|
end
|
|
87
|
+
|
|
85
88
|
end
|
|
86
89
|
end end end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'logstash-integration-jdbc'
|
|
3
|
-
s.version = '5.1.
|
|
3
|
+
s.version = '5.1.10'
|
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
|
5
5
|
s.summary = "Integration with JDBC - input and filter plugins"
|
|
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"
|
data/spec/inputs/jdbc_spec.rb
CHANGED
|
@@ -1620,16 +1620,35 @@ describe LogStash::Inputs::Jdbc do
|
|
|
1620
1620
|
describe "jdbc_driver_class" do
|
|
1621
1621
|
context "when not prefixed with Java::" do
|
|
1622
1622
|
let(:jdbc_driver_class) { "org.apache.derby.jdbc.EmbeddedDriver" }
|
|
1623
|
-
it "loads the class
|
|
1624
|
-
expect
|
|
1625
|
-
plugin.send(:load_driver)
|
|
1623
|
+
it "loads the class" do
|
|
1624
|
+
expect { plugin.send(:load_driver) }.not_to raise_error
|
|
1626
1625
|
end
|
|
1627
1626
|
end
|
|
1628
1627
|
context "when prefixed with Java::" do
|
|
1629
1628
|
let(:jdbc_driver_class) { "Java::org.apache.derby.jdbc.EmbeddedDriver" }
|
|
1630
|
-
it "loads the class
|
|
1631
|
-
expect
|
|
1632
|
-
|
|
1629
|
+
it "loads the class" do
|
|
1630
|
+
expect { plugin.send(:load_driver) }.not_to raise_error
|
|
1631
|
+
end
|
|
1632
|
+
end
|
|
1633
|
+
context "when prefixed with Java." do
|
|
1634
|
+
let(:jdbc_driver_class) { "Java.org::apache::derby::jdbc.EmbeddedDriver" }
|
|
1635
|
+
it "loads the class" do
|
|
1636
|
+
expect { plugin.send(:load_driver) }.not_to raise_error
|
|
1637
|
+
end
|
|
1638
|
+
|
|
1639
|
+
it "can instantiate the returned driver class" do
|
|
1640
|
+
# for drivers where the path through DriverManager fails, Sequel assumes
|
|
1641
|
+
# having a proxied Java class instance (instead of a java.lang.Class) and
|
|
1642
|
+
# does a driver.new.connect https://git.io/JDV6M
|
|
1643
|
+
driver = plugin.send(:load_driver)
|
|
1644
|
+
expect { driver.new }.not_to raise_error
|
|
1645
|
+
end
|
|
1646
|
+
end
|
|
1647
|
+
context "when class name invalid" do
|
|
1648
|
+
let(:jdbc_driver_class) { "org.apache.NonExistentDriver" }
|
|
1649
|
+
it "raises a loading error" do
|
|
1650
|
+
expect { plugin.send(:load_driver) }.to raise_error LogStash::PluginLoadingError,
|
|
1651
|
+
/java.lang.ClassNotFoundException: org.apache.NonExistentDriver/
|
|
1633
1652
|
end
|
|
1634
1653
|
end
|
|
1635
1654
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logstash-integration-jdbc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.1.
|
|
4
|
+
version: 5.1.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elastic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|