droonga-engine 1.1.0 → 1.1.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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/Rakefile +6 -0
  4. data/bin/droonga-engine-absorb-data +14 -14
  5. data/bin/droonga-engine-catalog-generate +24 -12
  6. data/bin/droonga-engine-catalog-modify +13 -7
  7. data/bin/droonga-engine-join +8 -8
  8. data/bin/droonga-engine-set-role +1 -1
  9. data/bin/droonga-engine-unjoin +2 -2
  10. data/lib/droonga/address.rb +3 -0
  11. data/lib/droonga/cluster.rb +16 -10
  12. data/lib/droonga/command/droonga_engine_service.rb +5 -2
  13. data/lib/droonga/command/remote_command_base.rb +3 -3
  14. data/lib/droonga/distributed_command_planner.rb +11 -1
  15. data/lib/droonga/engine.rb +12 -11
  16. data/lib/droonga/engine/version.rb +2 -2
  17. data/lib/droonga/engine_node.rb +28 -28
  18. data/lib/droonga/engine_state.rb +41 -36
  19. data/lib/droonga/forward_buffer.rb +21 -10
  20. data/lib/droonga/node_role.rb +2 -0
  21. data/lib/droonga/plugins/groonga/select.rb +3 -0
  22. data/lib/droonga/plugins/search.rb +3 -1
  23. data/lib/droonga/plugins/search/distributed_search_planner.rb +17 -5
  24. data/lib/droonga/plugins/system/statistics.rb +1 -0
  25. data/lib/droonga/searcher.rb +13 -4
  26. data/test/command/config/single_slice/catalog.json +38 -0
  27. data/test/command/config/single_slice/droonga-engine.yaml +4 -0
  28. data/test/command/run-test.rb +3 -2
  29. data/test/command/suite/catalog/fetch.expected.single_slice +50 -0
  30. data/test/command/suite/dump/column/index.expected.single_slice +86 -0
  31. data/test/command/suite/dump/column/scalar.expected.single_slice +52 -0
  32. data/test/command/suite/dump/column/vector.expected.single_slice +55 -0
  33. data/test/command/suite/dump/record/scalar.expected.single_slice +52 -0
  34. data/test/command/suite/dump/record/vector/reference.expected.single_slice +117 -0
  35. data/test/command/suite/dump/table/array.expected.single_slice +39 -0
  36. data/test/command/suite/dump/table/double_array_trie.expected.single_slice +40 -0
  37. data/test/command/suite/dump/table/hash.expected.single_slice +40 -0
  38. data/test/command/suite/dump/table/patricia_trie.expected.single_slice +40 -0
  39. data/test/command/suite/message/error/missing-dataset.test +3 -0
  40. data/test/command/suite/search/condition/query/nonexistent_column.expected.single_slice +26 -0
  41. data/test/command/suite/search/condition/query/syntax_error.expected.single_slice +26 -0
  42. data/test/command/suite/search/error/unknown-source.expected.single_slice +28 -0
  43. data/test/command/suite/search/output/attributes/invalid.expected.single_slice +24 -0
  44. data/test/command/suite/system/absorb-data/records.catalog.json.single_slice +44 -0
  45. data/test/command/suite/system/absorb-data/records.expected.single_slice +32 -0
  46. data/test/command/suite/system/statistics/object/count/per-volume/empty.test +1 -0
  47. data/test/command/suite/system/statistics/object/count/record.expected.single_slice +11 -0
  48. data/test/command/suite/system/statistics/object/count/schema.expected.single_slice +11 -0
  49. data/test/unit/catalog/test_generator.rb +3 -2
  50. data/test/unit/helper.rb +2 -1
  51. data/test/unit/helper/stub_serf.rb +28 -0
  52. data/test/unit/plugins/system/statistics/test_object_count.rb +135 -0
  53. data/test/unit/plugins/system/statistics/test_object_count_per_volume.rb +149 -0
  54. data/test/unit/plugins/test_basic.rb +0 -406
  55. data/test/unit/test_address.rb +111 -10
  56. data/test/unit/test_cluster.rb +232 -0
  57. data/test/unit/test_differ.rb +49 -0
  58. data/test/unit/test_engine_node.rb +556 -0
  59. data/test/unit/test_engine_state.rb +151 -0
  60. data/test/unit/test_forward_buffer.rb +106 -0
  61. data/test/unit/test_node_name.rb +160 -0
  62. data/test/unit/test_node_role.rb +53 -0
  63. data/test/unit/test_reducer.rb +525 -0
  64. metadata +111 -49
@@ -0,0 +1,39 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "dataset": "Default",
4
+ "date": "0000-00-00T00:00:00.000000Z",
5
+ "type": "dump.start"
6
+ }
7
+ {
8
+ "inReplyTo": "request-id",
9
+ "statusCode": 200,
10
+ "type": "dump.result",
11
+ "body": {
12
+ "started": true
13
+ }
14
+ }
15
+ {
16
+ "inReplyTo": "request-id",
17
+ "dataset": "Default",
18
+ "date": "0000-00-00T00:00:00.000000Z",
19
+ "body": {
20
+ "nMessages": 1
21
+ },
22
+ "type": "dump.forecast"
23
+ }
24
+ {
25
+ "inReplyTo": "request-id",
26
+ "dataset": "Default",
27
+ "date": "0000-00-00T00:00:00.000000Z",
28
+ "body": {
29
+ "type": "Array",
30
+ "name": "Logs"
31
+ },
32
+ "type": "dump.table"
33
+ }
34
+ {
35
+ "inReplyTo": "request-id",
36
+ "dataset": "Default",
37
+ "date": "0000-00-00T00:00:00.000000Z",
38
+ "type": "dump.end"
39
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "dataset": "Default",
4
+ "date": "0000-00-00T00:00:00.000000Z",
5
+ "type": "dump.start"
6
+ }
7
+ {
8
+ "inReplyTo": "request-id",
9
+ "statusCode": 200,
10
+ "type": "dump.result",
11
+ "body": {
12
+ "started": true
13
+ }
14
+ }
15
+ {
16
+ "inReplyTo": "request-id",
17
+ "dataset": "Default",
18
+ "date": "0000-00-00T00:00:00.000000Z",
19
+ "body": {
20
+ "nMessages": 1
21
+ },
22
+ "type": "dump.forecast"
23
+ }
24
+ {
25
+ "inReplyTo": "request-id",
26
+ "dataset": "Default",
27
+ "date": "0000-00-00T00:00:00.000000Z",
28
+ "body": {
29
+ "type": "DoubleArrayTrie",
30
+ "name": "Memos",
31
+ "keyType": "ShortText"
32
+ },
33
+ "type": "dump.table"
34
+ }
35
+ {
36
+ "inReplyTo": "request-id",
37
+ "dataset": "Default",
38
+ "date": "0000-00-00T00:00:00.000000Z",
39
+ "type": "dump.end"
40
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "dataset": "Default",
4
+ "date": "0000-00-00T00:00:00.000000Z",
5
+ "type": "dump.start"
6
+ }
7
+ {
8
+ "inReplyTo": "request-id",
9
+ "statusCode": 200,
10
+ "type": "dump.result",
11
+ "body": {
12
+ "started": true
13
+ }
14
+ }
15
+ {
16
+ "inReplyTo": "request-id",
17
+ "dataset": "Default",
18
+ "date": "0000-00-00T00:00:00.000000Z",
19
+ "body": {
20
+ "nMessages": 1
21
+ },
22
+ "type": "dump.forecast"
23
+ }
24
+ {
25
+ "inReplyTo": "request-id",
26
+ "dataset": "Default",
27
+ "date": "0000-00-00T00:00:00.000000Z",
28
+ "body": {
29
+ "type": "Hash",
30
+ "name": "Memos",
31
+ "keyType": "ShortText"
32
+ },
33
+ "type": "dump.table"
34
+ }
35
+ {
36
+ "inReplyTo": "request-id",
37
+ "dataset": "Default",
38
+ "date": "0000-00-00T00:00:00.000000Z",
39
+ "type": "dump.end"
40
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "dataset": "Default",
4
+ "date": "0000-00-00T00:00:00.000000Z",
5
+ "type": "dump.start"
6
+ }
7
+ {
8
+ "inReplyTo": "request-id",
9
+ "statusCode": 200,
10
+ "type": "dump.result",
11
+ "body": {
12
+ "started": true
13
+ }
14
+ }
15
+ {
16
+ "inReplyTo": "request-id",
17
+ "dataset": "Default",
18
+ "date": "0000-00-00T00:00:00.000000Z",
19
+ "body": {
20
+ "nMessages": 1
21
+ },
22
+ "type": "dump.forecast"
23
+ }
24
+ {
25
+ "inReplyTo": "request-id",
26
+ "dataset": "Default",
27
+ "date": "0000-00-00T00:00:00.000000Z",
28
+ "body": {
29
+ "type": "PatriciaTrie",
30
+ "name": "Memos",
31
+ "keyType": "ShortText"
32
+ },
33
+ "type": "dump.table"
34
+ }
35
+ {
36
+ "inReplyTo": "request-id",
37
+ "dataset": "Default",
38
+ "date": "0000-00-00T00:00:00.000000Z",
39
+ "type": "dump.end"
40
+ }
@@ -1,6 +1,9 @@
1
1
  #@include fixture/user-table.jsons
2
+ #@disable_completion
2
3
  #@disable_validation
3
4
  {
5
+ "id": "1234567890",
6
+ "date": "2015-05-09T00:00:00.000000Z",
4
7
  "type": "add",
5
8
  "body": {}
6
9
  }
@@ -0,0 +1,26 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 400,
4
+ "type": "search.result",
5
+ "body": {
6
+ "name": "SyntaxError",
7
+ "message": "Syntax error: syntax:<query> input:<nonexistent:Droonga>",
8
+ "detail": {
9
+ "syntax": "query",
10
+ "input": "nonexistent:Droonga"
11
+ }
12
+ },
13
+ "errors": {
14
+ "sources0": {
15
+ "statusCode": 400,
16
+ "body": {
17
+ "name": "SyntaxError",
18
+ "message": "Syntax error: syntax:<query> input:<nonexistent:Droonga>",
19
+ "detail": {
20
+ "syntax": "query",
21
+ "input": "nonexistent:Droonga"
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 400,
4
+ "type": "search.result",
5
+ "body": {
6
+ "name": "SyntaxError",
7
+ "message": "Syntax error: syntax:<query> input:<(>",
8
+ "detail": {
9
+ "syntax": "query",
10
+ "input": "("
11
+ }
12
+ },
13
+ "errors": {
14
+ "sources0": {
15
+ "statusCode": 400,
16
+ "body": {
17
+ "name": "SyntaxError",
18
+ "message": "Syntax error: syntax:<query> input:<(>",
19
+ "detail": {
20
+ "syntax": "query",
21
+ "input": "("
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 404,
4
+ "type": "search.result",
5
+ "body": {
6
+ "name": "UnknownSource",
7
+ "message": "Source not found: <unknown> It must be a name of an existing table or another query.",
8
+ "detail": {
9
+ "unknown-source": {
10
+ "source": "unknown"
11
+ }
12
+ }
13
+ },
14
+ "errors": {
15
+ "sources0": {
16
+ "statusCode": 404,
17
+ "body": {
18
+ "name": "UnknownSource",
19
+ "message": "Source not found: <unknown> It must be a name of an existing table or another query.",
20
+ "detail": {
21
+ "unknown-source": {
22
+ "source": "unknown"
23
+ }
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 400,
4
+ "type": "search.result",
5
+ "body": {
6
+ "name": "InvalidAttribute",
7
+ "message": "Invalid attribute: <,>",
8
+ "detail": {
9
+ "attribute": ","
10
+ }
11
+ },
12
+ "errors": {
13
+ "sources0": {
14
+ "statusCode": 400,
15
+ "body": {
16
+ "name": "InvalidAttribute",
17
+ "message": "Invalid attribute: <,>",
18
+ "detail": {
19
+ "attribute": ","
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "datasets": {
3
+ "Default": {
4
+ },
5
+ "Source": {
6
+ "schema": {
7
+ "Users": {
8
+ "type": "PatriciaTrie",
9
+ "keyType": "ShortText"
10
+ }
11
+ },
12
+ "nWorkers": 2,
13
+ "plugins": ["groonga", "crud", "search", "dump", "system", "catalog"],
14
+ "replicas": [
15
+ {
16
+ "dimension": "_key",
17
+ "slicer": "hash",
18
+ "slices": [
19
+ {
20
+ "label": "slice020",
21
+ "weight": 100,
22
+ "volume": {
23
+ "address": "127.0.0.1:23003/droonga.020"
24
+ }
25
+ }
26
+ ]
27
+ },
28
+ {
29
+ "dimension": "_key",
30
+ "slicer": "hash",
31
+ "slices": [
32
+ {
33
+ "label": "slice030",
34
+ "weight": 100,
35
+ "volume": {
36
+ "address": "127.0.0.1:23003/droonga.030"
37
+ }
38
+ }
39
+ ]
40
+ }
41
+ ]
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "dataset": "Default",
4
+ "date": "0000-00-00T00:00:00.000000Z",
5
+ "type": "system.absorb-data.start"
6
+ }
7
+ {
8
+ "inReplyTo": "request-id",
9
+ "statusCode": 200,
10
+ "type": "system.absorb-data.result",
11
+ "body": {
12
+ "started": true
13
+ }
14
+ }
15
+ {
16
+ "inReplyTo": "request-id",
17
+ "dataset": "Default",
18
+ "date": "0000-00-00T00:00:00.000000Z",
19
+ "body": {
20
+ "nProcessedMessages": 2,
21
+ "nRestoredObjects": 2,
22
+ "percentage": 100,
23
+ "message": "100% done (maybe 00:00:00 remaining)"
24
+ },
25
+ "type": "system.absorb-data.progress"
26
+ }
27
+ {
28
+ "inReplyTo": "request-id",
29
+ "dataset": "Default",
30
+ "date": "0000-00-00T00:00:00.000000Z",
31
+ "type": "system.absorb-data.end"
32
+ }
@@ -1,3 +1,4 @@
1
+ #@require-catalog-version 2
1
2
  {
2
3
  "type": "system.statistics.object.count.per-volume",
3
4
  "dataset": "Default",
@@ -0,0 +1,11 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 200,
4
+ "type": "system.statistics.object.count.result",
5
+ "body": {
6
+ "tables": 1,
7
+ "columns": 0,
8
+ "records": 1,
9
+ "total": 2
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "inReplyTo": "request-id",
3
+ "statusCode": 200,
4
+ "type": "system.statistics.object.count.result",
5
+ "body": {
6
+ "tables": 1,
7
+ "columns": 0,
8
+ "records": 0,
9
+ "total": 1
10
+ }
11
+ }
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014 Droonga Project
1
+ # Copyright (C) 2015 Droonga Project
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
@@ -14,6 +14,7 @@
14
14
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
15
 
16
16
  require "droonga/catalog/generator"
17
+ require "droonga/node_name"
17
18
 
18
19
  class CatalogGeneratorTest < Test::Unit::TestCase
19
20
  def setup
@@ -68,7 +69,7 @@ class CatalogGeneratorTest < Test::Unit::TestCase
68
69
  "slices" => [
69
70
  {
70
71
  "volume" => {
71
- "address" => "127.0.0.1:10031/droonga.000",
72
+ "address" => "#{Droonga::NodeName::DEFAULT_HOST}:10031/droonga.000",
72
73
  },
73
74
  "weight" => 100,
74
75
  },
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2014 Droonga Project
1
+ # Copyright (C) 2013-2015 Droonga Project
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
@@ -21,6 +21,7 @@ require_relative "helper/stub_worker"
21
21
  require_relative "helper/plugin_helper"
22
22
  require_relative "helper/watch_helper"
23
23
  require_relative "helper/distributed_search_planner_helper"
24
+ require_relative "helper/stub_serf"
24
25
 
25
26
  class Test::Unit::TestCase
26
27
  include ::Sandbox
@@ -0,0 +1,28 @@
1
+ # Copyright (C) 2015 Droonga Project
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 version 2.1 as published by the Free Software Foundation.
6
+ #
7
+ # This library is distributed in the hope that it will be useful,
8
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
+ # Lesser General Public License for more details.
11
+ #
12
+ # You should have received a copy of the GNU Lesser General Public
13
+ # License along with this library; if not, write to the Free Software
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
+
16
+ class StubSerf
17
+ def initialize
18
+ @have_unprocessed_messages_for = {}
19
+ end
20
+
21
+ def set_have_unprocessed_messages_for(target)
22
+ @have_unprocessed_messages_for[target] = true
23
+ end
24
+
25
+ def reset_have_unprocessed_messages_for(target)
26
+ @have_unprocessed_messages_for.delete(target)
27
+ end
28
+ end