Kouhei Sutou 2019-03-22 14:13:13 +0900 (Fri, 22 Mar 2019) Revision: 454df2798475d01f572300814cfad63d8ac4ae08 https://github.com/groonga/groonga/commit/454df2798475d01f572300814cfad63d8ac4ae08 Message: ii: fix an index break bug If a chunk is empty by merging, the start record ID gap must be merged into the next chunk. If we don't merge the start record ID gap, we can't determine the correct start record ID by chunk info. We need to read the correct start record ID from the real data. It's not acceptable for performance. Modified files: lib/ii.c Modified: lib/ii.c (+6 -1) =================================================================== --- lib/ii.c 2019-03-22 10:31:31 +0900 (ab7dfc853) +++ lib/ii.c 2019-03-22 14:13:13 +0900 (52d5095f9) @@ -3993,6 +3993,7 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h, GRN_OBJ_FIN(ctx, &term); goto exit; } + grn_id dgap_keep = GRN_ID_NIL; for (i = 0; i < nchunks; i++) { GRN_B_DEC(cinfo[i].segno, chunk_data->data); GRN_B_DEC(cinfo[i].size, chunk_data->data); @@ -4023,7 +4024,11 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h, goto exit; } } - if (cinfo[i].size) { + if (cinfo[i].size == 0) { + dgap_keep += cinfo[i].dgap; + } else { + cinfo[i].dgap += dgap_keep; + dgap_keep = GRN_ID_NIL; nvchunks++; } } -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190322/c7606051/attachment.html>