summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <mats@romeo.(none)>2007-02-24 14:33:45 +0100
committerunknown <mats@romeo.(none)>2007-02-24 14:33:45 +0100
commit13bee852c5e3238cf3670c758b1c79061c140143 (patch)
tree39a14dc85c657905c766ebc1c598d52698313c12
parentf60346193e20d6ac6fc9b25d66acc1c9d0c5ac0c (diff)
downloadmariadb-git-13bee852c5e3238cf3670c758b1c79061c140143.tar.gz
BUG#26286 (row-based logging scales worse than statement-based logging):
Submitting patch on Guilhem's behalf (he found the solution). Correcting a typo that caused very big increases in memory usage when more memory needed to be allocated for row-based events. Also correcting a border case check when more memory needed to be allocated. sql/log_event.cc: Correcting typo that caused very big increases in memory allocation. Correcting border case for when more memory should be allocated.
-rw-r--r--sql/log_event.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index a326e226320..ec1dd973f3f 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -5515,13 +5515,13 @@ int Rows_log_event::do_add_row_data(byte *const row_data,
DBUG_ASSERT(m_rows_cur <= m_rows_end);
/* The cast will always work since m_rows_cur <= m_rows_end */
- if (static_cast<my_size_t>(m_rows_end - m_rows_cur) < length)
+ if (static_cast<my_size_t>(m_rows_end - m_rows_cur) <= length)
{
my_size_t const block_size= 1024;
my_ptrdiff_t const old_alloc= m_rows_end - m_rows_buf;
my_ptrdiff_t const cur_size= m_rows_cur - m_rows_buf;
my_ptrdiff_t const new_alloc=
- block_size * ((cur_size + length) / block_size + block_size - 1);
+ block_size * ((cur_size + length + block_size - 1) / block_size);
byte* const new_buf= (byte*)my_realloc((gptr)m_rows_buf, new_alloc,
MYF(MY_ALLOW_ZERO_PTR|MY_WME));
@@ -5542,7 +5542,7 @@ int Rows_log_event::do_add_row_data(byte *const row_data,
m_rows_end= m_rows_buf + new_alloc;
}
- DBUG_ASSERT(m_rows_cur + length < m_rows_end);
+ DBUG_ASSERT(m_rows_cur + length <= m_rows_end);
memcpy(m_rows_cur, row_data, length);
m_rows_cur+= length;
m_row_count++;