[Groonga-commit] groonga/groonga at a336c28 [master] Log details on grn_ctx_at() failure

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Aug 26 17:26:01 JST 2016


Kouhei Sutou	2016-07-28 15:19:58 +0900 (Thu, 28 Jul 2016)

  New Revision: a336c28bd89d48db9cc5936007d9e442d77f3f1b
  https://github.com/groonga/groonga/commit/a336c28bd89d48db9cc5936007d9e442d77f3f1b

  Message:
    Log details on grn_ctx_at() failure

  Modified files:
    lib/db.c
    test/command/suite/object_remove/broken/index_column_force.expected
    test/command/suite/object_remove/broken/indexed_column.expected
    test/command/suite/object_remove/broken/indexed_column_force.expected
    test/command/suite/object_remove/broken/too_small.expected
    test/command/suite/object_remove/broken/too_small_force.expected
    test/command/suite/object_remove/broken/wrong_type.expected
    test/command/suite/object_remove/broken/wrong_type_force.expected
    test/command/suite/object_remove/broken/zero_segment_size.expected
    test/command/suite/object_remove/broken/zero_segment_size_force.expected

  Modified: lib/db.c (+34 -2)
===================================================================
--- lib/db.c    2016-07-28 14:44:10 +0900 (c5e1d78)
+++ lib/db.c    2016-07-28 15:19:58 +0900 (165ee61)
@@ -10010,9 +10010,21 @@ grn_ctx_at(grn_ctx *ctx, grn_id id)
           uint32_t value_len;
           char *value = grn_ja_ref(ctx, s->specs, id, &jw, &value_len);
           if (value) {
+            grn_rc rc;
             grn_obj v;
             GRN_OBJ_INIT(&v, GRN_VECTOR, 0, GRN_DB_TEXT);
-            if (!grn_vector_decode(ctx, &v, value, value_len)) {
+            rc = grn_vector_decode(ctx, &v, value, value_len);
+            if (rc != GRN_SUCCESS) {
+              const char *name;
+              uint32_t name_size;
+              name = _grn_table_key(ctx, (grn_obj *)s, id, &name_size);
+              GRN_LOG(ctx, GRN_LOG_ERROR,
+                      "grn_ctx_at: failed to decode spec: <%u>(<%.*s>):<%u>: %s",
+                      id,
+                      name_size, name,
+                      value_len,
+                      grn_rc_to_string(rc));
+            } else {
               const char *p;
               uint32_t size;
               grn_obj_spec *spec;
@@ -10023,7 +10035,15 @@ grn_ctx_at(grn_ctx *ctx, grn_id id)
                                             (const char **)&spec,
                                             NULL,
                                             NULL);
-              if (size) {
+              if (size == 0) {
+                const char *name;
+                uint32_t name_size;
+                name = _grn_table_key(ctx, (grn_obj *)s, id, &name_size);
+                GRN_LOG(ctx, GRN_LOG_ERROR,
+                        "grn_ctx_at: spec value is empty: <%u>(<%.*s>)",
+                        id,
+                        name_size, name);
+              } else {
                 switch (spec->header.type) {
                 case GRN_TYPE :
                   vp->ptr = (grn_obj *)grn_type_open(ctx, spec);
@@ -10103,6 +10123,18 @@ grn_ctx_at(grn_ctx *ctx, grn_id id)
                   }
                   break;
                 }
+                if (!vp->ptr) {
+                  const char *name;
+                  uint32_t name_size;
+                  name = _grn_table_key(ctx, (grn_obj *)s, id, &name_size);
+                  GRN_LOG(ctx, GRN_LOG_ERROR,
+                          "grn_ctx_at: failed to open object: "
+                          "<%u>(<%.*s>):<%u>(<%s>)",
+                          id,
+                          name_size, name,
+                          spec->header.type,
+                          grn_obj_type_to_string(spec->header.type));
+                }
               }
               grn_obj_close(ctx, &v);
             }

  Modified: test/command/suite/object_remove/broken/index_column_force.expected (+1 -0)
===================================================================
--- test/command/suite/object_remove/broken/index_column_force.expected    2016-07-28 14:44:10 +0900 (5544e9f)
+++ test/command/suite/object_remove/broken/index_column_force.expected    2016-07-28 15:19:58 +0900 (1411c93)
@@ -19,5 +19,6 @@ object_remove Terms.index --force yes
   false
 ]
 #|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000102>
+#|e| grn_ctx_at: failed to open object: <258>(<Terms.index>):<72>(<column:index>)
 column_create Terms index COLUMN_INDEX|WITH_POSITION Users _key
 [[0,0.0,0.0],true]

  Modified: test/command/suite/object_remove/broken/indexed_column.expected (+1 -0)
===================================================================
--- test/command/suite/object_remove/broken/indexed_column.expected    2016-07-28 14:44:10 +0900 (3af69bd)
+++ test/command/suite/object_remove/broken/indexed_column.expected    2016-07-28 15:19:58 +0900 (6a8bad5)
@@ -21,6 +21,7 @@ object_remove Users.name
   false
 ]
 #|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000103>
+#|e| grn_ctx_at: failed to open object: <259>(<Terms.index>):<72>(<column:index>)
 #|e| [column][remove][index] hook has a dangling reference: Users.name
 object_exist Users.name
 [[0,0.0,0.0],true]

  Modified: test/command/suite/object_remove/broken/indexed_column_force.expected (+1 -0)
===================================================================
--- test/command/suite/object_remove/broken/indexed_column_force.expected    2016-07-28 14:44:10 +0900 (4688442)
+++ test/command/suite/object_remove/broken/indexed_column_force.expected    2016-07-28 15:19:58 +0900 (6b8f6d2)
@@ -21,6 +21,7 @@ object_remove Users.name --force yes
   false
 ]
 #|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000103>
+#|e| grn_ctx_at: failed to open object: <259>(<Terms.index>):<72>(<column:index>)
 #|e| [column][remove][index] hook has a dangling reference: Users.name
 column_create Users name COLUMN_SCALAR ShortText
 [[0,0.0,0.0],true]

  Modified: test/command/suite/object_remove/broken/too_small.expected (+1 -0)
===================================================================
--- test/command/suite/object_remove/broken/too_small.expected    2016-07-28 14:44:10 +0900 (0fffb64)
+++ test/command/suite/object_remove/broken/too_small.expected    2016-07-28 15:19:58 +0900 (2fbacd9)
@@ -15,6 +15,7 @@ object_remove Users
   false
 ]
 #|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000100>
+#|e| grn_ctx_at: failed to open object: <256>(<Users>):<48>(<table:hash_key>)
 #|e| [object][remove] failed to open the target object: <Users>
 object_exist Users
 [[0,0.0,0.0],true]

  Modified: test/command/suite/object_remove/broken/too_small_force.expected (+1 -0)
===================================================================
--- test/command/suite/object_remove/broken/too_small_force.expected    2016-07-28 14:44:10 +0900 (8552dcd)
+++ test/command/suite/object_remove/broken/too_small_force.expected    2016-07-28 15:19:58 +0900 (0fdb2d2)
@@ -15,5 +15,6 @@ object_remove Users --force yes
   false
 ]
 #|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000100>
+#|e| grn_ctx_at: failed to open object: <256>(<Users>):<48>(<table:hash_key>)
 object_exist Users
 [[0,0.0,0.0],false]

  Modified: test/command/suite/object_remove/broken/wrong_type.expected (+1 -0)
===================================================================
--- test/command/suite/object_remove/broken/wrong_type.expected    2016-07-28 14:44:10 +0900 (76e5173)
+++ test/command/suite/object_remove/broken/wrong_type.expected    2016-07-28 15:19:58 +0900 (45e5788)
@@ -15,6 +15,7 @@ object_remove Users
   false
 ]
 #|e| [table][hash] file type must be 0x30: <0000>
+#|e| grn_ctx_at: failed to open object: <256>(<Users>):<48>(<table:hash_key>)
 #|e| [object][remove] failed to open the target object: <Users>
 object_exist Users
 [[0,0.0,0.0],true]

  Modified: test/command/suite/object_remove/broken/wrong_type_force.expected (+1 -0)
===================================================================
--- test/command/suite/object_remove/broken/wrong_type_force.expected    2016-07-28 14:44:10 +0900 (0487091)
+++ test/command/suite/object_remove/broken/wrong_type_force.expected    2016-07-28 15:19:58 +0900 (af65a6c)
@@ -5,5 +5,6 @@ database_unmap
 object_remove Users --force yes
 [[[-54,0.0,0.0],"[table][hash] file type must be 0x30: <0000>"],false]
 #|e| [table][hash] file type must be 0x30: <0000>
+#|e| grn_ctx_at: failed to open object: <256>(<Users>):<48>(<table:hash_key>)
 object_exist Users
 [[0,0.0,0.0],false]

  Modified: test/command/suite/object_remove/broken/zero_segment_size.expected (+1 -0)
===================================================================
--- test/command/suite/object_remove/broken/zero_segment_size.expected    2016-07-28 14:44:10 +0900 (1106ea1)
+++ test/command/suite/object_remove/broken/zero_segment_size.expected    2016-07-28 15:19:58 +0900 (330e45d)
@@ -15,6 +15,7 @@ object_remove Users
   false
 ]
 #|e| failed to open: segment size is 0
+#|e| grn_ctx_at: failed to open object: <256>(<Users>):<48>(<table:hash_key>)
 #|e| [object][remove] failed to open the target object: <Users>
 object_exist Users
 [[0,0.0,0.0],true]

  Modified: test/command/suite/object_remove/broken/zero_segment_size_force.expected (+1 -0)
===================================================================
--- test/command/suite/object_remove/broken/zero_segment_size_force.expected    2016-07-28 14:44:10 +0900 (e8b621b)
+++ test/command/suite/object_remove/broken/zero_segment_size_force.expected    2016-07-28 15:19:58 +0900 (c05fce0)
@@ -5,5 +5,6 @@ database_unmap
 object_remove Users --force yes
 [[[-65,0.0,0.0],"failed to open: segment size is 0"],false]
 #|e| failed to open: segment size is 0
+#|e| grn_ctx_at: failed to open object: <256>(<Users>):<48>(<table:hash_key>)
 object_exist Users
 [[0,0.0,0.0],false]
-------------- next part --------------
HTML����������������������������...
Descargar 



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