[MDEV-13653] ADD / DROP COLUMN is very slow on 10.3 debug build Created: 2017-08-25 Updated: 2017-11-17 Resolved: 2017-11-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Storage Engine - InnoDB |
| Affects Version/s: | 10.3 |
| Fix Version/s: | 10.3.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Michael Widenius |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
ADD / DROP column on 10.3 debug build takes 5-10 seconds on a small enough table (e.g. 2000 rows) having a blob field. On 10.2 debug it only takes about 1 second. NOTE: The test case is for reproducing only, don't put it into the regression test suite!
|
| Comments |
| Comment by Marko Mäkelä [ 2017-08-28 ] | ||||||||||
|
Both the ADD COLUMN and DROP COLUMN consume about 3.05 seconds on my system (10.2) when the server is built -DWITH_ASAN:BOOL=ON With 10.3 debug and without AddressSanitizer, I can repeat the slow speed. The ADD COLUMN took 9.44 seconds and the DROP COLUMN took 6.96 seconds. The CPU utilization varies between 260% to 300% during the ADD COLUMN and stays around 110% during the DROP COLUMN. The high CPU utilization during ADD COLUMN could be a sign of a mutex contention. "perf record -g" caught only one caller of ut_delay(), which is what InnoDB uses during mutex spins:
As hinted by the 1.41% above, modifying the test to wait all the DB_TRX_ID for the INSERTs to be reset (wait_all_purged.inc) did not have a significant performance impact. So, I think that that part of | ||||||||||
| Comment by Marko Mäkelä [ 2017-08-28 ] | ||||||||||
|
Because I feared that this performance regression could somehow have been caused by Finally, I narrowed the culprit to between these two: The first commit makes InnoDB debug assertions slightly slower by invoking _db_flush() in DBUG_ASSERT_SLOW(), but that is only increasing the test time to 5.5 seconds (almost 10%). The big regression must be caused by something else, and likely outside InnoDB code. The only commit in that above range that affects innoDB is Changed KEY names to use LEX_CSTRING, which should not affect the DML or ha_innobase::inplace_alter_table() code paths. | ||||||||||
| Comment by Michael Widenius [ 2017-11-17 ] | ||||||||||
|
Problem was that db_flush() that was always done as part of ASSERT testing and db_flush did become a bit slower in on of my pushes to 10.2 to make dbug multi thread safe. Fixed by Serg in end of August in 10.2 and merged some time ago in 10.3 I did run a test on 10.3 debug build and the time for the drop table is 1.5 seconds on my laptop. Running same test on 10.1, without any of the related patches, the time for the drop column is 5 seconds (this is because we still do a db_flush() in 10.1) | ||||||||||
| Comment by Michael Widenius [ 2017-11-17 ] | ||||||||||
|
Fixed by recent merge from 10.2 |