Kouhei Sutou
null+****@clear*****
Mon Oct 17 23:51:41 JST 2016
Kouhei Sutou 2016-10-17 23:51:41 +0900 (Mon, 17 Oct 2016) New Revision: b64cf73136e557f6da1e0cd51deaef08dc583218 https://github.com/groonga/groonga/commit/b64cf73136e557f6da1e0cd51deaef08dc583218 Message: ii: log token and token ID on error https://gitter.im/groonga/ja?at=58043f77614116a2568d529c Suggested by torinky. Thanks!!! Modified files: lib/ii.c Modified: lib/ii.c (+39 -6) =================================================================== --- lib/ii.c 2016-10-17 23:46:49 +0900 (83cd8c2) +++ lib/ii.c 2016-10-17 23:51:41 +0900 (ee4ccaf) @@ -5449,8 +5449,19 @@ cursor_heap_push(grn_ctx *ctx, cursor_heap *h, grn_ii *ii, grn_id tid, uint32_t return GRN_END_OF_DATA; } if (!grn_ii_cursor_next_pos(ctx, c)) { - GRN_LOG(ctx, GRN_LOG_ERROR, - "[ii][cursor][heap][push] invalid cursor: %p", c); + if (grn_logger_pass(ctx, GRN_LOG_ERROR)) { + char token[GRN_TABLE_MAX_KEY_SIZE]; + int token_size; + token_size = grn_table_get_key(ctx, + c->ii->lexicon, + c->id, + &token, + GRN_TABLE_MAX_KEY_SIZE); + GRN_LOG(ctx, GRN_LOG_ERROR, + "[ii][cursor][heap][push] invalid cursor: " + "%p: token:<%.*s>(%u)", + c, token_size, token, c->id); + } grn_ii_cursor_close(ctx, c); return GRN_END_OF_DATA; } @@ -5525,8 +5536,19 @@ cursor_heap_pop(grn_ctx *ctx, cursor_heap *h, grn_id min) grn_ii_cursor_close(ctx, c); h->bins[0] = h->bins[--h->n_entries]; } else if (!grn_ii_cursor_next_pos(ctx, c)) { - GRN_LOG(ctx, GRN_LOG_ERROR, - "[ii][cursor][heap][pop] invalid cursor: %p", c); + if (grn_logger_pass(ctx, GRN_LOG_ERROR)) { + char token[GRN_TABLE_MAX_KEY_SIZE]; + int token_size; + token_size = grn_table_get_key(ctx, + c->ii->lexicon, + c->id, + &token, + GRN_TABLE_MAX_KEY_SIZE); + GRN_LOG(ctx, GRN_LOG_ERROR, + "[ii][cursor][heap][pop] invalid cursor: " + "%p: token:<%.*s>(%u)", + c, token_size, token, c->id); + } grn_ii_cursor_close(ctx, c); h->bins[0] = h->bins[--h->n_entries]; } @@ -5544,8 +5566,19 @@ cursor_heap_pop_pos(grn_ctx *ctx, cursor_heap *h) grn_ii_cursor_close(ctx, c); h->bins[0] = h->bins[--h->n_entries]; } else if (!grn_ii_cursor_next_pos(ctx, c)) { - GRN_LOG(ctx, GRN_LOG_ERROR, - "[ii][cursor][heap][pop][position] invalid cursor: %p", c); + if (grn_logger_pass(ctx, GRN_LOG_ERROR)) { + char token[GRN_TABLE_MAX_KEY_SIZE]; + int token_size; + token_size = grn_table_get_key(ctx, + c->ii->lexicon, + c->id, + &token, + GRN_TABLE_MAX_KEY_SIZE); + GRN_LOG(ctx, GRN_LOG_ERROR, + "[ii][cursor][heap][pop][position] invalid cursor: " + "%p: token:<%.*s>(%u)", + c, token_size, token, c->id); + } grn_ii_cursor_close(ctx, c); h->bins[0] = h->bins[--h->n_entries]; } -------------- next part -------------- HTML����������������������������... Download