Navigation Menu

Skip to content

Commit

Permalink
Don't use truncate for "DELETE FROM table"
Browse files Browse the repository at this point in the history
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!!!
  • Loading branch information
kou committed Apr 15, 2014
1 parent 171fa01 commit 952ae82
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion ha_mroonga.cpp
Expand Up @@ -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()
Expand Down

0 comments on commit 952ae82

Please sign in to comment.