[Groonga-commit] groonga/groonga at d174041 [master] grn_db_recover: support broken detection of data column

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Dec 11 00:18:01 JST 2014


Kouhei Sutou	2014-12-11 00:18:01 +0900 (Thu, 11 Dec 2014)

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

  Message:
    grn_db_recover: support broken detection of data column
    
    We can't recover column data. So we just report an error.

  Modified files:
    lib/db.c

  Modified: lib/db.c (+23 -0)
===================================================================
--- lib/db.c    2014-12-11 00:15:55 +0900 (f839023)
+++ lib/db.c    2014-12-11 00:18:01 +0900 (8bc008d)
@@ -11617,6 +11617,25 @@ grn_load(grn_ctx *ctx, grn_content_type input_type,
 }
 
 static void
+grn_db_recover_data_column(grn_ctx *ctx, grn_obj *data_column)
+{
+  if (!grn_obj_is_locked(ctx, data_column)) {
+    return;
+  }
+
+  {
+    char name[GRN_TABLE_MAX_KEY_SIZE];
+    unsigned int name_size;
+    name_size = grn_obj_name(ctx, data_column, name, GRN_TABLE_MAX_KEY_SIZE);
+    ERR(GRN_OBJECT_CORRUPT,
+        "[db][recover] column may be broken: <%.*s>: "
+        "please truncate the column (or clear lock of the column) "
+        "and load data again",
+        (int)name_size, name);
+  }
+}
+
+static void
 grn_db_recover_index_column(grn_ctx *ctx, grn_obj *index_column)
 {
   grn_ii *ii = (grn_ii *)index_column;
@@ -11649,6 +11668,10 @@ grn_db_recover(grn_ctx *ctx, grn_obj *db)
 
     if ((object = grn_ctx_at(ctx, id))) {
       switch (object->header.type) {
+      case GRN_COLUMN_FIX_SIZE :
+      case GRN_COLUMN_VAR_SIZE :
+        grn_db_recover_data_column(ctx, object);
+        break;
       case GRN_COLUMN_INDEX :
         grn_db_recover_index_column(ctx, object);
         break;
-------------- next part --------------
HTML����������������������������...
Télécharger 



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