From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id C873124DC7 for ; Fri, 4 Jan 2019 16:16:32 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lTO_grbcIiA1 for ; Fri, 4 Jan 2019 16:16:32 -0500 (EST) Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [94.100.177.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 364C424DA7 for ; Fri, 4 Jan 2019 16:16:32 -0500 (EST) From: Georgy Kirichenko Subject: [tarantool-patches] [PATCH] Fix memory corruption while vinyl index rebuild Date: Sat, 5 Jan 2019 00:18:01 +0300 Message-Id: <8feaa81ab383b2ef3fa4aa5bcf15864333388712.1546636533.git.georgy@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Georgy Kirichenko Reclaim memory used while previous page recovery not the last one. There is no specific test case. Fixes: 3920 Issue: https://github.com/tarantool/tarantool/issues/3920 Branch: https://github.com/tarantool/tarantool/tree/g.kirichenko/gh-3920-rebuild-mem-corruption diff --git a/src/box/vy_run.c b/src/box/vy_run.c index c448a449d..d82f1e372 100644 --- a/src/box/vy_run.c +++ b/src/box/vy_run.c @@ -2382,6 +2382,7 @@ vy_run_rebuild_index(struct vy_run *run, const char *dir, off_t page_offset, next_page_offset = xlog_cursor_pos(&cursor); while ((rc = xlog_cursor_next_tx(&cursor)) == 0) { + region_truncate(region, mem_used); page_offset = next_page_offset; next_page_offset = xlog_cursor_pos(&cursor); @@ -2441,7 +2442,6 @@ vy_run_rebuild_index(struct vy_run *run, const char *dir, info->row_index_offset = page_row_index_offset; ++run->info.page_count; vy_run_acct_page(run, info); - region_truncate(region, mem_used); } if (prev_tuple != NULL) { -- 2.20.1