[Groonga-commit] groonga/groonga at 778fc89 [master] select: fix a bug that command_version isn't used for cache key

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 26 21:18:47 JST 2016


Kouhei Sutou	2016-02-26 21:18:47 +0900 (Fri, 26 Feb 2016)

  New Revision: 778fc8993aa512fb6a33e8bc7f26e75bb4cdcb7d
  https://github.com/groonga/groonga/commit/778fc8993aa512fb6a33e8bc7f26e75bb4cdcb7d

  Message:
    select: fix a bug that command_version isn't used for cache key
    
    GitHub: #490
    
    Reported by KITAITI Makoto. Thanks!!!

  Added files:
    test/command/suite/select/cache/command_version.expected
    test/command/suite/select/cache/command_version.test
  Modified files:
    lib/proc/proc_select.c

  Modified: lib/proc/proc_select.c (+4 -1)
===================================================================
--- lib/proc/proc_select.c    2016-02-26 17:57:14 +0900 (65cc8b5)
+++ lib/proc/proc_select.c    2016-02-26 21:18:47 +0900 (f745eea)
@@ -572,7 +572,8 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
     filter_len + 1 + scorer_len + 1 + sortby_len + 1 + output_columns_len + 1 +
     match_escalation_threshold_len + 1 +
     query_expander_len + 1 + query_flags_len + 1 + adjuster_len + 1 +
-    sizeof(grn_content_type) + sizeof(int) * 2;
+    sizeof(grn_content_type) + sizeof(int) * 2 +
+    sizeof(grn_command_version);
   {
     unsigned int i;
     for (i = 0; i < n_drilldowns; i++) {
@@ -627,6 +628,8 @@ grn_select(grn_ctx *ctx, const char *table, unsigned int table_len,
     cp += sizeof(int);
     grn_memcpy(cp, &limit, sizeof(int));
     cp += sizeof(int);
+    grn_memcpy(cp, &(ctx->impl->command_version), sizeof(grn_command_version));
+    cp += sizeof(grn_command_version);
     {
       unsigned int i;
       for (i = 0; i < n_drilldowns; i++) {

  Added: test/command/suite/select/cache/command_version.expected (+35 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/cache/command_version.expected    2016-02-26 21:18:47 +0900 (8823820)
@@ -0,0 +1,35 @@
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "Hello Groonga!"}
+]
+[[0,0.0,0.0],1]
+select Memos   --query '_key:@Groonga'   --output_columns 'snippet_html(_key)'
+[[0,0.0,0.0],[[[1],[],[]]]]
+select Memos   --query '_key:@Groonga'   --output_columns 'snippet_html(_key)'   --command_version 2
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "snippet_html",
+          "null"
+        ]
+      ],
+      [
+        [
+          "Hello <span class=\"keyword\">Groonga</span>!"
+        ]
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/cache/command_version.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/cache/command_version.test    2016-02-26 21:18:47 +0900 (5a8cc41)
@@ -0,0 +1,18 @@
+table_create Memos TABLE_HASH_KEY ShortText
+
+load --table Memos
+[
+{"_key": "Hello Groonga!"}
+]
+
+# For use cache
+#@sleep 1
+
+select Memos \
+  --query '_key:@Groonga' \
+  --output_columns 'snippet_html(_key)'
+
+select Memos \
+  --query '_key:@Groonga' \
+  --output_columns 'snippet_html(_key)' \
+  --command_version 2
-------------- next part --------------
HTML����������������������������...
Descargar 



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