droonga-engine 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/bin/droonga-engine-absorb-data +200 -86
  4. data/bin/droonga-engine-configure +14 -11
  5. data/bin/droonga-engine-join +178 -59
  6. data/droonga-engine.gemspec +1 -1
  7. data/install.sh +1 -0
  8. data/lib/droonga/buffered_tcp_socket.rb +2 -2
  9. data/lib/droonga/catalog/base.rb +18 -0
  10. data/lib/droonga/catalog/dataset.rb +8 -0
  11. data/lib/droonga/catalog/version1.rb +3 -12
  12. data/lib/droonga/catalog/version2.rb +5 -12
  13. data/lib/droonga/command/droonga_engine.rb +6 -61
  14. data/lib/droonga/command/droonga_engine_service.rb +1 -0
  15. data/lib/droonga/command/droonga_engine_worker.rb +1 -0
  16. data/lib/droonga/command/remote.rb +18 -1
  17. data/lib/droonga/command/serf_event_handler.rb +3 -0
  18. data/lib/droonga/data_absorber.rb +234 -44
  19. data/lib/droonga/distributed_command_planner.rb +5 -5
  20. data/lib/droonga/engine.rb +27 -15
  21. data/lib/droonga/engine/version.rb +1 -1
  22. data/lib/droonga/handler_runner.rb +4 -0
  23. data/lib/droonga/node_status.rb +6 -2
  24. data/lib/droonga/path.rb +8 -14
  25. data/lib/droonga/planner.rb +4 -3
  26. data/lib/droonga/plugin/metadata/handler_action.rb +8 -0
  27. data/lib/droonga/plugins/groonga/column_create.rb +1 -1
  28. data/lib/droonga/plugins/groonga/column_list.rb +23 -1
  29. data/lib/droonga/plugins/groonga/column_remove.rb +1 -1
  30. data/lib/droonga/plugins/groonga/column_rename.rb +1 -1
  31. data/lib/droonga/plugins/groonga/delete.rb +1 -1
  32. data/lib/droonga/plugins/groonga/select.rb +17 -2
  33. data/lib/droonga/plugins/groonga/table_create.rb +26 -1
  34. data/lib/droonga/plugins/groonga/table_remove.rb +1 -1
  35. data/lib/droonga/plugins/search.rb +1 -1
  36. data/lib/droonga/plugins/search/distributed_search_planner.rb +15 -7
  37. data/lib/droonga/processor.rb +3 -2
  38. data/lib/droonga/searcher.rb +31 -15
  39. data/lib/droonga/serf.rb +1 -0
  40. data/lib/droonga/service_installation.rb +2 -2
  41. data/lib/droonga/single_step.rb +2 -2
  42. data/test/command/fixture/event.jsons +3 -2
  43. data/test/command/fixture/user-table.jsons +3 -2
  44. data/test/command/fixture/users.jsons +25 -0
  45. data/test/command/run-test.rb +13 -1
  46. data/test/command/suite/groonga/column_create/scalar.test +3 -2
  47. data/test/command/suite/groonga/column_create/vector.test +3 -2
  48. data/test/command/suite/groonga/column_list/{success.expected → no-key.expected} +0 -0
  49. data/test/command/suite/groonga/column_list/{success.test → no-key.test} +1 -1
  50. data/test/command/suite/groonga/column_list/with-key.expected +96 -0
  51. data/test/command/suite/groonga/column_list/with-key.test +25 -0
  52. data/test/command/suite/groonga/column_remove/success.test +3 -2
  53. data/test/command/suite/groonga/column_remove/unknown-column.test +3 -2
  54. data/test/command/suite/groonga/column_rename/success.test +3 -2
  55. data/test/command/suite/groonga/column_rename/unknown-column.test +3 -2
  56. data/test/command/suite/groonga/delete/duplicated-identifiers.test +3 -2
  57. data/test/command/suite/groonga/delete/no-identifier.test +3 -2
  58. data/test/command/suite/groonga/select/output_columns/default/array.expected +33 -0
  59. data/test/command/suite/groonga/select/output_columns/default/array.test +38 -0
  60. data/test/command/suite/groonga/select/output_columns/nonexistent.expected +28 -0
  61. data/test/command/suite/groonga/select/output_columns/nonexistent.test +26 -0
  62. data/test/command/suite/groonga/table_create/dat-without-key-type.expected +14 -0
  63. data/test/command/suite/groonga/table_create/dat-without-key-type.test +8 -0
  64. data/test/command/suite/groonga/table_create/dat.expected +13 -0
  65. data/test/command/suite/groonga/table_create/dat.test +9 -0
  66. data/test/command/suite/groonga/table_create/hash-without-key-type.expected +14 -0
  67. data/test/command/suite/groonga/table_create/hash-without-key-type.test +8 -0
  68. data/test/command/suite/groonga/table_create/hash.test +3 -2
  69. data/test/command/suite/groonga/table_create/pat-without-key-type.expected +14 -0
  70. data/test/command/suite/groonga/table_create/pat-without-key-type.test +8 -0
  71. data/test/command/suite/groonga/table_create/pat.expected +13 -0
  72. data/test/command/suite/groonga/table_create/pat.test +9 -0
  73. data/test/command/suite/groonga/table_list/success.test +3 -2
  74. data/test/unit/catalog/test_version1.rb +2 -2
  75. data/test/unit/catalog/test_version2.rb +3 -3
  76. data/test/unit/helper.rb +2 -2
  77. data/test/unit/helper/distributed_search_planner_helper.rb +9 -1
  78. data/test/unit/plugins/groonga/select/test_adapter_input.rb +15 -2
  79. data/test/unit/plugins/groonga/test_column_list.rb +119 -4
  80. data/test/unit/plugins/groonga/test_table_create.rb +29 -0
  81. data/test/unit/plugins/search/planner/test_basic.rb +2 -2
  82. data/test/unit/plugins/search/test_planner.rb +10 -2
  83. metadata +43 -8
@@ -0,0 +1,25 @@
1
+ {
2
+ "type": "table_create",
3
+ "dataset": "Default",
4
+ "body": {
5
+ "name" : "User",
6
+ "flags" : "TABLE_PAT_KEY",
7
+ "key_type" : "ShortText"
8
+ }
9
+ }
10
+ {
11
+ "type": "column_create",
12
+ "dataset": "Default",
13
+ "body": {
14
+ "table" : "User",
15
+ "name" : "age",
16
+ "type" : "Int32"
17
+ }
18
+ }
19
+ {
20
+ "type": "column_list",
21
+ "dataset": "Default",
22
+ "body": {
23
+ "table" : "User"
24
+ }
25
+ }
@@ -2,8 +2,9 @@
2
2
  "type": "table_create",
3
3
  "dataset": "Default",
4
4
  "body": {
5
- "name" : "User",
6
- "flags" : "TABLE_PAT_KEY"
5
+ "name" : "User",
6
+ "flags" : "TABLE_PAT_KEY",
7
+ "key_type" : "ShortText"
7
8
  }
8
9
  }
9
10
  {
@@ -2,8 +2,9 @@
2
2
  "type": "table_create",
3
3
  "dataset": "Default",
4
4
  "body": {
5
- "name" : "User",
6
- "flags" : "TABLE_PAT_KEY"
5
+ "name" : "User",
6
+ "flags" : "TABLE_PAT_KEY",
7
+ "key_type" : "ShortText"
7
8
  }
8
9
  }
9
10
  {
@@ -2,8 +2,9 @@
2
2
  "type": "table_create",
3
3
  "dataset": "Default",
4
4
  "body": {
5
- "name" : "User",
6
- "flags" : "TABLE_PAT_KEY"
5
+ "name" : "User",
6
+ "flags" : "TABLE_PAT_KEY",
7
+ "key_type" : "ShortText"
7
8
  }
8
9
  }
9
10
  {
@@ -2,8 +2,9 @@
2
2
  "type": "table_create",
3
3
  "dataset": "Default",
4
4
  "body": {
5
- "name" : "User",
6
- "flags" : "TABLE_PAT_KEY"
5
+ "name" : "User",
6
+ "flags" : "TABLE_PAT_KEY",
7
+ "key_type" : "ShortText"
7
8
  }
8
9
  }
9
10
  {
@@ -2,8 +2,9 @@
2
2
  "type": "table_create",
3
3
  "dataset": "Default",
4
4
  "body": {
5
- "name" : "User",
6
- "flags" : "TABLE_PAT_KEY"
5
+ "name" : "User",
6
+ "flags" : "TABLE_PAT_KEY",
7
+ "key_type" : "ShortText"
7
8
  }
8
9
  }
9
10
  {
@@ -2,8 +2,9 @@
2
2
  "type": "table_create",
3
3
  "dataset": "Default",
4
4
  "body": {
5
- "name" : "User",
6
- "flags" : "TABLE_PAT_KEY"
5
+ "name" : "User",
6
+ "flags" : "TABLE_PAT_KEY",
7
+ "key_type" : "ShortText"
7
8
  }
8
9
  }
9
10
  {
@@ -0,0 +1,33 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 200,
4
+ "type": "select.result",
5
+ "body": [
6
+ [
7
+ 0,
8
+ 0.0,
9
+ 0.0
10
+ ],
11
+ [
12
+ [
13
+ [
14
+ 1
15
+ ],
16
+ [
17
+ [
18
+ "_id",
19
+ "UInt32"
20
+ ],
21
+ [
22
+ "message",
23
+ "Text"
24
+ ]
25
+ ],
26
+ [
27
+ 1,
28
+ "Droonga is started."
29
+ ]
30
+ ]
31
+ ]
32
+ ]
33
+ }
@@ -0,0 +1,38 @@
1
+ #@disable-logging
2
+ {
3
+ "dataset": "Default",
4
+ "type": "table_create",
5
+ "body": {
6
+ "name" : "Logs",
7
+ "flags" : "TABLE_NO_KEY"
8
+ }
9
+ }
10
+ {
11
+ "dataset": "Default",
12
+ "type": "column_create",
13
+ "body": {
14
+ "table" : "Logs",
15
+ "name" : "message",
16
+ "flags" : "COLUMN_SCALAR",
17
+ "type" : "Text"
18
+ }
19
+ }
20
+ {
21
+ "dataset": "Default",
22
+ "type": "add",
23
+ "body": {
24
+ "table": "Logs",
25
+ "values": {
26
+ "message": "Droonga is started."
27
+ }
28
+ }
29
+ }
30
+ #@enable-logging
31
+
32
+ {
33
+ "dataset": "Default",
34
+ "type": "select",
35
+ "body": {
36
+ "table": "Logs"
37
+ }
38
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 200,
4
+ "type": "select.result",
5
+ "body": [
6
+ [
7
+ 0,
8
+ 0.0,
9
+ 0.0
10
+ ],
11
+ [
12
+ [
13
+ [
14
+ 1
15
+ ],
16
+ [
17
+ [
18
+ "_id",
19
+ "UInt32"
20
+ ]
21
+ ],
22
+ [
23
+ 1
24
+ ]
25
+ ]
26
+ ]
27
+ ]
28
+ }
@@ -0,0 +1,26 @@
1
+ #@disable-logging
2
+ {
3
+ "dataset": "Default",
4
+ "type": "table_create",
5
+ "body": {
6
+ "name" : "IDs",
7
+ "flags" : "TABLE_NO_KEY"
8
+ }
9
+ }
10
+ {
11
+ "dataset": "Default",
12
+ "type": "add",
13
+ "body": {
14
+ "table": "IDs"
15
+ }
16
+ }
17
+ #@enable-logging
18
+
19
+ {
20
+ "dataset": "Default",
21
+ "type": "select",
22
+ "body": {
23
+ "table": "IDs",
24
+ "output_columns": "_id, _key"
25
+ }
26
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 200,
4
+ "type": "table_create.result",
5
+ "body": [
6
+ [
7
+ -22,
8
+ 0.0,
9
+ 0.0,
10
+ "key_type is required for TABLE_DAT_KEY table"
11
+ ],
12
+ false
13
+ ]
14
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "type": "table_create",
3
+ "dataset": "Default",
4
+ "body": {
5
+ "name" : "User",
6
+ "flags" : "TABLE_DAT_KEY"
7
+ }
8
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 200,
4
+ "type": "table_create.result",
5
+ "body": [
6
+ [
7
+ 0,
8
+ 0.0,
9
+ 0.0
10
+ ],
11
+ true
12
+ ]
13
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "type": "table_create",
3
+ "dataset": "Default",
4
+ "body": {
5
+ "name" : "User",
6
+ "flags" : "TABLE_DAT_KEY",
7
+ "key_type" : "ShortText"
8
+ }
9
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 200,
4
+ "type": "table_create.result",
5
+ "body": [
6
+ [
7
+ -22,
8
+ 0.0,
9
+ 0.0,
10
+ "key_type is required for TABLE_HASH_KEY table"
11
+ ],
12
+ false
13
+ ]
14
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "type": "table_create",
3
+ "dataset": "Default",
4
+ "body": {
5
+ "name" : "User",
6
+ "flags" : "TABLE_HASH_KEY"
7
+ }
8
+ }
@@ -2,7 +2,8 @@
2
2
  "type": "table_create",
3
3
  "dataset": "Default",
4
4
  "body": {
5
- "name" : "User",
6
- "flags" : "TABLE_HASH_KEY"
5
+ "name" : "User",
6
+ "flags" : "TABLE_HASH_KEY",
7
+ "key_type" : "ShortText"
7
8
  }
8
9
  }
@@ -0,0 +1,14 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 200,
4
+ "type": "table_create.result",
5
+ "body": [
6
+ [
7
+ -22,
8
+ 0.0,
9
+ 0.0,
10
+ "key_type is required for TABLE_PAT_KEY table"
11
+ ],
12
+ false
13
+ ]
14
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "type": "table_create",
3
+ "dataset": "Default",
4
+ "body": {
5
+ "name" : "User",
6
+ "flags" : "TABLE_PAT_KEY"
7
+ }
8
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 200,
4
+ "type": "table_create.result",
5
+ "body": [
6
+ [
7
+ 0,
8
+ 0.0,
9
+ 0.0
10
+ ],
11
+ true
12
+ ]
13
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "type": "table_create",
3
+ "dataset": "Default",
4
+ "body": {
5
+ "name" : "User",
6
+ "flags" : "TABLE_PAT_KEY",
7
+ "key_type" : "ShortText"
8
+ }
9
+ }
@@ -2,8 +2,9 @@
2
2
  "type": "table_create",
3
3
  "dataset": "Default",
4
4
  "body": {
5
- "name" : "User",
6
- "flags" : "TABLE_PAT_KEY"
5
+ "name" : "User",
6
+ "flags" : "TABLE_PAT_KEY",
7
+ "key_type" : "ShortText"
7
8
  }
8
9
  }
9
10
  {
@@ -46,13 +46,13 @@ class CatalogVersion1Test < Test::Unit::TestCase
46
46
  partitions = @catalog.get_partitions("localhost:23003/test")
47
47
  assert_equal({
48
48
  "localhost:23003/test.000" => {
49
- :database => "#{base_path}/database/000/db",
49
+ :database => "#{base_path}/databases/000/db",
50
50
  :dataset => "Test",
51
51
  :plugins => ["for_dataset"],
52
52
  :n_workers => 0
53
53
  },
54
54
  "localhost:23003/test.002" => {
55
- :database => "#{base_path}/database/002/db",
55
+ :database => "#{base_path}/databases/002/db",
56
56
  :dataset => "Test",
57
57
  :plugins => ["for_dataset"],
58
58
  :n_workers => 0
@@ -45,19 +45,19 @@ class CatalogVersion2Test < Test::Unit::TestCase
45
45
  slices = @catalog.slices("localhost:23003/test")
46
46
  assert_equal({
47
47
  "localhost:23003/test.000" => {
48
- :database => "#{base_path}/database/000/db",
48
+ :database => "#{base_path}/databases/000/db",
49
49
  :dataset => "Test",
50
50
  :plugins => ["plugin1", "plugin2", "plugin3"],
51
51
  :n_workers => 4,
52
52
  },
53
53
  "localhost:23003/test.001" => {
54
- :database => "#{base_path}/database/001/db",
54
+ :database => "#{base_path}/databases/001/db",
55
55
  :dataset => "Test",
56
56
  :plugins => ["plugin1", "plugin2", "plugin3"],
57
57
  :n_workers => 4,
58
58
  },
59
59
  "localhost:23003/test.002" => {
60
- :database => "#{base_path}/database/002/db",
60
+ :database => "#{base_path}/databases/002/db",
61
61
  :dataset => "Test",
62
62
  :plugins => ["plugin1", "plugin2", "plugin3"],
63
63
  :n_workers => 4,
data/test/unit/helper.rb CHANGED
@@ -23,6 +23,6 @@ require_relative "helper/watch_helper"
23
23
  require_relative "helper/distributed_search_planner_helper"
24
24
 
25
25
  class Test::Unit::TestCase
26
- include Sandbox
27
- include Fixture
26
+ include ::Sandbox
27
+ include ::Fixture
28
28
  end