[Groonga-commit] groonga/groonga at 0acbefb [master] ii: use CRIT() to reduce the same error

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Dec 7 12:16:15 JST 2015


Kouhei Sutou	2015-12-07 12:16:15 +0900 (Mon, 07 Dec 2015)

  New Revision: 0acbefbd1a471bbc01b592b1a33b69d9309f3590
  https://github.com/groonga/groonga/commit/0acbefbd1a471bbc01b592b1a33b69d9309f3590

  Message:
    ii: use CRIT() to reduce the same error
    
    GRN_LOG() always show message bug ERR() doesn't show continuous the same
    message.

  Modified files:
    lib/grn_ctx.h
    lib/ii.c

  Modified: lib/grn_ctx.h (+1 -0)
===================================================================
--- lib/grn_ctx.h    2015-12-07 11:44:45 +0900 (2b0bd15)
+++ lib/grn_ctx.h    2015-12-07 12:16:15 +0900 (c45f3c5)
@@ -127,6 +127,7 @@ GRN_API void grn_ctx_impl_set_current_error_message(grn_ctx *ctx);
 #ifdef ERR
 #  undef ERR
 #endif /* ERR */
+#define CRIT(rc,...) ERRSET(ctx, GRN_CRIT, (rc),  __VA_ARGS__)
 #define ERR(rc,...) ERRSET(ctx, GRN_ERROR, (rc),  __VA_ARGS__)
 #define WARN(rc,...) ERRSET(ctx, GRN_WARN, (rc),  __VA_ARGS__)
 #define MERR(...) ERRSET(ctx, GRN_ALERT, GRN_NO_MEMORY_AVAILABLE,  __VA_ARGS__)

  Modified: lib/ii.c (+15 -1)
===================================================================
--- lib/ii.c    2015-12-07 11:44:45 +0900 (5e82bb0)
+++ lib/ii.c    2015-12-07 12:16:15 +0900 (fcaa00c)
@@ -2402,8 +2402,22 @@ typedef struct {
   if (cid.rid) {\
     if (cid.tf) {\
       if (lid.rid > cid.rid || (lid.rid == cid.rid && lid.sid >= cid.sid)) {\
-        GRN_LOG(ctx, GRN_LOG_CRIT, "brokenc!! (%d:%d) -> (%d:%d)", lid.rid, lid.sid, cid.rid, cid.sid);\
+        const char *name;\
+        char name_buffer[GRN_TABLE_MAX_KEY_SIZE];\
+        int name_size;\
         rc = GRN_FILE_CORRUPT;\
+        if (DB_OBJ(ii)->id == GRN_ID_NIL) {\
+          name = "(temporary)";\
+          name_size = strlen(name);\
+        } else {\
+          name_size = grn_obj_name(ctx, (grn_obj *)ii,\
+                                   name_buffer, GRN_TABLE_MAX_KEY_SIZE);\
+          name = name_buffer;\
+        }\
+        CRIT(rc,\
+             "[ii][broken] posting in list is larger than posting in chunk: "\
+             "%s: (%d:%d) -> (%d:%d)",\
+             name, lid.rid, lid.sid, cid.rid, cid.sid);\
         break;\
       }\
       PUTNEXT_(cid);\
-------------- next part --------------
HTML����������������������������...
다운로드 



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