[Groonga-commit] groonga/groonga at 71d754c [master] ii test: add a test for broken offline index construction

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Sun Jun 19 22:26:34 JST 2016


Kouhei Sutou	2016-06-19 22:26:34 +0900 (Sun, 19 Jun 2016)

  New Revision: 71d754c5a2691a01cf3c3a22436e99c00b09d726
  https://github.com/groonga/groonga/commit/71d754c5a2691a01cf3c3a22436e99c00b09d726

  Message:
    ii test: add a test for broken offline index construction
    
    GitHub: #551
    
    GRN_II_BUILDER_BLOCK_THRESHOLD environment variable is added just for
    test. Users should not use it.

  Added files:
    test/command/suite/column_create/index/source/multi_column/offline.expected
    test/command/suite/column_create/index/source/multi_column/offline.test
  Modified files:
    lib/ii.c

  Modified: lib/ii.c (+20 -0)
===================================================================
--- lib/ii.c    2016-06-19 22:26:12 +0900 (615a71b)
+++ lib/ii.c    2016-06-19 22:26:34 +0900 (409dfff)
@@ -75,6 +75,7 @@ static grn_bool grn_ii_cursor_set_min_enable = GRN_TRUE;
 static double grn_ii_select_too_many_index_match_ratio = -1;
 static double grn_ii_estimate_size_for_query_reduce_ratio = 0.9;
 static grn_bool grn_ii_overlap_token_skip_enable = GRN_FALSE;
+static uint32_t grn_ii_builder_block_threshold_force = 0;
 
 void
 grn_ii_init_from_env(void)
@@ -124,6 +125,22 @@ grn_ii_init_from_env(void)
       grn_ii_overlap_token_skip_enable = GRN_FALSE;
     }
   }
+
+  {
+    char grn_ii_builder_block_threshold_env[GRN_ENV_BUFFER_SIZE];
+    grn_getenv("GRN_II_BUILDER_BLOCK_THRESHOLD",
+               grn_ii_builder_block_threshold_env,
+               GRN_ENV_BUFFER_SIZE);
+    if (grn_ii_builder_block_threshold_env[0]) {
+      grn_ii_builder_block_threshold_force =
+        grn_atoui(grn_ii_builder_block_threshold_env,
+                  grn_ii_builder_block_threshold_env +
+                  strlen(grn_ii_builder_block_threshold_env),
+                  NULL);
+    } else {
+      grn_ii_builder_block_threshold_force = 0;
+    }
+  }
 }
 
 /* segment */
@@ -9893,6 +9910,9 @@ grn_ii_builder_init(grn_ctx *ctx, grn_ii_builder *builder,
 {
   builder->ii = ii;
   builder->options = *options;
+  if (grn_ii_builder_block_threshold_force > 0) {
+    builder->options.block_threshold = grn_ii_builder_block_threshold_force;
+  }
   grn_ii_builder_options_fix(&builder->options);
 
   builder->src_table = NULL;

  Added: test/command/suite/column_create/index/source/multi_column/offline.expected (+17 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/column_create/index/source/multi_column/offline.expected    2016-06-19 22:26:34 +0900 (9ec296a)
@@ -0,0 +1,17 @@
+table_create Data TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Data value1 COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+column_create Data value2 COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+load --table Data
+[
+{"value1": "a a a a a", "value2": "a"}
+]
+[[0,0.0,0.0],1]
+table_create Lexicon TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Lexicon data_values COLUMN_INDEX|WITH_SECTION|WITH_POSITION   Data value1,value2
+[[0,0.0,0.0],true]
+select Data --match_columns value2 --query a --limit 0
+[[0,0.0,0.0],[[[1],[["_id","UInt32"],["value1","Text"],["value2","Text"]]]]]

  Added: test/command/suite/column_create/index/source/multi_column/offline.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/column_create/index/source/multi_column/offline.test    2016-06-19 22:26:34 +0900 (8f1318d)
@@ -0,0 +1,18 @@
+#$GRN_II_BUILDER_BLOCK_THRESHOLD=5
+
+table_create Data TABLE_NO_KEY
+column_create Data value1 COLUMN_SCALAR Text
+column_create Data value2 COLUMN_SCALAR Text
+
+load --table Data
+[
+{"value1": "a a a a a", "value2": "a"}
+]
+
+table_create Lexicon TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Lexicon data_values COLUMN_INDEX|WITH_SECTION|WITH_POSITION \
+  Data value1,value2
+
+select Data --match_columns value2 --query a --limit 0
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る