Skip to content

Commit 9599cbc

Browse files
committed
online_alter: clean up usage of cleanup_cache_list
1 parent 5009504 commit 9599cbc

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

sql/online_alter.cc

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -182,23 +182,19 @@ int online_alter_log_row(TABLE* table, const uchar *before_record,
182182
}
183183

184184

185-
static void
186-
cleanup_cache_list(ilist<online_alter_cache_data> &list, bool ending_trans)
185+
static void cleanup_cache_list(ilist<online_alter_cache_data> &list)
187186
{
188-
if (ending_trans)
187+
auto it= list.begin();
188+
while (it != list.end())
189189
{
190-
auto it= list.begin();
191-
while (it != list.end())
192-
{
193-
auto &cache= *it++;
194-
cache.sink_log->release();
195-
cache.reset();
196-
cache.cleanup_sv();
197-
delete &cache;
198-
}
199-
list.clear();
200-
DBUG_ASSERT(list.empty());
190+
auto &cache= *it++;
191+
cache.sink_log->release();
192+
cache.reset();
193+
cache.cleanup_sv();
194+
delete &cache;
201195
}
196+
list.clear();
197+
DBUG_ASSERT(list.empty());
202198
}
203199

204200

@@ -258,12 +254,12 @@ int online_alter_end_trans(Online_alter_cache_list &cache_list, THD *thd,
258254
{
259255
my_error(ER_ERROR_ON_WRITE, MYF(ME_ERROR_LOG),
260256
binlog->get_name(), errno);
261-
cleanup_cache_list(cache_list, is_ending_transaction);
262-
DBUG_RETURN(error);
257+
break;
263258
}
264259
}
265260

266-
cleanup_cache_list(cache_list, is_ending_transaction);
261+
if (is_ending_transaction)
262+
cleanup_cache_list(cache_list);
267263

268264
DBUG_RETURN(error);
269265
}

0 commit comments

Comments
 (0)