Kouhei Sutou
null+****@clear*****
Wed Mar 7 16:45:48 JST 2018
Kouhei Sutou 2018-03-07 16:45:48 +0900 (Wed, 07 Mar 2018) New Revision: c39780d07fc10ddb0df2d25791baf33f1eec6dc7 https://github.com/groonga/groonga/commit/c39780d07fc10ddb0df2d25791baf33f1eec6dc7 Message: io_flush: ensure flushing clearing dirty information Modified files: lib/proc.c Modified: lib/proc.c (+25 -20) =================================================================== --- lib/proc.c 2018-03-07 16:01:08 +0900 (ef7d4d7df) +++ lib/proc.c 2018-03-07 16:45:48 +0900 (7a43f61cf) @@ -3720,36 +3720,41 @@ proc_io_flush(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) is_recursive = grn_proc_option_value_bool(ctx, recursive, GRN_TRUE); is_only_opened = grn_proc_option_value_bool(ctx, only_opened, GRN_FALSE); { - grn_rc rc; + grn_rc rc = GRN_SUCCESS; if (target->header.type == GRN_DB && is_only_opened) { - rc = grn_obj_flush(ctx, target); - if (rc == GRN_SUCCESS) { - GRN_TABLE_EACH_BEGIN_FLAGS(ctx, target, cursor, id, GRN_CURSOR_BY_ID) { - grn_obj *sub_target; + GRN_TABLE_EACH_BEGIN_FLAGS(ctx, target, cursor, id, GRN_CURSOR_BY_ID) { + grn_obj *sub_target; - if (id < GRN_N_RESERVED_TYPES) { - continue; - } + if (id < GRN_N_RESERVED_TYPES) { + continue; + } - if (!grn_ctx_is_opened(ctx, id)) { - continue; - } + if (!grn_ctx_is_opened(ctx, id)) { + continue; + } - sub_target = grn_ctx_at(ctx, id); - rc = grn_obj_flush(ctx, sub_target); - if (rc != GRN_SUCCESS) { - break; - } - } GRN_TABLE_EACH_END(ctx, cursor); - } + sub_target = grn_ctx_at(ctx, id); + rc = grn_obj_flush(ctx, sub_target); + if (rc != GRN_SUCCESS) { + break; + } + } GRN_TABLE_EACH_END(ctx, cursor); if (rc == GRN_SUCCESS) { rc = grn_db_clear_dirty(ctx, target); } + if (rc == GRN_SUCCESS) { + rc = grn_obj_flush(ctx, target); + } } else { if (is_recursive) { rc = grn_obj_flush_recursive(ctx, target); - if (rc == GRN_SUCCESS && target->header.type == GRN_DB) { - rc = grn_db_clear_dirty(ctx, target); + if (target->header.type == GRN_DB) { + if (rc == GRN_SUCCESS) { + rc = grn_db_clear_dirty(ctx, target); + } + if (rc == GRN_SUCCESS) { + rc = grn_obj_flush(ctx, target); + } } } else { rc = grn_obj_flush(ctx, target); -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180307/64a7d316/attachment-0001.htm