Navigation Menu

Skip to content

Commit

Permalink
pat: support custom segment size by environment variable
Browse files Browse the repository at this point in the history
Environment variable name is GRN_PAT_SEGMENT_SIZE.
  • Loading branch information
kou committed Apr 23, 2015
1 parent d1aacef commit 705d347
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/pat.c
Expand Up @@ -405,8 +405,19 @@ _grn_pat_create(grn_ctx *ctx, grn_pat *pat,
array_spec[segment_pat].max_n_segments = 1 << (30 - (22 - 4));
array_spec[segment_sis].w_of_element = w_of_element;
array_spec[segment_sis].max_n_segments = 1 << (30 - (22 - w_of_element));
io = grn_io_create_with_array(ctx, path, sizeof(struct grn_pat_header),
GRN_PAT_SEGMENT_SIZE, grn_io_auto, 3, array_spec);
{
uint32_t segment_size = GRN_PAT_SEGMENT_SIZE;
char segment_size_env[GRN_ENV_BUFFER_SIZE];
grn_getenv("GRN_PAT_SEGMENT_SIZE", segment_size_env, GRN_ENV_BUFFER_SIZE);
if (segment_size_env[0]) {
segment_size = grn_atoui(segment_size_env,
segment_size_env + strlen(segment_size_env),
NULL);
}
io = grn_io_create_with_array(ctx, path, sizeof(struct grn_pat_header),
segment_size,
grn_io_auto, 3, array_spec);
}
}
if (!io) { return NULL; }
if (encoding == GRN_ENC_DEFAULT) { encoding = grn_gctx.encoding; }
Expand Down

0 comments on commit 705d347

Please sign in to comment.