Bug #16742 DD: Tables Space small data files create are not correct file size.
Submitted: 24 Jan 2006 2:14 Modified: 24 Jan 2006 12:23
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.1.6-alpha OS:Linux (Linux)
Assigned to: Jonas Oreland CPU Architecture:Any

[24 Jan 2006 2:14] Jonathan Miller
Description:

When creating a Disk Data file using small numbers, the actual file size is much small then expected:

1 MB = 1048756 DD = 65536
5 MB = 5242880 DD = 4259840
7 MB = 7340032 DD = 6356992
50 MB = 52428800 DD = 51445760
500 MB = 524288000 DD = 523304960

How to repeat:
Create Table Space data files with number listed above.

Suggested fix:
Create actual file size given.
[24 Jan 2006 10:40] Jonas Oreland
File size is computed as follows:
#Extents = MAX((SIZE + EXTENT_SIZE - 1) / EXTENT_SIZE, 1)
#Data pages = #Extents * EXTENT_SIZE
#Extent pages = (#Extents + EXTENTS_PER_PAGE - 1) / EXTENTS_PER_PAGE
FileSize = 32k * (1 + #Extent pages + #Data pages)

SIZE = Argument givent in SQL
EXTENT_SIZE = Extent size given to "create tablespace"
EXTENTS_PER_PAGE = 8189 / (2 + (EXTENT_SIZE / 32k * 4 + 31) /32)
[24 Jan 2006 10:43] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/1555
[24 Jan 2006 12:23] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented bugfix in 5.1.6 changelog; closed.