Tarantool development patches archive
 help / color / mirror / Atom feed
From: Georgy Kirichenko <georgy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Georgy Kirichenko <georgy@tarantool.org>
Subject: [tarantool-patches] [PATCH] Fix memory corruption while vinyl index rebuild
Date: Sat,  5 Jan 2019 00:18:01 +0300	[thread overview]
Message-ID: <8feaa81ab383b2ef3fa4aa5bcf15864333388712.1546636533.git.georgy@tarantool.org> (raw)

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

             reply	other threads:[~2019-01-04 21:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-04 21:18 Georgy Kirichenko [this message]
2019-01-09  9:41 ` Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8feaa81ab383b2ef3fa4aa5bcf15864333388712.1546636533.git.georgy@tarantool.org \
    --to=georgy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH] Fix memory corruption while vinyl index rebuild' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox