Bug #25641 | Too much memory used during 'alter table add primary key' with Falcon | ||
---|---|---|---|
Submitted: | 16 Jan 2007 2:53 | Modified: | 28 Apr 2009 4:37 |
Reporter: | Mark Callaghan | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: Falcon storage engine | Severity: | S3 (Non-critical) |
Version: | 5.1.14 Falcon | OS: | Linux (Linux 2.4) |
Assigned to: | CPU Architecture: | Any | |
Tags: | F_MEMORY |
[16 Jan 2007 2:53]
Mark Callaghan
[16 Jan 2007 21:41]
MySQL Verification Team
Thank you for the bug report.
[18 Jan 2007 23:18]
Ann Harrison
Currently all changes to a Falcon table require creating a new table with the desired change, copying all the data from the old table to the new one, dropping the old table, and renaming the new one to the old name. Since Falcon does not release space back to the file system, the database file grows. The released space is available for storing new records, etc. We expect to change to on-line add/drop index before beta.
[18 Jan 2007 23:19]
Ann Harrison
I said "file" but the same comment applies to virtual memory.
[24 Jan 2007 15:17]
Jim Starkey
Falcon stores all tables and index in a single database file. When you add the index, the MySQL server creates a new table, copies the row data from the original to the new table, deletes the old table, and renames the new table to the original name. At one point during this process, both the new and old tables exist in their entirety, doubling the apparent space used. The extra space, however, is free inside Falcon and available for reuse. There are two things we need to do to address this issue. One is to support online "add index" so a table rebuild is unnecessary. This work is underway. The other is to provide a mechanism to monitor space using inside Falcon, including the number of free pages. The space analysis code has already be implemented inside Falcon, but we're still looking for the proper way to expose this through the MySQL server.
[24 Jan 2007 15:30]
Ann Harrison
Jim and I think alike, I guess. He too read the report about excessive memory usage and responded to the increase in database size. The memory problem is much the same. To do the current copy + create index, we read the original table into memory and create the copy in memory, then create the index in memory, then flush the new table plus the index to the log file (also in memory), then move the contents of the log to the database. That uses a lot of memory, all of which will be scavenged and reused or released, but ... doing an on-line index create will help the memory use as well.
[27 Mar 2009 1:00]
Hakan Küçükyılmaz
Mark, having ONLINE ALTER capabilities the VM usage on a Linux 64-bit looks like this: -- After loading 10 mio rows VM size: 2221MB -- After creating PRIMARY KEY VM size: 2661MB I have used your table DDL and your Python script to generate the 10 mio rows. I think the memory usage looks a lot better now. What do you think?
[27 Apr 2009 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[28 Apr 2009 4:37]
Kevin Lewis
Setting this bug to Can't Repeat since it was effectively fixed by the addition of Online Alter