Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.1.20
-
None
-
10.1.29
Description
ALTER TABLE ... DISCARD TABLESPACE takes a lot of time with large buffer pool (>128G).
Steps to reproduce:
1. drop / create an InnoDB table
2. discard the table space
3. increase the buffer pool size.
4. Re-try once you have a 128G+ buffer pool, and re-run #1 & #2.
The discard time should be increasing.
Attachments
Issue Links
- causes
-
MDEV-16759 InnoDB: Assertion failure in thread 139946191502080 in file row0ins.cc line 285
-
- Closed
-
- is part of
-
MDEV-16283 ALTER TABLE...DISCARD TABLESPACE still takes long on a large buffer pool
-
- Closed
-
- relates to
-
MDEV-14263 FLUSH TABLES FOR EXPORT may write the same pages multiple times
-
- Confirmed
-
-
MDEV-9459 Truncate table causes innodb stalls
-
- Closed
-
-
MDEV-14310 Possible corruption by table-rebuilding or index-creating ALTER TABLE…ALGORITHM=INPLACE
-
- Closed
-
If DISCARD TABLESPACE does not evict the pages from the buffer pool, then IMPORT TABLESPACE must do it. It would not be a useful fix to simply move the call to the IMPORT TABLESPACE step.
I tried simply removing the eviction in DISCARD TABLESPACE. If the DISCARD is soon followed by IMPORT, the IMPORT would adjust the imported file to the pre-existing tablespace ID. If the old pages were not evicted from the buffer pool at DISCARD, then after IMPORT we could incorrectly read old pages from the buffer pool, instead of reading the pages that exist in the imported file.
Import is initially bypassing the buffer pool when reading pages for the adjustment phase. A possible fix is that in the adjustment phase, if a page exists in the buffer pool, we would replace it with the page from the imported file. This would allow quick DISCARD TABLESPACE even for large tables, and a slightly slower IMPORT TABLESPACE (the slowness being proportional to the file size).