temporary tables created on disk

killes@www.drop.org - January 15, 2007 - 14:52
Project:Drupal
Version:5.x-dev
Component:database system
Category:bug report
Priority:normal
Assigned:killes@www.drop.org
Status:closed
Description

because they use the default engine type which is myISAM in most cases. This small patch fixes this to use in-memory HEAP tables instead. It degrades gracefully to iuse MyISAm should HEAP not be available.

AttachmentSizeStatusTest resultOperations
heap.patch1.61 KBIgnoredNoneNone

#1

moshe weitzman - January 15, 2007 - 19:10

seems like a good idea. subscribing

#2

m3avrck - March 6, 2007 - 22:48

How does this affect memory usage on the server? Is there a recommended "make an extra 128kb available" type deal?

Sounds like a great idea!

#3

killes@www.drop.org - March 7, 2007 - 08:44

There will be of course higher memory usage, but I am not sure how big it will be. The tables are usually not that big and the memory should be reclaimed at the end of the page request.

#4

brashquido - March 7, 2007 - 09:10

Not being any sort of MySQL guru I'd assume you'd do this for a performance improvement? Any idea what kind of ball park improvement you'd get by doing this?

#5

m3avrck - March 7, 2007 - 16:54

AFAIK, this only affects searching, that is the only module in core that makes use of it. Views_search makes use of it as well.

#6

Souvent22 - March 8, 2007 - 05:51

Subscribing

#7

pwolanin - March 18, 2007 - 11:42

Based on the docs on mysql.com, it seems the right approach for such a temporary table. I think I saw somewhere else that this is already running on drupal.org?

http://dev.mysql.com/doc/refman/4.1/en/memory-storage-engine.html

#8

killes@www.drop.org - March 18, 2007 - 12:57
Version:5.x-dev» 6.x-dev
Status:needs review» reviewed & tested by the community

Indeed, this patch is running without a problem on drupal.org for about two months or so. I've rerolled it to remove fuzz and declare it ready to go.

AttachmentSizeStatusTest resultOperations
heap_0.patch1.61 KBIgnoredNoneNone

#9

Steven - March 19, 2007 - 01:19
Version:6.x-dev» 5.x-dev

Committed to HEAD. Should this be backported to 5?

#10

Steven - March 19, 2007 - 01:20
Status:reviewed & tested by the community» patch (to be ported)

#11

killes@www.drop.org - March 19, 2007 - 07:37

IMO yes. If Neil applies this to 5 I'll apply it to 4.7.

#12

moshe weitzman - March 19, 2007 - 12:22

I don't see how this could be called a bug, and thus i am a bit suspicious about backport. my .02

#13

kbahey - March 19, 2007 - 14:43

There is potentially scenarios where memory could be exhausted, e.g. on shared accounts.

Just to make sure this will not break memory limits, can we please have this simple patch run on Drupal.org for a week or so, with this line added:

watchdog('debug', 'Temp table search rows: ' . $count);

Before the line:

$count_query = "SELECT $count";

in do_search() in search.module.

I am more concerned about common terms that return too many rows, e.g. "drupal" or "module".

#14

earnie - March 26, 2007 - 13:17

I updated my development area and all of a sudden I was getting an invalid filename for some C:\TEMP file. The log message is below:

Can't create/write to file 'C:\TEMP\#sql_388_0.MYI' (Errcode: 13) query: SELECT DISTINCT b.* FROM DEV_blocks b LEFT JOIN DEV_blocks_roles r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = 'garland' AND b.status = 1 AND (r.rid IN (1) OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module in E:\devshop\www\drupalCVS\HEAD-DEV\includes\database.mysql.inc on line 173.

I reverted this patch and things began working again. This error occurred following a successful install.php before creating the id 1 user.

#15

earnie - March 26, 2007 - 13:18

I updated my development area and all of a sudden I was getting an invalid filename for some C:\TEMP file. The log message is below:

Can't create/write to file 'C:\TEMP\#sql_388_0.MYI' (Errcode: 13) query: SELECT DISTINCT b.* FROM DEV_blocks b LEFT JOIN DEV_blocks_roles r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = 'garland' AND b.status = 1 AND (r.rid IN (1) OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module in E:\devshop\www\drupalCVS\HEAD-DEV\includes\database.mysql.inc on line 173.

I reverted this patch and things began working again. This error occurred following a successful install.php before creating the id 1 user.

#16

earnie - March 26, 2007 - 13:19

I updated my development area and all of a sudden I was getting an invalid filename for some C:\TEMP file. The log message is below:

Can't create/write to file 'C:\TEMP\#sql_388_0.MYI' (Errcode: 13) query: SELECT DISTINCT b.* FROM DEV_blocks b LEFT JOIN DEV_blocks_roles r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = 'garland' AND b.status = 1 AND (r.rid IN (1) OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module in E:\devshop\www\drupalCVS\HEAD-DEV\includes\database.mysql.inc on line 173.

I reverted this patch and things began working again. This error occurred following a successful install.php before creating the id 1 user.

#17

earnie - March 26, 2007 - 16:40

Apologies. I had received a ``500 - Internal Server Error'' in posting and had ass-u-me-d that the post had not been posted.

#18

Heine - March 26, 2007 - 23:13

I updated my development area and all of a sudden I was getting an invalid filename for some C:\TEMP file.

How did you reach that conclusion?

Error 13 means "OS error code 13: Permission denied" on WinXP. Can you please check the privileges of the user account that runs the mysql server? Also, check whether the file already exists, but is simply not writeable by the current user (example: another user created such a file).

# is a perfectly valid character on NTFS and FAT32.

#19

earnie - March 28, 2007 - 14:56

@Heine: Thanks for pointing out my fallicies based on what I believed to be an MS limitation just because it was MS. The ``Permission Denied'' error is being caused by slow closing of handles of the open file and the create request for the file happens before all handles to the file are closed. This seems to be prevalent on my system with some unknown criteria exacerbating the issue. I hope to try again to see the frequency of the issue. I now conclude that this is not a bug for Drupal but may cause issues to arrise as if it were. Therefore, it may be wise to consider filtering the patch to LAMP only but waiting for issues about it to queue is also a worthy consideration. Another solution is to make this use configurable.

#20

Freso - April 22, 2008 - 09:47
Status:patch (to be ported)» needs review

Whether it should go into D5 or not is not my call, but here's a port for 5.x anyway. (Not tested.)

AttachmentSizeStatusTest resultOperations
heap.d5.patch1.64 KBIgnoredNoneNone

#21

drumm - May 14, 2008 - 06:52

This looks like a good idea, but will need testing in a couple hosting environments.

#22

drumm - July 10, 2009 - 06:10
Status:needs review» fixed

Hasn't been an issue in D6 for over a year, so committed to 5.x.

#23

System Message - July 24, 2009 - 06:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.