Kouhei Sutou
null+****@clear*****
Mon Dec 29 16:26:46 JST 2014
Kouhei Sutou 2014-12-29 16:26:46 +0900 (Mon, 29 Dec 2014) New Revision: 1d861063bdb03f5530e19f71ab2070958d096cb8 https://github.com/groonga/groonga/commit/1d861063bdb03f5530e19f71ab2070958d096cb8 Message: grn_db_recover: add database check Modified files: lib/db.c Modified: lib/db.c (+17 -0) =================================================================== --- lib/db.c 2014-12-29 16:18:54 +0900 (261c7dd) +++ lib/db.c 2014-12-29 16:26:46 +0900 (1be1494) @@ -11706,6 +11706,17 @@ grn_load(grn_ctx *ctx, grn_content_type input_type, } static void +grn_db_recover_database(grn_ctx *ctx, grn_obj *db) +{ + if (!grn_obj_is_locked(ctx, db)) { + return; + } + + ERR(GRN_OBJECT_CORRUPT, + "[db][recover] database may be broken. Please re-create the database"); +} + +static void grn_db_recover_table(grn_ctx *ctx, grn_obj *table) { if (!grn_obj_is_locked(ctx, table)) { @@ -11763,6 +11774,12 @@ grn_db_recover(grn_ctx *ctx, grn_obj *db) grn_id id; GRN_API_ENTER; + + grn_db_recover_database(ctx, db); + if (ctx->rc != GRN_SUCCESS) { + GRN_API_RETURN(ctx->rc); + } + cursor = grn_table_cursor_open(ctx, db, NULL, 0, NULL, 0, 0, -1, -------------- next part -------------- HTML����������������������������... 下载