[Groonga-commit] groonga/groonga at 62430c9 [master] Add a script that checks tiny index limit with parameters

Back to archive index

Masafumi Yokoyama yokoy****@clear*****
Thu Aug 18 17:28:55 JST 2016


横山です。

 > +  ENV["GRN_II_MAX_N_SEGMENTS_TINY"] = max_n_segments&.to_s
 > +  ENV["GRN_II_MAX_N_CHUNKS_TINY"] = max_n_chunks&.to_s

ぼっち演算子(&.)が使われているということは、Ruby 
2.3以降で動かす前提でしょうか?

スクリプト内の他の箇所ではハッシュロケット(=>)が使われていて、古いRubyを意識しているようにも見えるので、意図的かどうか気になりました。


On 2016年08月18日 17:18, Kouhei Sutou wrote:
> Author
>     Kouhei Sutou <kou �� clear-code.com>
> Date
>     2016-08-18 17:18:35 +0900 (Thu, 18 Aug 2016)
> New Revision
>     62430c980f234aef3be63d933a22d99974b99eb3
>     <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3>
> Message
>
>     Add a script that checks tiny index limit with parameters
>
> Added files
>
>       * tools/check-tiny-index-limit.rb
>         <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903>
>
> Added: tools/check-tiny-index-limit.rb (+98 -0) 100755
> ===================================================================
>
> ...
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> 	
>
> ...
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903>
> 1
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R1>
> 2
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R2>
> 3
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R3>
> 4
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R4>
> 5
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R5>
> 6
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R6>
> 7
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R7>
> 8
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R8>
> 9
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R9>
> 10
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R10>
> 11
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R11>
> 12
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R12>
> 13
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R13>
> 14
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R14>
> 15
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R15>
> 16
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R16>
> 17
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R17>
> 18
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R18>
> 19
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R19>
> 20
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R20>
> 21
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R21>
> 22
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R22>
> 23
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R23>
> 24
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R24>
> 25
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R25>
> 26
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R26>
> 27
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R27>
> 28
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R28>
> 29
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R29>
> 30
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R30>
> 31
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R31>
> 32
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R32>
> 33
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R33>
> 34
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R34>
> 35
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R35>
> 36
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R36>
> 37
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R37>
> 38
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R38>
> 39
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R39>
> 40
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R40>
> 41
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R41>
> 42
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R42>
> 43
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R43>
> 44
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R44>
> 45
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R45>
> 46
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R46>
> 47
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R47>
> 48
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R48>
> 49
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R49>
> 50
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R50>
> 51
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R51>
> 52
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R52>
> 53
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R53>
> 54
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R54>
> 55
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R55>
> 56
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R56>
> 57
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R57>
> 58
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R58>
> 59
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R59>
> 60
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R60>
> 61
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R61>
> 62
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R62>
> 63
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R63>
> 64
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R64>
> 65
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R65>
> 66
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R66>
> 67
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R67>
> 68
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R68>
> 69
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R69>
> 70
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R70>
> 71
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R71>
> 72
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R72>
> 73
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R73>
> 74
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R74>
> 75
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R75>
> 76
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R76>
> 77
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R77>
> 78
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R78>
> 79
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R79>
> 80
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R80>
> 81
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R81>
> 82
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R82>
> 83
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R83>
> 84
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R84>
> 85
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R85>
> 86
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R86>
> 87
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R87>
> 88
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R88>
> 89
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R89>
> 90
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R90>
> 91
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R91>
> 92
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R92>
> 93
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R93>
> 94
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R94>
> 95
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R95>
> 96
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R96>
> 97
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R97>
> 98
> <https://github.com/groonga/groonga/commit/62430c980f234aef3be63d933a22d99974b99eb3#diff-ae9e61c47d9f85bd2e0dec7d27eba903R98>
>
> 	
>
> @@ -0,0 +1,98 @@
> +#!/usr/bin/env ruby
> +
> +require "fileutils"
> +require "json"
> +
> +def check_max_index(options)
> + max_n_segments = options[:max_n_segments]
> + max_n_chunks = options[:max_n_chunks]
> + n_patterns = options[:n_patterns] || 2
> +
> + ENV["GRN_II_MAX_N_SEGMENTS_TINY"] = max_n_segments&.to_s
> + ENV["GRN_II_MAX_N_CHUNKS_TINY"] = max_n_chunks&.to_s
> +
> + db_dir = "/dev/shm/db"
> + log_path = "#{db_dir}/log"
> + FileUtils.rm_rf(db_dir)
> + FileUtils.mkdir_p(db_dir)
> + command_line = [
> + "groonga",
> + "--log-path", log_path,
> + "-n", "#{db_dir}/db",
> + ]
> + IO.popen(command_line, "r+") do |groonga|
> + groonga.puts("table_create x TABLE_HASH_KEY UInt32")
> + groonga.gets
> + groonga.puts("column_create x y COLUMN_SCALAR UInt32")
> + groonga.gets
> + groonga.puts("table_create a TABLE_PAT_KEY UInt32")
> + groonga.gets
> + groonga.puts("column_create a b COLUMN_INDEX|INDEX_TINY x y")
> + groonga.gets
> +
> + groonga.puts("load --table x")
> + groonga.puts("[")
> + File.open(log_path) do |log|
> + log.seek(0, IO::SEEK_END)
> + log_size = log.size
> + i = 0
> + catch do |abort|
> + loop do
> + y = i + 1
> + n_patterns.times do
> + groonga.print(JSON.generate({"_key" => i, "y" => y}))
> + groonga.puts(",")
> + groonga.flush
> + i += 1
> + if log.size != log_size
> + data = log.read
> + if /\|[Ae]\|/ =~ data
> + parameters = [
> + max_n_segments.inspect,
> + max_n_chunks.inspect,
> + n_patterns.inspect,
> + i,
> + ]
> + puts(parameters.join("\t"))
> + # puts data
> + throw(abort)
> + end
> + log_size = log.size
> + end
> + end
> + end
> + end
> + end
> + groonga.puts("]")
> + groonga.gets
> +
> + groonga.puts("quit")
> + groonga.gets
> + end
> +end
> +
> +puts("N segments\tN chunks\tN patterns\tN records")
> +[
> + [1, 1, 2],
> + [2, 2, 2],
> + [4, 4, 2],
> + [8, 8, 2],
> + [16, 16, 2],
> + [32, 32, 2],
> + [64, 64, 2],
> + [128, 128, 2],
> + [256, 256, 2],
> + [nil, nil, 1],
> + [nil, nil, 2],
> + [nil, nil, 4],
> + [nil, nil, 8],
> + [nil, nil, 16],
> + [nil, nil, 32],
> + [nil, nil, 64],
> + [nil, nil, 128],
> + [nil, nil, 256],
> +].each do |max_n_segments, max_n_chunks, n_parameters|
> + check_max_index(:max_n_segments => max_n_segments,
> + :max_n_chunks => max_n_chunks,
> + :n_patterns => n_parameters)
> +end
>
>
>
> _______________________________________________
> Groonga-commit mailing list
> Groonga-commit �� lists.osdn.me
> http://lists.osdn.me/mailman/listinfo/groonga-commit
>

-- 
横山 昌史 <Masafumi Yokoyama>
E-mail: yokoyama �� clear-code.com
株式会社クリアコード
〒170-0005 東京都豊島区南大塚3-29-9
Tel: 03-5927-9440
Web: http://www.clear-code.com/




More information about the Groonga-commit mailing list
Back to archive index