[MDEV-18867] Long Time to Stop and Start Created: 2019-03-09 Updated: 2023-11-02 Resolved: 2020-09-10 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Full-text Search, Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 10.0, 10.1, 10.2.14, 10.3, 10.4 |
| Fix Version/s: | 10.2.35, 10.3.26, 10.4.16, 10.5.7 |
| Type: | Bug | Priority: | Major |
| Reporter: | Michael Caplan | Assignee: | Thirunarayanan Balathandayuthapani |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | performance, shutdown, startup | ||
| Environment: |
Linux 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux I'm running 10.2.14, with roughly 300GB data (1000K +/- tables). 95% tables are innodb. I have 64GB RAM, with INNODB buffer pool size set to 46GB (full my.cnf attached). The OS is Ubuntu 16.04.4. This is a dedicated MariaDB server. |
||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
Restart times where great with 10.2.14, until I recently enabled FTS on thousands of tables. Shutdown and startup both take over an hour. This, coupled with MariaDB eating up far greater sums of allocated memory in my.cnf, I need to restart every few few days or risk hitting the OOM Killer. Shutdown example pulled from my log (16 minutes):
Startup (close to 1 hour):
|
| Comments |
| Comment by Michael Caplan [ 2019-03-10 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Added gbd.txt | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Caplan [ 2019-03-10 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Actually, disregard the above comment. What is actually going on in gbd.txt
mysqld is running at this point, but the error-log is has nothing logged since I shut it down before running apt upgrade. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Caplan [ 2019-03-10 ] | ||||||||||||||||||||||||||||||||||||||||||
|
If I understand right, the update process got stuck int he debian-start upgrade cycle which does not output to the log. Between these log lines, I captured gdb-startup.txt
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Caplan [ 2019-03-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Currently starting up our slave. 1.5 hours and still waiting. Acording to gbd, looks it is stuck in storage/innobase/fts/fts0fts.cc:6870 fts_check_and_drop_orphaned_tables. Not sure if I hit some infinite loop.... | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Caplan [ 2019-03-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Currently around 3 hours into the statup cycle. At this point in the log:
ran gdb an hour and a half ago, and another time just now with thread apply all bt full to see what is going in. Diff of startup1.txt
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-03-15 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The slowness in gdb-startup.txt | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-03-15 ] | ||||||||||||||||||||||||||||||||||||||||||
|
michaelcaplan, I am afraid that the startup problem affects anyone who creates a large number of InnoDB tables with FULLTEXT INDEXES. It could be an O(n²) or O(n³) algorithm that is being executed at startup. Can you provide more information about the slow shutdown? Could it simply be a duplicate of | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-03-15 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The shutdown could possibly be slow due to | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Kester Riley [ 2020-07-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
My clients server takes over 7 hours to start: 2020-07-13 11:59:33 0 [Note] InnoDB: Completed initialization of buffer pool My client has 13,000 databases with 1.8 million tables with about 65,000 Full Text Indexes. There are 2,021,672 FTS_*.ibd files | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-07-13 ] | ||||||||||||||||||||||||||||||||||||||||||
|
thiru, can you rewrite fts_drop_orphaned_tables() to make it significantly faster? Is it necessary to scan SYS_TABLES at all? Do we really have to use the InnoDB SQL parser for the scanning? I am thinking along the following lines:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-08-11 ] | ||||||||||||||||||||||||||||||||||||||||||
|
While working on this, thiru noticed that the upgrade logic for a Windows-specific bug that was introduced in MySQL 5.6 and fixed in 2013 in MySQL 5.6.16 is costing significant time. The only GA version of MariaDB that is affected by this bug is MariaDB Server 10.0.10. The fix was included in MariaDB Server 10.0.11 already. I think that it is extremely unlikely that someone would only now, after quite some time of 10.0 being at its end-of-life, upgrade straight from 10.0.10 to the newest 10.2, 10.3, 10.4, 10.5, or later release. Hence, it should be acceptable to remove some logic around DICT_TF2_FTS_AUX_HEX_NAME in an effort to speed up the startup. The first step of my previous comment was not obvious even to me when I was re-reading it now. Yes, there is no dict_table_t::id or dict_index_t::id available in fil_space_t. But, those ID are encoded in the fil_space_t::name of the FTS_*.ibd tablespace! So, we can collect them from there. The last step of constructing the table name from the pair of (TABLE_ID, ID) should now be obvious as well (just invoke snprintf()). | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Matthias Leich [ 2020-08-24 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The source tree origin/bb-10.2- | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-08-25 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I think that the fix would be cleaner if all new code were added in one compilation unit if possible. I sent a few review comments. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-09-09 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The revised version looks much better. I only have a couple minor requests:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-05-04 ] | ||||||||||||||||||||||||||||||||||||||||||
|
In MariaDB Server 10.6, |