[Groonga-commit] groonga/groonga at 634dbef [master] index_column_diff: show target index name

Back to archive index
Kouhei Sutou null+****@clear*****
Fri Mar 22 09:23:26 JST 2019


Kouhei Sutou	2019-03-22 09:23:26 +0900 (Fri, 22 Mar 2019)

  Revision: 634dbef102a884acbfc04ed2562acdc83c56656d
  https://github.com/groonga/groonga/commit/634dbef102a884acbfc04ed2562acdc83c56656d

  Message:
    index_column_diff: show target index name

  Modified files:
    lib/index_column.c

  Modified: lib/index_column.c (+18 -13)
===================================================================
--- lib/index_column.c    2019-03-22 09:16:28 +0900 (aac6f1389)
+++ lib/index_column.c    2019-03-22 09:23:26 +0900 (4c858f106)
@@ -245,6 +245,8 @@ typedef struct {
   grn_obj *lexicon;
   grn_ii *ii;
   struct {
+    char name[GRN_TABLE_MAX_KEY_SIZE];
+    int name_size;
     grn_bool with_section;
     grn_bool with_position;
     uint32_t n_elements;
@@ -420,8 +422,10 @@ grn_index_column_diff_progress(grn_ctx *ctx,
 
     GRN_LOG(ctx,
             data->progress.log_level,
-            "[index-column][diff][progress] "
+            "[index-column][diff][progress][%.*s] "
             "%*u/%u %3.0f%% %.2f%s/%.2f%s %.2f%s(%.2frecords/s) %.2f%s",
+            data->index.name_size,
+            data->index.name,
             data->progress.n_records_digits,
             i,
             n_records,
@@ -806,6 +810,11 @@ grn_index_column_diff(grn_ctx *ctx,
   }
   data.ii = (grn_ii *)index_column;
   {
+    data.index.name_size =
+      grn_obj_name(ctx,
+                   index_column,
+                   data.index.name,
+                   sizeof(data.index.name));
     grn_column_flags flags = grn_column_get_flags(ctx, index_column);
     data.index.with_section =
       ((flags & GRN_OBJ_WITH_SECTION) == GRN_OBJ_WITH_SECTION);
@@ -853,11 +862,10 @@ grn_index_column_diff(grn_ctx *ctx,
   if (!data.diff) {
     char message[GRN_CTX_MSGSIZE];
     grn_strcpy(message, GRN_CTX_MSGSIZE, ctx->errbuf);
-    char name[GRN_TABLE_MAX_KEY_SIZE];
-    int name_size = grn_obj_name(ctx, index_column, name, sizeof(name));
     ERR(GRN_INVALID_ARGUMENT,
         "[index-column][diff] failed to create diff table: <%.*s>: %s",
-        name_size, name,
+        data.index.name_size,
+        data.index.name,
         message);
     goto exit;
   }
@@ -871,11 +879,10 @@ grn_index_column_diff(grn_ctx *ctx,
   if (!data.postings) {
     char message[GRN_CTX_MSGSIZE];
     grn_strcpy(message, GRN_CTX_MSGSIZE, ctx->errbuf);
-    char name[GRN_TABLE_MAX_KEY_SIZE];
-    int name_size = grn_obj_name(ctx, index_column, name, sizeof(name));
     ERR(GRN_INVALID_ARGUMENT,
         "[index-column][diff] failed to create postings column: <%.*s>: %s",
-        name_size, name,
+        data.index.name_size,
+        data.index.name,
         message);
     goto exit;
   }
@@ -889,11 +896,10 @@ grn_index_column_diff(grn_ctx *ctx,
   if (!data.remains) {
     char message[GRN_CTX_MSGSIZE];
     grn_strcpy(message, GRN_CTX_MSGSIZE, ctx->errbuf);
-    char name[GRN_TABLE_MAX_KEY_SIZE];
-    int name_size = grn_obj_name(ctx, index_column, name, sizeof(name));
     ERR(GRN_INVALID_ARGUMENT,
         "[index-column][diff] failed to create remains column: <%.*s>: %s",
-        name_size, name,
+        data.index.name_size,
+        data.index.name,
         message);
     goto exit;
   }
@@ -907,11 +913,10 @@ grn_index_column_diff(grn_ctx *ctx,
   if (!data.missings) {
     char message[GRN_CTX_MSGSIZE];
     grn_strcpy(message, GRN_CTX_MSGSIZE, ctx->errbuf);
-    char name[GRN_TABLE_MAX_KEY_SIZE];
-    int name_size = grn_obj_name(ctx, index_column, name, sizeof(name));
     ERR(GRN_INVALID_ARGUMENT,
         "[index-column][diff] failed to create missings column: <%.*s>: %s",
-        name_size, name,
+        data.index.name_size,
+        data.index.name,
         message);
     goto exit;
   }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190322/8cc8eafb/attachment-0001.html>


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