[Groonga-commit] groonga/groonga at 0df1c52 [master] ii: use warning log instead of assert

Zurück zum Archiv-Index
Kouhei Sutou null+****@clear*****
Fri Feb 15 10:14:40 JST 2019


Kouhei Sutou	2019-02-15 10:14:40 +0900 (Fri, 15 Feb 2019)

  Revision: 0df1c5252ac9ec8a60a96fcc8b2d662b70b786a1
  https://github.com/groonga/groonga/commit/0df1c5252ac9ec8a60a96fcc8b2d662b70b786a1

  Message:
    ii: use warning log instead of assert

  Modified files:
    lib/ii.c

  Modified: lib/ii.c (+20 -3)
===================================================================
--- lib/ii.c    2019-02-15 09:57:35 +0900 (a4b025a79)
+++ lib/ii.c    2019-02-15 10:14:40 +0900 (586d65869)
@@ -3839,9 +3839,26 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
       continue;
     }
 
-    if (!bt->pos_in_buffer) {
-      GRN_ASSERT(!bt->size_in_buffer);
-      if (bt->size_in_chunk) {
+    if (bt->pos_in_buffer == 0) {
+      if (bt->size_in_buffer > 0) {
+        grn_obj term;
+        DEFINE_NAME(ii);
+        GRN_TEXT_INIT(&term, 0);
+        grn_ii_get_term(ctx, ii, bt->tid & GRN_ID_MAX, &term);
+        GRN_LOG(ctx,
+                GRN_WARN,
+                "[ii][buffer][merge] invalid size for buffer term: "
+                "<%.*s>: "
+                "<%.*s>(%u): "
+                "size:<%u>",
+                name_size, name,
+                (int)GRN_TEXT_LEN(&term), GRN_TEXT_VALUE(&term),
+                bt->tid,
+                bt->size_in_buffer);
+        GRN_OBJ_FIN(ctx, &term);
+        goto exit;
+      }
+      if (bt->size_in_chunk > 0) {
         grn_memcpy(dcp,
                    chunk_data->data_start + bt->pos_in_chunk,
                    bt->size_in_chunk);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190215/b84ca566/attachment.html>


More information about the Groonga-commit mailing list
Zurück zum Archiv-Index