groonga-query-log 1.2.5 → 1.2.6

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: 667417fb7b63c25c6adb833d1fa0fa109446ecae
4
- data.tar.gz: 164767949783e4afd493d9d78c24e8aa1d52e5c5
3
+ metadata.gz: c26ff585a73f2e6091da363ac4b4fe02aeddf420
4
+ data.tar.gz: 7d9e5c1965f7d3e208257be44893e189dd59a15a
5
5
  SHA512:
6
- metadata.gz: a2e7934dea3d48b4562b8bbc06423afbfe0dc9dce3da064c2fd2bc792e4a05887e0b6f91425e85b697396da95811666190cf3d319271b3a3c9bd0c10c636093c
7
- data.tar.gz: 1108f20380850332eb1328145ac2dd94c436274d2185f9cf99c779e40d2deb03529bc4239029fcf6675c968a6fd06cc1aa3d63f983f30d3782dc837e79d77337
6
+ metadata.gz: 50495861548b4c83bd5d8d7b7ba9aa2e4cca02a809029eec84aa2bce150cca688c5dc77b4fd50fa37447f178481dfcdac7a268d469311385770c40135c3be846
7
+ data.tar.gz: fc6b3040396bcd0443a67c6df6bfeaeccd3aec0713905230d1c139b5f177480d7eaea2bb0750a2a51aa3ac5c1ec7f21d5337987c021576962d17d9984e70b986
data/doc/text/news.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # News
2
2
 
3
+ ## 1.2.6: 2017-05-31
4
+
5
+ ### Improvements
6
+
7
+ * Supported changed query log format since Groonga 7.0.1. The output
8
+ format is changed about dynamic columns, drilldown, labeled
9
+ drilldown, but groonga-query-log still supports previous format.
10
+
11
+ * groonga-query-log-extract: Fixed to ignore empty command not to
12
+ raise exception error.
13
+
14
+ * groonga-query-log-detect-memory-leak
15
+ groonga-query-log-replay: Fixed uninitialized constant error when
16
+ executing command.
17
+
3
18
  ## 1.2.5: 2017-05-08
4
19
 
5
20
  ### Fixes
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "optparse"
20
20
 
21
+ require "groonga/query-log/version"
21
22
  require "groonga/query-log/memory-leak-detector"
22
23
 
23
24
  module Groonga
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "optparse"
20
20
 
21
+ require "groonga/query-log/version"
21
22
  require "groonga/query-log/replayer"
22
23
 
23
24
  module Groonga
@@ -64,13 +64,15 @@ module Groonga
64
64
  def parse_line(time_stamp, context_id, type, rest, &block)
65
65
  case type
66
66
  when ">"
67
+ return if rest.empty?
67
68
  statistic = create_statistic(context_id)
68
69
  statistic.start(time_stamp, rest)
69
70
  @parsing_statistics[context_id] = statistic
70
71
  when ":"
71
- return unless /\A(\d+) (.+)\((\d+)\)/ =~ rest
72
+ return unless /\A(\d+) (.+)\((\d+)\)(\[.+\])?/ =~ rest
72
73
  elapsed = $1
73
74
  name = $2
75
+ name += $4 if $4
74
76
  n_records = $3.to_i
75
77
  statistic = @parsing_statistics[context_id]
76
78
  return if statistic.nil?
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Groonga
18
18
  module QueryLog
19
- VERSION = "1.2.5"
19
+ VERSION = "1.2.6"
20
20
  end
21
21
  end
data/test/test-parser.rb CHANGED
@@ -113,7 +113,7 @@ class ParserTest < Test::Unit::TestCase
113
113
  assert_equal([0], statistics.collect(&:return_code))
114
114
  end
115
115
 
116
- def test_fialure
116
+ def test_failure
117
117
  statistics = parse(<<-LOG)
118
118
  2012-12-13 11:15:21.628105|0x7fff148c8a50|>table_create --name Videos
119
119
  2012-12-13 11:15:21.645119|0x7fff148c8a50|<000000017041150 rc=-22
@@ -121,4 +121,140 @@ class ParserTest < Test::Unit::TestCase
121
121
  assert_equal([-22], statistics.collect(&:return_code))
122
122
  end
123
123
  end
124
+
125
+ class FormatCompatibilityTest < self
126
+ class DynamicColumnsTest < self
127
+ def test_no_labeled_columns
128
+ statistics = parse(<<-LOG)
129
+ 2017-05-30 19:11:37.932576|0x7ffc6ae1ba20|>select Items --columns[price_with_tax].stage initial --columns[price_with_tax].type UInt32 --columns[price_with_tax].flags COLUMN_SCALAR --columns[price_with_tax].value 'price * 1.08' --filter 'price_with_tax > 550'
130
+ 2017-05-30 19:11:37.976349|0x7ffc6ae1ba20|:000000043784801 filter(3)
131
+ 2017-05-30 19:11:37.976383|0x7ffc6ae1ba20|:000000043808671 select(3)
132
+ 2017-05-30 19:11:37.976534|0x7ffc6ae1ba20|:000000043961723 output(3)
133
+ 2017-05-30 19:11:37.976650|0x7ffc6ae1ba20|<000000044078013 rc=0
134
+ LOG
135
+ operations = statistics.first.operations.collect do |operation|
136
+ [operation[:name], operation[:n_records]]
137
+ end
138
+ expected = [
139
+ ["filter", 3],
140
+ ["select", 3],
141
+ ["output", 3]
142
+ ]
143
+ assert_equal(expected, operations)
144
+ end
145
+
146
+ def test_labeled_columns
147
+ statistics = parse(<<-LOG)
148
+ 2017-05-30 19:11:38.036856|0x7fffb7d8d9b0|>select Items --columns[price_with_tax].stage initial --columns[price_with_tax].type UInt32 --columns[price_with_tax].flags COLUMN_SCALAR --columns[price_with_tax].value 'price * 1.08' --filter 'price_with_tax > 550'
149
+ 2017-05-30 19:11:38.037234|0x7fffb7d8d9b0|:000000000381368 columns[price_with_tax](6)
150
+ 2017-05-30 19:11:38.085663|0x7fffb7d8d9b0|:000000048816481 filter(3)
151
+ 2017-05-30 19:11:38.085691|0x7fffb7d8d9b0|:000000048837085 select(3)
152
+ 2017-05-30 19:11:38.085825|0x7fffb7d8d9b0|:000000048972310 output(3)
153
+ 2017-05-30 19:11:38.085929|0x7fffb7d8d9b0|<000000049076026 rc=0
154
+ LOG
155
+ operations = statistics.first.operations.collect do |operation|
156
+ [operation[:name], operation[:n_records]]
157
+ end
158
+ expected = [
159
+ ["columns[price_with_tax]", 6],
160
+ ["filter", 3],
161
+ ["select", 3],
162
+ ["output", 3]
163
+ ]
164
+ assert_equal(expected, operations)
165
+ end
166
+ end
167
+
168
+ class DrilldownTest < self
169
+ def test_no_output_drilldown
170
+ statistics = parse(<<-LOG)
171
+ 2017-05-31 11:22:19.928613|0x7ffe470b0cc0|>select Memos --drilldown tag
172
+ 2017-05-31 11:22:19.928705|0x7ffe470b0cc0|:000000000095083 select(4)
173
+ 2017-05-31 11:22:19.929002|0x7ffe470b0cc0|:000000000393647 output(4)
174
+ 2017-05-31 11:22:19.929040|0x7ffe470b0cc0|:000000000428917 drilldown(3)
175
+ 2017-05-31 11:22:19.929109|0x7ffe470b0cc0|<000000000498630 rc=0
176
+ LOG
177
+ operations = statistics.first.operations.collect do |operation|
178
+ [operation[:name], operation[:n_records]]
179
+ end
180
+ expected = [
181
+ ["select", 4],
182
+ ["output", 4],
183
+ ["drilldown", 3]
184
+ ]
185
+ assert_equal(expected, operations)
186
+ end
187
+
188
+ def test_output_drilldown
189
+ statistics = parse(<<-LOG)
190
+ 2017-05-31 11:22:19.977081|0x7ffec4a59cd0|>select Memos --drilldown tag
191
+ 2017-05-31 11:22:19.977214|0x7ffec4a59cd0|:000000000138164 select(4)
192
+ 2017-05-31 11:22:19.977381|0x7ffec4a59cd0|:000000000304772 drilldown(3)
193
+ 2017-05-31 11:22:19.977572|0x7ffec4a59cd0|:000000000495092 output(4)
194
+ 2017-05-31 11:22:19.977615|0x7ffec4a59cd0|:000000000535908 output.drilldown(3)
195
+ 2017-05-31 11:22:19.977701|0x7ffec4a59cd0|<000000000623964 rc=0
196
+ LOG
197
+ operations = statistics.first.operations.collect do |operation|
198
+ [operation[:name], operation[:n_records]]
199
+ end
200
+ expected = [
201
+ ["select", 4],
202
+ ["drilldown", 3],
203
+ ["output", 4],
204
+ ["output.drilldown", 3]
205
+ ]
206
+ assert_equal(expected, operations)
207
+ end
208
+ end
209
+
210
+ class LabeledDrilldownTest < self
211
+ def test_no_output_drilldown
212
+ statistics = parse(<<-LOG)
213
+ 2017-05-31 11:22:19.683806|0x7ffc1ee41940|>select Shops --drilldown[item].keys items --drilldown[item].sortby price --drilldown[item].output_columns _key,_nsubrecs,price,price_with_tax --drilldown[item].columns[price_with_tax].stage initial --drilldown[item].columns[price_with_tax].type UInt32 --drilldown[item].columns[price_with_tax].flags COLUMN_SCALAR --drilldown[item].columns[price_with_tax].value 'price * 1.08' --drilldown[real_price].table item --drilldown[real_price].keys price_with_tax
214
+ 2017-05-31 11:22:19.683980|0x7ffc1ee41940|:000000000176192 select(3)
215
+ 2017-05-31 11:22:19.684356|0x7ffc1ee41940|:000000000553162 output(3)
216
+ 2017-05-31 11:22:19.684468|0x7ffc1ee41940|:000000000665698 drilldown(6)[item]
217
+ 2017-05-31 11:22:19.684488|0x7ffc1ee41940|:000000000683901 drilldown(3)[real_price]
218
+ 2017-05-31 11:22:19.684558|0x7ffc1ee41940|<000000000754417 rc=0
219
+ LOG
220
+ operations = statistics.first.operations.collect do |operation|
221
+ [operation[:name], operation[:n_records]]
222
+ end
223
+ expected = [
224
+ ["select", 3],
225
+ ["output", 3],
226
+ ["drilldown[item]", 6],
227
+ ["drilldown[real_price]", 3]
228
+ ]
229
+ assert_equal(expected, operations)
230
+ end
231
+
232
+ def test_output_drilldown
233
+ statistics = parse(<<-LOG)
234
+ 2017-05-31 11:22:19.758189|0x7ffd1fc97890|>select Shops --drilldown[item].keys items --drilldown[item].sortby price --drilldown[item].output_columns _key,_nsubrecs,price,price_with_tax --drilldown[item].columns[price_with_tax].stage initial --drilldown[item].columns[price_with_tax].type UInt32 --drilldown[item].columns[price_with_tax].flags COLUMN_SCALAR --drilldown[item].columns[price_with_tax].value 'price * 1.08' --drilldown[real_price].table item --drilldown[real_price].keys price_with_tax
235
+ 2017-05-31 11:22:19.758462|0x7ffd1fc97890|:000000000276579 select(3)
236
+ 2017-05-31 11:22:19.758727|0x7ffd1fc97890|:000000000542224 columns[price_with_tax](6)
237
+ 2017-05-31 11:22:19.758738|0x7ffd1fc97890|:000000000550409 drilldowns[item](6)
238
+ 2017-05-31 11:22:19.758806|0x7ffd1fc97890|:000000000619409 drilldowns[real_price](3)
239
+ 2017-05-31 11:22:19.758915|0x7ffd1fc97890|:000000000729209 output(3)
240
+ 2017-05-31 11:22:19.759015|0x7ffd1fc97890|:000000000829476 output.drilldowns[item](6)
241
+ 2017-05-31 11:22:19.759034|0x7ffd1fc97890|:000000000847090 output.drilldowns[real_price](3)
242
+ 2017-05-31 11:22:19.759103|0x7ffd1fc97890|<000000000916234 rc=0
243
+ LOG
244
+ operations = statistics.first.operations.collect do |operation|
245
+ [operation[:name], operation[:n_records]]
246
+ end
247
+ expected = [
248
+ ["select", 3],
249
+ ["columns[price_with_tax]", 6],
250
+ ["drilldowns[item]", 6],
251
+ ["drilldowns[real_price]", 3],
252
+ ["output", 3],
253
+ ["output.drilldowns[item]", 6],
254
+ ["output.drilldowns[real_price]", 3]
255
+ ]
256
+ assert_equal(expected, operations)
257
+ end
258
+ end
259
+ end
124
260
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-query-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-08 00:00:00.000000000 Z
11
+ date: 2017-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: groonga-command-parser
@@ -154,15 +154,15 @@ description: ''
154
154
  email:
155
155
  - kou@clear-code.com
156
156
  executables:
157
- - groonga-query-log-extract
157
+ - groonga-query-log-show-running-queries
158
158
  - groonga-query-log-run-regression-test
159
- - groonga-query-log-analyze
160
- - groonga-query-log-verify-server
161
159
  - groonga-query-log-check-command-version-compatibility
160
+ - groonga-query-log-analyze
162
161
  - groonga-query-log-detect-memory-leak
163
162
  - groonga-query-log-format-regression-test-logs
164
- - groonga-query-log-show-running-queries
163
+ - groonga-query-log-extract
165
164
  - groonga-query-log-replay
165
+ - groonga-query-log-verify-server
166
166
  extensions: []
167
167
  extra_rdoc_files: []
168
168
  files:
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
261
  version: '0'
262
262
  requirements: []
263
263
  rubyforge_project:
264
- rubygems_version: 2.2.2
264
+ rubygems_version: 2.6.11
265
265
  signing_key:
266
266
  specification_version: 4
267
267
  summary: Groonga-query-log is a collection of library and tools to process [Groonga](http://groonga.org/)'s
@@ -269,33 +269,33 @@ summary: Groonga-query-log is a collection of library and tools to process [Groo
269
269
  as a library. You can analyze your Groonga's queries and test with your Groonga's
270
270
  query log by using groonga-query-log as a tool.
271
271
  test_files:
272
- - test/test-response-comparer.rb
272
+ - test/test-analyzer.rb
273
+ - test/helper.rb
274
+ - test/test-incompatibility-detector.rb
275
+ - test/command/test-format-regression-test-logs.rb
276
+ - test/command/test-extract.rb
273
277
  - test/run-test.rb
274
- - test/test-replayer.rb
275
278
  - test/test-parser.rb
276
- - test/helper.rb
277
- - test/fixtures/query.log
278
- - test/fixtures/n_entries.expected
279
- - test/fixtures/other-query.log
280
279
  - test/fixtures/no-report-summary.expected
280
+ - test/fixtures/target-tables.expected
281
+ - test/fixtures/target-commands.expected
282
+ - test/fixtures/n_entries.expected
281
283
  - test/fixtures/reporter/json-stream.expected
284
+ - test/fixtures/reporter/console.expected
282
285
  - test/fixtures/reporter/json.expected
283
286
  - test/fixtures/reporter/html.expected
284
- - test/fixtures/reporter/console.expected
287
+ - test/fixtures/order/elapsed.expected
288
+ - test/fixtures/order/-elapsed.expected
289
+ - test/fixtures/order/start-time.expected
290
+ - test/fixtures/order/-start-time.expected
285
291
  - test/fixtures/regression-test-logs/command-format.log
286
292
  - test/fixtures/regression-test-logs/url-format.log
287
- - test/fixtures/target-commands.expected
288
- - test/fixtures/multi.expected
289
293
  - test/fixtures/run-regression-test/query-logs/query.log
290
294
  - test/fixtures/run-regression-test/schema/schema.grn
291
295
  - test/fixtures/run-regression-test/indexes/indexes.grn
292
296
  - test/fixtures/run-regression-test/data/data.grn
293
- - test/fixtures/order/-elapsed.expected
294
- - test/fixtures/order/start-time.expected
295
- - test/fixtures/order/-start-time.expected
296
- - test/fixtures/order/elapsed.expected
297
- - test/fixtures/target-tables.expected
298
- - test/command/test-format-regression-test-logs.rb
299
- - test/command/test-extract.rb
300
- - test/test-analyzer.rb
301
- - test/test-incompatibility-detector.rb
297
+ - test/fixtures/other-query.log
298
+ - test/fixtures/multi.expected
299
+ - test/fixtures/query.log
300
+ - test/test-response-comparer.rb
301
+ - test/test-replayer.rb