logstash-integration-jdbc 5.2.0 → 5.2.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5826d365fd1f0f71ef3562e40e51d68b9bf76585bbd536eb5868a56c5bb6aacb
|
4
|
+
data.tar.gz: 5ae08858db8043a0840d7a8578eae295e99b6a1da4ca3ec9239ee0730298188e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 685637b889432ff5378e6c9873a90b183a90337a011d9719c17b6928721fbef01e393b111f35d2d4d19e7a8bc62eeffd98d93964e46494f486b93f7a9b45bff3
|
7
|
+
data.tar.gz: 30f804b0e420b7485da98805e80902ae2d8b33417256938706ba79f0f20fe62d8da2bec9a6c716e50a30f3455f0cb86f6757eef9811e631685f3e620c8c6a604
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 5.2.1
|
2
|
+
- Refactor: isolate paginated normal statement algorithm in a separate handler [#101](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/101)
|
3
|
+
|
1
4
|
## 5.2.0
|
2
5
|
- Added `jdbc_paging_mode` option to choose if use `explicit` pagination in statements and avoid the initial count
|
3
6
|
query or use `auto` to delegate to the underlying library [#95](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/95)
|
@@ -214,7 +214,7 @@ module LogStash module PluginMixins module Jdbc
|
|
214
214
|
open_jdbc_connection
|
215
215
|
sql_last_value = @use_column_value ? @value_tracker.value : Time.now.utc
|
216
216
|
@tracking_column_warning_sent = false
|
217
|
-
@statement_handler.perform_query(@database, @value_tracker.value
|
217
|
+
@statement_handler.perform_query(@database, @value_tracker.value) do |row|
|
218
218
|
sql_last_value = get_column_value(row) if @use_column_value
|
219
219
|
yield extract_values_from(row)
|
220
220
|
end
|
@@ -6,8 +6,12 @@ module LogStash module PluginMixins module Jdbc
|
|
6
6
|
if plugin.use_prepared_statements
|
7
7
|
klass = PreparedStatementHandler
|
8
8
|
else
|
9
|
-
if plugin.jdbc_paging_enabled
|
10
|
-
|
9
|
+
if plugin.jdbc_paging_enabled
|
10
|
+
if plugin.jdbc_paging_mode == "explicit"
|
11
|
+
klass = ExplicitPagingModeStatementHandler
|
12
|
+
else
|
13
|
+
klass = PagedNormalStatementHandler
|
14
|
+
end
|
11
15
|
else
|
12
16
|
klass = NormalStatementHandler
|
13
17
|
end
|
@@ -33,24 +37,14 @@ module LogStash module PluginMixins module Jdbc
|
|
33
37
|
end
|
34
38
|
|
35
39
|
class NormalStatementHandler < StatementHandler
|
36
|
-
# Performs the query,
|
40
|
+
# Performs the query, yielding once per row of data
|
37
41
|
# @param db [Sequel::Database]
|
38
42
|
# @param sql_last_value [Integer|DateTime|Time]
|
39
|
-
# @param jdbc_paging_enabled [Boolean]
|
40
|
-
# @param jdbc_page_size [Integer]
|
41
43
|
# @yieldparam row [Hash{Symbol=>Object}]
|
42
|
-
def perform_query(db, sql_last_value
|
44
|
+
def perform_query(db, sql_last_value)
|
43
45
|
query = build_query(db, sql_last_value)
|
44
|
-
|
45
|
-
|
46
|
-
paged_dataset.each do |row|
|
47
|
-
yield row
|
48
|
-
end
|
49
|
-
end
|
50
|
-
else
|
51
|
-
query.each do |row|
|
52
|
-
yield row
|
53
|
-
end
|
46
|
+
query.each do |row|
|
47
|
+
yield row
|
54
48
|
end
|
55
49
|
end
|
56
50
|
|
@@ -77,14 +71,34 @@ module LogStash module PluginMixins module Jdbc
|
|
77
71
|
end
|
78
72
|
end
|
79
73
|
|
80
|
-
class
|
74
|
+
class PagedNormalStatementHandler < NormalStatementHandler
|
75
|
+
attr_reader :jdbc_page_size
|
76
|
+
|
77
|
+
# Performs the query, respecting our pagination settings, yielding once per row of data
|
78
|
+
# @param db [Sequel::Database]
|
79
|
+
# @param sql_last_value [Integer|DateTime|Time]
|
80
|
+
# @yieldparam row [Hash{Symbol=>Object}]
|
81
|
+
def perform_query(db, sql_last_value)
|
82
|
+
query = build_query(db, sql_last_value)
|
83
|
+
query.each_page(@jdbc_page_size) do |paged_dataset|
|
84
|
+
paged_dataset.each do |row|
|
85
|
+
yield row
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def post_init(plugin)
|
91
|
+
super(plugin)
|
92
|
+
@jdbc_page_size = plugin.jdbc_page_size
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class ExplicitPagingModeStatementHandler < PagedNormalStatementHandler
|
81
97
|
# Performs the query, respecting our pagination settings, yielding once per row of data
|
82
98
|
# @param db [Sequel::Database]
|
83
99
|
# @param sql_last_value [Integer|DateTime|Time]
|
84
|
-
# @param jdbc_paging_enabled [Boolean]
|
85
|
-
# @param jdbc_page_size [Integer]
|
86
100
|
# @yieldparam row [Hash{Symbol=>Object}]
|
87
|
-
def perform_query(db, sql_last_value
|
101
|
+
def perform_query(db, sql_last_value)
|
88
102
|
query = build_query(db, sql_last_value)
|
89
103
|
offset = 0
|
90
104
|
loop do
|
@@ -106,7 +120,7 @@ module LogStash module PluginMixins module Jdbc
|
|
106
120
|
# @param db [Sequel::Database]
|
107
121
|
# @param sql_last_value [Integet|DateTime|Time]
|
108
122
|
# @yieldparam row [Hash{Symbol=>Object}]
|
109
|
-
def perform_query(db, sql_last_value
|
123
|
+
def perform_query(db, sql_last_value)
|
110
124
|
query = build_query(db, sql_last_value)
|
111
125
|
query.each do |row|
|
112
126
|
yield row
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-integration-jdbc'
|
3
|
-
s.version = '5.2.
|
3
|
+
s.version = '5.2.1'
|
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"
|