Kouhei Sutou
null+****@clear*****
Tue Apr 15 23:13:37 JST 2014
Kouhei Sutou 2014-04-15 23:13:37 +0900 (Tue, 15 Apr 2014) New Revision: 952ae823056a6edff7dac75edcac9b273f831b17 https://github.com/mroonga/mroonga/commit/952ae823056a6edff7dac75edcac9b273f831b17 Message: Don't use truncate for "DELETE FROM table" Because truncate requires no other threads/processes are open the table but "DELETE FROM table" doesn't require it. TODO: Wrapper mode has the same problem. [groonga-dev,02222] Reported by yoku0825. Thanks!!! Modified files: ha_mroonga.cpp Modified: ha_mroonga.cpp (+17 -1) =================================================================== --- ha_mroonga.cpp 2014-04-09 23:16:41 +0900 (2504599) +++ ha_mroonga.cpp 2014-04-15 23:13:37 +0900 (7fe8895) @@ -11285,7 +11285,23 @@ int ha_mroonga::wrapper_delete_all_rows() int ha_mroonga::storage_delete_all_rows() { MRN_DBUG_ENTER_METHOD(); - DBUG_RETURN(storage_truncate()); + int error = 0; + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx, grn_table, + NULL, 0, + NULL, 0, + 0, -1, + 0); + if (cursor) { + while (grn_table_cursor_next(ctx, cursor) != GRN_ID_NIL) { + grn_table_cursor_delete(ctx, cursor); + } + grn_table_cursor_close(ctx, cursor); + } else { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + } + DBUG_RETURN(error); } int ha_mroonga::delete_all_rows() -------------- next part -------------- HTML����������������������������... Download