groonga-query-log 1.7.8 → 1.7.9

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -4
  3. data/doc/text/check-crash.md +152 -0
  4. data/doc/text/news.md +22 -0
  5. data/groonga-query-log.gemspec +4 -2
  6. data/lib/groonga-query-log/command/check-crash.rb +233 -74
  7. data/lib/groonga-query-log/command/show-running-queries.rb +1 -1
  8. data/lib/groonga-query-log/version.rb +1 -1
  9. data/test/command/test-check-crash.rb +584 -0
  10. data/test/command/test-format-regression-test-logs.rb +4 -4
  11. data/test/fixtures/check-crash/process/crash.log +29 -0
  12. data/test/fixtures/check-crash/process/leak.log +27 -0
  13. data/test/fixtures/check-crash/process/normal.log +27 -0
  14. data/test/fixtures/check-crash/query/column_create/flushed/only-opened.log +8 -0
  15. data/test/fixtures/check-crash/query/column_create/flushed/recursive-yes.log +8 -0
  16. data/test/fixtures/check-crash/query/column_create/flushed/target-name-recursive-dependent.log +8 -0
  17. data/test/fixtures/check-crash/query/column_create/unfinished.log +2 -0
  18. data/test/fixtures/check-crash/query/column_create/unflushed/no-flush.log +3 -0
  19. data/test/fixtures/check-crash/query/column_create/unflushed/only-opened.log +7 -0
  20. data/test/fixtures/check-crash/query/column_create/unflushed/recursive-no.log +11 -0
  21. data/test/fixtures/check-crash/query/column_create/unflushed/target-name-recursive-no.log +7 -0
  22. data/test/fixtures/check-crash/query/column_create/unflushed/target-name-recursive-yes.log +7 -0
  23. data/test/fixtures/check-crash/query/delete/flushed/only-opened.log +9 -0
  24. data/test/fixtures/check-crash/query/delete/flushed/recursive-yes.log +8 -0
  25. data/test/fixtures/check-crash/query/delete/flushed/target-name-recursive-dependent.log +8 -0
  26. data/test/fixtures/check-crash/query/delete/unfinished.log +3 -0
  27. data/test/fixtures/check-crash/query/delete/unflushed/no-flush.log +4 -0
  28. data/test/fixtures/check-crash/query/delete/unflushed/only-opened.log +8 -0
  29. data/test/fixtures/check-crash/query/delete/unflushed/recursive-no.log +12 -0
  30. data/test/fixtures/check-crash/query/delete/unflushed/target-name-recursive-no.log +8 -0
  31. data/test/fixtures/check-crash/query/delete/unflushed/target-name-recursive-yes.log +8 -0
  32. data/test/fixtures/check-crash/query/load/flushed/columns-only-opened.log +9 -0
  33. data/test/fixtures/check-crash/query/load/flushed/columns-target-name-recursive-dependent.log +9 -0
  34. data/test/fixtures/check-crash/query/load/flushed/only-opened.log +9 -0
  35. data/test/fixtures/check-crash/query/load/flushed/recursive-yes.log +8 -0
  36. data/test/fixtures/check-crash/query/load/flushed/target-name-recursive-dependent.log +8 -0
  37. data/test/fixtures/check-crash/query/load/unfinished.log +3 -0
  38. data/test/fixtures/check-crash/query/load/unflushed/columns-only-opened.log +8 -0
  39. data/test/fixtures/check-crash/query/load/unflushed/columns-target-name-recursive-dependent.log +8 -0
  40. data/test/fixtures/check-crash/query/load/unflushed/no-flush.log +4 -0
  41. data/test/fixtures/check-crash/query/load/unflushed/only-opened.log +8 -0
  42. data/test/fixtures/check-crash/query/load/unflushed/recursive-no.log +12 -0
  43. data/test/fixtures/check-crash/query/load/unflushed/target-name-recursive-no.log +8 -0
  44. data/test/fixtures/check-crash/query/load/unflushed/target-name-recursive-yes.log +8 -0
  45. data/test/fixtures/check-crash/query/select/flushed/only-opened.log +12 -0
  46. data/test/fixtures/check-crash/query/select/flushed/recursive-yes.log +11 -0
  47. data/test/fixtures/check-crash/query/select/flushed/target-name-recursive-dependent.log +11 -0
  48. data/test/fixtures/check-crash/query/select/unfinished.log +5 -0
  49. data/test/fixtures/check-crash/query/select/unflushed/no-flush.log +6 -0
  50. data/test/fixtures/check-crash/query/select/unflushed/no-load.log +5 -0
  51. data/test/fixtures/check-crash/query/select/unflushed/only-opened.log +10 -0
  52. data/test/fixtures/check-crash/query/select/unflushed/recursive-no.log +14 -0
  53. data/test/fixtures/check-crash/query/select/unflushed/target-name-recursive-no.log +10 -0
  54. data/test/fixtures/check-crash/query/select/unflushed/target-name-recursive-yes.log +10 -0
  55. data/test/fixtures/check-crash/query/table_create/flushed/only-opened.log +8 -0
  56. data/test/fixtures/check-crash/query/table_create/flushed/recursive-yes.log +7 -0
  57. data/test/fixtures/check-crash/query/table_create/flushed/target-name-recursive-dependent.log +7 -0
  58. data/test/fixtures/check-crash/query/table_create/unflushed/no-flush.log +4 -0
  59. data/test/fixtures/check-crash/query/table_create/unflushed/only-opened.log +7 -0
  60. data/test/fixtures/check-crash/query/table_create/unflushed/recursive-no.log +11 -0
  61. data/test/fixtures/check-crash/query/table_create/unflushed/target-name-recursive-no.log +7 -0
  62. data/test/fixtures/check-crash/query/table_create/unflushed/target-name-recursive-yes.log +7 -0
  63. data/test/fixtures/check-crash/query/truncate/flushed/only-opened.log +8 -0
  64. data/test/fixtures/check-crash/query/truncate/flushed/recursive-yes.log +7 -0
  65. data/test/fixtures/check-crash/query/truncate/flushed/target-name-recursive-dependent.log +7 -0
  66. data/test/fixtures/check-crash/query/truncate/unflushed/no-flush.log +3 -0
  67. data/test/fixtures/check-crash/query/truncate/unflushed/only-opened.log +7 -0
  68. data/test/fixtures/check-crash/query/truncate/unflushed/recursive-no.log +11 -0
  69. data/test/fixtures/check-crash/query/truncate/unflushed/target-name-recursive-no.log +7 -0
  70. data/test/fixtures/check-crash/query/truncate/unflushed/target-name-recursive-yes.log +7 -0
  71. data/test/fixtures/reporter/json-stream.expected +1 -1
  72. data/test/fixtures/reporter/json.expected +1 -1
  73. data/test/helper.rb +1 -2
  74. metadata +160 -11
  75. data/test/fixtures/run-regression-test/results/query.log.log +0 -0
@@ -0,0 +1,584 @@
1
+ # Copyright (C) 2026 Abe Tomoaki <abe@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "groonga-query-log/command/check-crash"
18
+
19
+ class CheckCrashCommandTest < Test::Unit::TestCase
20
+ include Helper::Command
21
+ include Helper::Path
22
+
23
+ def setup
24
+ @command = GroongaQueryLog::Command::CheckCrash.new
25
+ end
26
+
27
+ def fixture_path(*components)
28
+ super("check-crash", *components)
29
+ end
30
+
31
+ def crash_log_path
32
+ fixture_path("process", "crash.log")
33
+ end
34
+
35
+ def run_command(*command_line)
36
+ super(@command, command_line)
37
+ end
38
+
39
+ def test_no_target_logs
40
+ output = <<-OUTPUT
41
+ Usage: run-test [options] LOG1 ...
42
+ --command-format=FORMAT Specify the output format of the Groonga command that had a problem. [command]
43
+ (command, uri)
44
+ --[no-]pretty-print Specify to make command output easier to read. [true]
45
+ Only available when `--command-format=command` is specified.
46
+ --output-level=LEVEL Specify the output level. [info]
47
+ Specifying 'debug' displays detailed information.
48
+ (info, debug)
49
+ OUTPUT
50
+ assert_equal([false, output],
51
+ run_command())
52
+ end
53
+
54
+ def test_not_exist_path
55
+ error = assert_raise(Errno::ENOENT) do
56
+ run_command("/path/to/nonexistent")
57
+ end
58
+ assert_equal("No such file or directory @ rb_sysopen - /path/to/nonexistent",
59
+ error.message)
60
+ end
61
+
62
+ class FormatInfoTest < self
63
+ def expected(unflushed_command)
64
+ <<-OUTPUT
65
+
66
+ !!!
67
+ !!! Important entries
68
+ !!!
69
+ It contained logs that require checking.
70
+ If you need help, please feel free to contact the community: https://groonga.org/docs/community.html
71
+ ===
72
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: -- CRASHED!!! --
73
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: ...trace
74
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: ----------------
75
+ ===
76
+
77
+ !!!
78
+ !!! [unflushed] Recovery information
79
+ !!!
80
+ There may be commands that were not flushed between 2000-01-01T00:00:00+09:00 and 2000-01-01T12:00:00+09:00.
81
+ These commands may not have been written to the database files, so please re-run them.
82
+ ===
83
+ [unflushed] 2000-01-01T00:00:01+09:00: #{unflushed_command}
84
+ ===
85
+
86
+ Summary:
87
+ crashed:yes, unflushed:yes, unfinished:no, leak:no
88
+ NG: Please check the display and logs.
89
+ OUTPUT
90
+ end
91
+
92
+ def test_command_format_pretty_print
93
+ assert_equal([true, expected("\nload \\\n --table \"Data\"")],
94
+ run_command("--command-format=command",
95
+ fixture_path("process", "crash.log"),
96
+ fixture_path("query", "load", "unflushed", "no-flush.log")))
97
+ end
98
+
99
+ def test_command_format_one_line
100
+ assert_equal([true, expected("load --table \"Data\"")],
101
+ run_command("--command-format=command",
102
+ "--no-pretty-print",
103
+ crash_log_path,
104
+ fixture_path("query", "load", "unflushed", "no-flush.log")))
105
+ end
106
+
107
+ def test_uri_format
108
+ assert_equal([true, expected("/d/load?table=Data")],
109
+ run_command("--command-format=uri",
110
+ crash_log_path,
111
+ fixture_path("query", "load", "unflushed", "no-flush.log")))
112
+ end
113
+ end
114
+
115
+ class OutputLevelInfoTest < self
116
+ def test_normal
117
+ output = <<-OUTPUT
118
+
119
+ Summary:
120
+ crashed:no, unflushed:no, unfinished:no, leak:no
121
+ OK: no problems.
122
+ OUTPUT
123
+ assert_equal([true, output],
124
+ run_command(fixture_path("process", "normal.log"),
125
+ fixture_path("query", "load", "flushed", "only-opened.log")))
126
+ end
127
+
128
+ # todo: add other tests
129
+ end
130
+
131
+ class OutputLevelDebugTest < self
132
+ def run_command(*command_line)
133
+ command_line.push("--output-level=debug")
134
+ command_line.push("--command-format=uri")
135
+ super(*command_line)
136
+ end
137
+
138
+ def test_normal
139
+ output = <<-OUTPUT
140
+ #{[
141
+ :process,
142
+ :success,
143
+ "99.9.9",
144
+ "2000-01-01T00:00:00+09:00",
145
+ "2000-01-01T00:00:10+09:00",
146
+ nil,
147
+ fixture_path("process", "normal.log"),
148
+ fixture_path("process", "normal.log"),
149
+ ].inspect}
150
+
151
+ Summary:
152
+ crashed:no, unflushed:no, unfinished:no, leak:no
153
+ OK: no problems.
154
+ OUTPUT
155
+ assert_equal([true, output],
156
+ run_command(fixture_path("process", "normal.log"),
157
+ fixture_path("query", "load", "flushed", "only-opened.log")))
158
+ end
159
+
160
+ def test_leak
161
+ output = <<-OUTPUT
162
+ #{[
163
+ :process,
164
+ :success,
165
+ "99.9.9",
166
+ "2000-01-01T00:00:00+09:00",
167
+ "2000-01-01T00:00:10+09:00",
168
+ nil,
169
+ fixture_path("process", "leak.log"),
170
+ fixture_path("process", "leak.log"),
171
+ ].inspect}
172
+ #{[
173
+ :leak,
174
+ "99.9.9",
175
+ 3,
176
+ "2000-01-01T00:00:10+09:00",
177
+ nil,
178
+ fixture_path("process", "leak.log"),
179
+ ].inspect}
180
+
181
+ Summary:
182
+ crashed:no, unflushed:no, unfinished:no, leak:yes
183
+ NG: Please check the display and logs.
184
+ OUTPUT
185
+ assert_equal([true, output],
186
+ run_command(fixture_path("process", "leak.log"),
187
+ fixture_path("query", "load", "flushed", "only-opened.log")))
188
+ end
189
+
190
+ sub_test_case("unfinished") do
191
+ def expected(unfinished_command)
192
+ <<-OUTPUT
193
+ #{[
194
+ :process,
195
+ :crashed,
196
+ "99.9.9",
197
+ "2000-01-01T00:00:00+09:00",
198
+ "2000-01-01T12:00:00+09:00",
199
+ 1,
200
+ fixture_path("process", "crash.log"),
201
+ fixture_path("process", "crash.log"),
202
+ ].inspect}
203
+
204
+ !!!
205
+ !!! Important entries
206
+ !!!
207
+ It contained logs that require checking.
208
+ If you need help, please feel free to contact the community: https://groonga.org/docs/community.html
209
+ ===
210
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: -- CRASHED!!! --
211
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: ...trace
212
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: ----------------
213
+ ===
214
+
215
+ !!!
216
+ !!! [unfinished] Recovery information
217
+ !!!
218
+ Unfinished commands were found due to abnormal termination or other issues.
219
+ It is safer to rebuild the target tables, columns, and indexes because the data may be corrupted.
220
+ ===
221
+ [unfinished] 2000-01-01T00:00:01+09:00: #{unfinished_command}
222
+ ===
223
+
224
+ Summary:
225
+ crashed:yes, unflushed:no, unfinished:yes, leak:no
226
+ NG: Please check the display and logs.
227
+ OUTPUT
228
+ end
229
+
230
+ data(
231
+ load: { command: "load", unfinished_command: "/d/load?table=Data" },
232
+ delete: { command: "delete", unfinished_command: "/d/delete?key=2&table=Data" },
233
+ column_create: {
234
+ command: "column_create",
235
+ unfinished_command: "/d/column_create?flags=COLUMN_INDEX%7CWITH_POSITION&name=blog_title&source=title&table=Terms&type=Site",
236
+ },
237
+ select_load: {
238
+ command: "select",
239
+ unfinished_command: "/d/select?load_columns=_key%2Ccount&load_table=Data&load_values=_key%2Ccount&table=Raw",
240
+ },
241
+ )
242
+ def test_unfinished
243
+ assert_equal([true, expected(data[:unfinished_command])],
244
+ run_command(crash_log_path,
245
+ fixture_path("query", data[:command], "unfinished.log")))
246
+ end
247
+ end
248
+
249
+ sub_test_case("flushed") do
250
+ def expected
251
+ <<-OUTPUT
252
+ #{[
253
+ :process,
254
+ :crashed,
255
+ "99.9.9",
256
+ "2000-01-01T00:00:00+09:00",
257
+ "2000-01-01T12:00:00+09:00",
258
+ 1,
259
+ fixture_path("process", "crash.log"),
260
+ fixture_path("process", "crash.log"),
261
+ ].inspect}
262
+
263
+ !!!
264
+ !!! Important entries
265
+ !!!
266
+ It contained logs that require checking.
267
+ If you need help, please feel free to contact the community: https://groonga.org/docs/community.html
268
+ ===
269
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: -- CRASHED!!! --
270
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: ...trace
271
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: ----------------
272
+ ===
273
+
274
+ Summary:
275
+ crashed:yes, unflushed:no, unfinished:no, leak:no
276
+ NG: Please check the display and logs.
277
+ OUTPUT
278
+ end
279
+
280
+ data(
281
+ # load
282
+ "command:load flush:target-name&recursive=dependent": {
283
+ command: "load",
284
+ flush_case: "target-name-recursive-dependent",
285
+ },
286
+ "command:load flush:only-opened": { command: "load", flush_case: "only-opened" },
287
+ "command:load flush:recursive=yes": { command: "load", flush_case: "recursive-yes" },
288
+ "command:load&columns flush:only-opened": { command: "load", flush_case: "columns-only-opened" },
289
+ "command:load&columns flushtarget-name&recursive=dependent:": {
290
+ command: "load",
291
+ flush_case: "columns-target-name-recursive-dependent",
292
+ },
293
+ # delete
294
+ "command:delete flush:target-name&recursive=dependent": {
295
+ command: "delete",
296
+ flush_case: "target-name-recursive-dependent",
297
+ },
298
+ "command:delete flush:only-opened": { command: "delete", flush_case: "only-opened" },
299
+ "command:delete flush:recursive=yes": { command: "delete", flush_case: "recursive-yes" },
300
+ # truncate
301
+ "command:truncate flush:target-name&recursive=dependent": {
302
+ command: "truncate",
303
+ flush_case: "target-name-recursive-dependent",
304
+ },
305
+ "command:truncate flush:only-opened": { command: "truncate", flush_case: "only-opened" },
306
+ "command:truncate flush:recursive=yes": { command: "truncate", flush_case: "recursive-yes" },
307
+ # table_create
308
+ "command:table_create flush:target-name&recursive=dependent": {
309
+ command: "table_create",
310
+ flush_case: "target-name-recursive-dependent",
311
+ },
312
+ "command:table_create flush:only-opened": { command: "table_create", flush_case: "only-opened" },
313
+ "command:table_create flush:recursive=yes": { command: "table_create", flush_case: "recursive-yes" },
314
+ # column_create
315
+ "command:column_create flush:target-name&recursive=dependent": {
316
+ command: "column_create",
317
+ flush_case: "target-name-recursive-dependent",
318
+ },
319
+ "command:column_create flush:only-opened": { command: "column_create", flush_case: "only-opened" },
320
+ "command:column_create flush:recursive=yes": { command: "column_create", flush_case: "recursive-yes" },
321
+ # select (with load)
322
+ "command:select-load flush:target-name&recursive=dependent": {
323
+ command: "select",
324
+ flush_case: "target-name-recursive-dependent",
325
+ },
326
+ "command:select-load flush:only-opened": { command: "select", flush_case: "only-opened" },
327
+ "command:select-load flush:recursive=yes": { command: "select", flush_case: "recursive-yes" },
328
+ )
329
+ def test_flushed(data)
330
+ assert_equal([true, expected],
331
+ run_command(crash_log_path,
332
+ fixture_path("query", data[:command], "flushed", "#{data[:flush_case]}.log")))
333
+ end
334
+ end
335
+
336
+ sub_test_case("unflushed") do
337
+ def expected(unflushed_command)
338
+ <<-OUTPUT
339
+ #{[
340
+ :process,
341
+ :crashed,
342
+ "99.9.9",
343
+ "2000-01-01T00:00:00+09:00",
344
+ "2000-01-01T12:00:00+09:00",
345
+ 1,
346
+ fixture_path("process", "crash.log"),
347
+ fixture_path("process", "crash.log"),
348
+ ].inspect}
349
+
350
+ !!!
351
+ !!! Important entries
352
+ !!!
353
+ It contained logs that require checking.
354
+ If you need help, please feel free to contact the community: https://groonga.org/docs/community.html
355
+ ===
356
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: -- CRASHED!!! --
357
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: ...trace
358
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: ----------------
359
+ ===
360
+
361
+ !!!
362
+ !!! [unflushed] Recovery information
363
+ !!!
364
+ There may be commands that were not flushed between 2000-01-01T00:00:00+09:00 and 2000-01-01T12:00:00+09:00.
365
+ These commands may not have been written to the database files, so please re-run them.
366
+ ===
367
+ [unflushed] 2000-01-01T00:00:01+09:00: #{unflushed_command}
368
+ ===
369
+
370
+ Summary:
371
+ crashed:yes, unflushed:yes, unfinished:no, leak:no
372
+ NG: Please check the display and logs.
373
+ OUTPUT
374
+ end
375
+
376
+ data(
377
+ # load
378
+ "command:load flush:no": {
379
+ command: "load",
380
+ flush_case: "no-flush",
381
+ unflushed_command: "/d/load?table=Data"
382
+ },
383
+ "command:load flush:only-opened": {
384
+ command: "load",
385
+ flush_case: "only-opened",
386
+ unflushed_command: "/d/load?table=Data"
387
+ },
388
+ "command:load flush:recursive=no": {
389
+ command: "load",
390
+ flush_case: "recursive-no",
391
+ unflushed_command: "/d/load?table=Data"
392
+ },
393
+ "command:load flush:target-name&recursive=yes": {
394
+ command: "load",
395
+ flush_case: "target-name-recursive-yes",
396
+ unflushed_command: "/d/load?table=Data"
397
+ },
398
+ "command:load flush:target-name&recursive=no": {
399
+ command: "load",
400
+ flush_case: "target-name-recursive-no",
401
+ unflushed_command: "/d/load?table=Data"
402
+ },
403
+ "command:load&columns flush:only-opened": {
404
+ command: "load",
405
+ flush_case: "columns-only-opened",
406
+ unflushed_command: "/d/load?columns=_key%2Ccount&table=Data"
407
+ },
408
+ "command:load&columns flush:target-name&recursive=dependent": {
409
+ command: "load",
410
+ flush_case: "columns-target-name-recursive-dependent",
411
+ unflushed_command: "/d/load?columns=_key%2Ccount&table=Data"
412
+ },
413
+ # delete
414
+ "command:delete flush:no": {
415
+ command: "delete",
416
+ flush_case: "no-flush",
417
+ unflushed_command: "/d/delete?key=2&table=Data"
418
+ },
419
+ "command:delete flush:only-opened": {
420
+ command: "delete",
421
+ flush_case: "only-opened",
422
+ unflushed_command: "/d/delete?key=2&table=Data"
423
+ },
424
+ "command:delete flush:recursive=no": {
425
+ command: "delete",
426
+ flush_case: "recursive-no",
427
+ unflushed_command: "/d/delete?key=2&table=Data"
428
+ },
429
+ "command:delete flush:target-name&recursive=yes": {
430
+ command: "delete",
431
+ flush_case: "target-name-recursive-yes",
432
+ unflushed_command: "/d/delete?key=2&table=Data"
433
+ },
434
+ "command:delete flush:target-name&recursive=no": {
435
+ command: "delete",
436
+ flush_case: "target-name-recursive-no",
437
+ unflushed_command: "/d/delete?key=2&table=Data"
438
+ },
439
+ # truncate
440
+ "command:truncate flush:no": {
441
+ command: "truncate",
442
+ flush_case: "no-flush",
443
+ unflushed_command: "/d/truncate?target_name=Data"
444
+ },
445
+ "command:truncate flush:only-opened": {
446
+ command: "truncate",
447
+ flush_case: "only-opened",
448
+ unflushed_command: "/d/truncate?target_name=Data"
449
+ },
450
+ "command:truncate flush:recursive=no": {
451
+ command: "truncate",
452
+ flush_case: "recursive-no",
453
+ unflushed_command: "/d/truncate?target_name=Data"
454
+ },
455
+ "command:truncate flush:target-name&recursive=yes": {
456
+ command: "truncate",
457
+ flush_case: "target-name-recursive-yes",
458
+ unflushed_command: "/d/truncate?target_name=Data"
459
+ },
460
+ "command:truncate flush:target-name&recursive=no": {
461
+ command: "truncate",
462
+ flush_case: "target-name-recursive-no",
463
+ unflushed_command: "/d/truncate?target_name=Data"
464
+ },
465
+ # table_create
466
+ "command:table_create flush:no": {
467
+ command: "table_create",
468
+ flush_case: "no-flush",
469
+ unflushed_command: "/d/table_create?flags=TABLE_HASH_KEY&key_type=ShortText&name=Data"
470
+ },
471
+ "command:table_create flush:only-opened": {
472
+ command: "table_create",
473
+ flush_case: "only-opened",
474
+ unflushed_command: "/d/table_create?flags=TABLE_HASH_KEY&key_type=ShortText&name=Data"
475
+ },
476
+ "command:table_create flush:recursive=no": {
477
+ command: "table_create",
478
+ flush_case: "recursive-no",
479
+ unflushed_command: "/d/table_create?flags=TABLE_HASH_KEY&key_type=ShortText&name=Data"
480
+ },
481
+ "command:table_create flush:target-name&recursive=yes": {
482
+ command: "table_create",
483
+ flush_case: "target-name-recursive-yes",
484
+ unflushed_command: "/d/table_create?flags=TABLE_HASH_KEY&key_type=ShortText&name=Data"
485
+ },
486
+ "command:table_create flush:target-name&recursive=no": {
487
+ command: "table_create",
488
+ flush_case: "target-name-recursive-no",
489
+ unflushed_command: "/d/table_create?flags=TABLE_HASH_KEY&key_type=ShortText&name=Data"
490
+ },
491
+ # column_create
492
+ "command:column_create flush:no": {
493
+ command: "column_create",
494
+ flush_case: "no-flush",
495
+ unflushed_command: "/d/column_create?name=count&table=Data&type=Int32"
496
+ },
497
+ "command:column_create flush:only-opened": {
498
+ command: "column_create",
499
+ flush_case: "only-opened",
500
+ unflushed_command: "/d/column_create?name=count&table=Data&type=Int32"
501
+ },
502
+ "command:column_create flush:recursive=no": {
503
+ command: "column_create",
504
+ flush_case: "recursive-no",
505
+ unflushed_command: "/d/column_create?name=count&table=Data&type=Int32"
506
+ },
507
+ "command:column_create flush:target-name&recursive=yes": {
508
+ command: "column_create",
509
+ flush_case: "target-name-recursive-yes",
510
+ unflushed_command: "/d/column_create?name=count&table=Data&type=Int32"
511
+ },
512
+ "command:column_create flush:target-name&recursive=no": {
513
+ command: "column_create",
514
+ flush_case: "target-name-recursive-no",
515
+ unflushed_command: "/d/column_create?name=count&table=Data&type=Int32"
516
+ },
517
+ # select (with load)
518
+ "command:select-load flush:no": {
519
+ command: "select",
520
+ flush_case: "no-flush",
521
+ unflushed_command: "/d/select?load_columns=_key%2Ccount&load_table=Data&load_values=_key%2Ccount&table=Raw",
522
+ },
523
+ "command:select-load flush:only-opened": {
524
+ command: "select",
525
+ flush_case: "only-opened",
526
+ unflushed_command: "/d/select?load_columns=_key%2Ccount&load_table=Data&load_values=_key%2Ccount&table=Raw",
527
+ },
528
+ "command:select-load flush:recursive=no": {
529
+ command: "select",
530
+ flush_case: "recursive-no",
531
+ unflushed_command: "/d/select?load_columns=_key%2Ccount&load_table=Data&load_values=_key%2Ccount&table=Raw",
532
+ },
533
+ "command:select-load flush:target-name&recursive=yes": {
534
+ command: "select",
535
+ flush_case: "target-name-recursive-yes",
536
+ unflushed_command: "/d/select?load_columns=_key%2Ccount&load_table=Data&load_values=_key%2Ccount&table=Raw",
537
+ },
538
+ "command:select-load flush:target-name&recursive=no": {
539
+ command: "select",
540
+ flush_case: "target-name-recursive-no",
541
+ unflushed_command: "/d/select?load_columns=_key%2Ccount&load_table=Data&load_values=_key%2Ccount&table=Raw",
542
+ },
543
+ )
544
+ def test_unflushed(data)
545
+ assert_equal([true, expected(data[:unflushed_command])],
546
+ run_command(crash_log_path,
547
+ fixture_path("query", data[:command], "unflushed", "#{data[:flush_case]}.log")))
548
+ end
549
+ end
550
+
551
+ def test_normal_select
552
+ output = <<-OUTPUT
553
+ #{[
554
+ :process,
555
+ :crashed,
556
+ "99.9.9",
557
+ "2000-01-01T00:00:00+09:00",
558
+ "2000-01-01T12:00:00+09:00",
559
+ 1,
560
+ fixture_path("process", "crash.log"),
561
+ fixture_path("process", "crash.log"),
562
+ ].inspect}
563
+
564
+ !!!
565
+ !!! Important entries
566
+ !!!
567
+ It contained logs that require checking.
568
+ If you need help, please feel free to contact the community: https://groonga.org/docs/community.html
569
+ ===
570
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: -- CRASHED!!! --
571
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: ...trace
572
+ 2000-01-01T12:00:00+09:00: 1: 00000000: critical: ----------------
573
+ ===
574
+
575
+ Summary:
576
+ crashed:yes, unflushed:no, unfinished:no, leak:no
577
+ NG: Please check the display and logs.
578
+ OUTPUT
579
+ assert_equal([true, output],
580
+ run_command(crash_log_path,
581
+ fixture_path("query", "select", "unflushed", "no-load.log")))
582
+ end
583
+ end
584
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2018 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2014-2025 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -47,7 +47,7 @@ Arguments:
47
47
  table: Logs
48
48
  --- old
49
49
  +++ new
50
- @@ -1,5 +1,5 @@
50
+ @@ -1,4 +1,4 @@
51
51
  [[[2],
52
52
  [["_id", "UInt32"], ["message", "Text"]],
53
53
  [1, "log message1"],
@@ -69,7 +69,7 @@ Arguments:
69
69
  table: Logs
70
70
  --- old
71
71
  +++ new
72
- @@ -1,5 +1,5 @@
72
+ @@ -1,4 +1,4 @@
73
73
  [[[2],
74
74
  [["_id", "UInt32"], ["message", "Text"]],
75
75
  [1, "log message1: 焼肉"],
@@ -152,7 +152,7 @@ Arguments:
152
152
  table: Logs
153
153
  --- old
154
154
  +++ new
155
- @@ -1,5 +1,5 @@
155
+ @@ -1,4 +1,4 @@
156
156
  [[[2],
157
157
  [["_id", "UInt32"], ["message", "Text"]],
158
158
  [1, "log message1"],
@@ -0,0 +1,29 @@
1
+ 2000-01-01 00:00:00.000000|n|00001|00000000: grn_init: <99.9.9>
2
+ 2000-01-01 00:00:00.000000|n|00001|00000000: vm.overcommit_memory kernel parameter should be 1: <0>: See INFO level log to resolve this
3
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:2:update:Object:32(type):8
4
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:3:update:Bool:32(type):1
5
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:4:update:Int8:32(type):1
6
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:5:update:UInt8:32(type):1
7
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:6:update:Int16:32(type):2
8
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:7:update:UInt16:32(type):2
9
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:8:update:Int32:32(type):4
10
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:9:update:UInt32:32(type):4
11
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:10:update:Int64:32(type):8
12
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:11:update:UInt64:32(type):8
13
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:12:update:Float:32(type):8
14
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:13:update:Time:32(type):8
15
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:14:update:ShortText:32(type):4096
16
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:15:update:Text:32(type):65536
17
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:16:update:LongText:32(type):2147483648
18
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:17:update:TokyoGeoPoint:32(type):8
19
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:18:update:WGS84GeoPoint:32(type):8
20
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:19:update:Float32:32(type):4
21
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:20:update:BFloat16:32(type):2
22
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:21:update:ShortBinary:32(type):4096
23
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:22:update:Binary:32(type):65536
24
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:23:update:LongBinary:32(type):2147483648
25
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:24:update:JSON:32(type):2147483648
26
+ 2000-01-01 00:00:00.000000|n|00001|00000000: spec:64:update:TokenMecab:33(proc):1
27
+ 2000-01-01 12:00:00.000000|C|00001|00000000: -- CRASHED!!! --
28
+ 2000-01-01 12:00:00.000000|C|00001|00000000: ...trace
29
+ 2000-01-01 12:00:00.000000|C|00001|00000000: ----------------
@@ -0,0 +1,27 @@
1
+ 2000-01-01 00:00:00.000000|n| grn_init: <99.9.9>
2
+ 2000-01-01 00:00:00.000000|n| vm.overcommit_memory kernel parameter should be 1: <0>: See INFO level log to resolve this
3
+ 2000-01-01 00:00:00.000000|n| spec:2:update:Object:32(type):8
4
+ 2000-01-01 00:00:00.000000|n| spec:3:update:Bool:32(type):1
5
+ 2000-01-01 00:00:00.000000|n| spec:4:update:Int8:32(type):1
6
+ 2000-01-01 00:00:00.000000|n| spec:5:update:UInt8:32(type):1
7
+ 2000-01-01 00:00:00.000000|n| spec:6:update:Int16:32(type):2
8
+ 2000-01-01 00:00:00.000000|n| spec:7:update:UInt16:32(type):2
9
+ 2000-01-01 00:00:00.000000|n| spec:8:update:Int32:32(type):4
10
+ 2000-01-01 00:00:00.000000|n| spec:9:update:UInt32:32(type):4
11
+ 2000-01-01 00:00:00.000000|n| spec:10:update:Int64:32(type):8
12
+ 2000-01-01 00:00:00.000000|n| spec:11:update:UInt64:32(type):8
13
+ 2000-01-01 00:00:00.000000|n| spec:12:update:Float:32(type):8
14
+ 2000-01-01 00:00:00.000000|n| spec:13:update:Time:32(type):8
15
+ 2000-01-01 00:00:00.000000|n| spec:14:update:ShortText:32(type):4096
16
+ 2000-01-01 00:00:00.000000|n| spec:15:update:Text:32(type):65536
17
+ 2000-01-01 00:00:00.000000|n| spec:16:update:LongText:32(type):2147483648
18
+ 2000-01-01 00:00:00.000000|n| spec:17:update:TokyoGeoPoint:32(type):8
19
+ 2000-01-01 00:00:00.000000|n| spec:18:update:WGS84GeoPoint:32(type):8
20
+ 2000-01-01 00:00:00.000000|n| spec:19:update:Float32:32(type):4
21
+ 2000-01-01 00:00:00.000000|n| spec:20:update:BFloat16:32(type):2
22
+ 2000-01-01 00:00:00.000000|n| spec:21:update:ShortBinary:32(type):4096
23
+ 2000-01-01 00:00:00.000000|n| spec:22:update:Binary:32(type):65536
24
+ 2000-01-01 00:00:00.000000|n| spec:23:update:LongBinary:32(type):2147483648
25
+ 2000-01-01 00:00:00.000000|n| spec:24:update:JSON:32(type):2147483648
26
+ 2000-01-01 00:00:00.000000|n| spec:64:update:TokenMecab:33(proc):1
27
+ 2000-01-01 00:00:10.000000|n| grn_fin (3)