[Groonga-commit] groonga/groonga at 311378c [master] ii: add environment variable to disable reducing expire

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jan 18 10:35:19 JST 2018


Kouhei Sutou	2018-01-18 10:35:19 +0900 (Thu, 18 Jan 2018)

  New Revision: 311378c4f735f9a99d0fba31db62f1597d2fc2d4
  https://github.com/groonga/groonga/commit/311378c4f735f9a99d0fba31db62f1597d2fc2d4

  Message:
    ii: add environment variable to disable reducing expire
    
    GRN_II_REDUCE_EXPIRE_ENABLE=no disables. It's enabled by default.

  Modified files:
    lib/ii.c

  Modified: lib/ii.c (+18 -1)
===================================================================
--- lib/ii.c    2018-01-18 10:31:14 +0900 (8dba7932b)
+++ lib/ii.c    2018-01-18 10:35:19 +0900 (794456890)
@@ -102,6 +102,7 @@ static grn_bool grn_ii_overlap_token_skip_enable = GRN_FALSE;
 static uint32_t grn_ii_builder_block_threshold_force = 0;
 static uint32_t grn_ii_max_n_segments_small = MAX_PSEG_SMALL;
 static uint32_t grn_ii_max_n_chunks_small = GRN_II_MAX_CHUNK_SMALL;
+static grn_bool grn_ii_reduce_expire_enable = GRN_TRUE;
 
 void
 grn_ii_init_from_env(void)
@@ -201,6 +202,18 @@ grn_ii_init_from_env(void)
       }
     }
   }
+
+  {
+    char grn_ii_reduce_expire_enable_env[GRN_ENV_BUFFER_SIZE];
+    grn_getenv("GRN_II_REDUCE_EXPIRE_ENABLE",
+               grn_ii_reduce_expire_enable_env,
+               GRN_ENV_BUFFER_SIZE);
+    if (strcmp(grn_ii_reduce_expire_enable_env, "no") == 0) {
+      grn_ii_reduce_expire_enable = GRN_FALSE;
+    } else {
+      grn_ii_reduce_expire_enable = GRN_TRUE;
+    }
+  }
 }
 
 void
@@ -4506,7 +4519,11 @@ grn_ii_expire(grn_ctx *ctx, grn_ii *ii)
   /*
   grn_io_expire(ctx, ii->seg, 128, 1000000);
   */
-  if (ii->chunk->nmaps > ii->chunk->max_map_seg / 2) {
+  if (grn_ii_reduce_expire_enable) {
+    if (ii->chunk->nmaps > ii->chunk->max_map_seg / 2) {
+      grn_io_expire(ctx, ii->chunk, 0, 1000000);
+    }
+  } else {
     grn_io_expire(ctx, ii->chunk, 0, 1000000);
   }
 }
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180118/cfd7db79/attachment.htm 



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