Thursday, January 05, 2006

Database Allocation

Work on finishing the database allocation process is getting closer to completion.

Extents - An extent is a contigious block of eight pages.

Mixed Extents - These are extents which contain pages owned by multiple objects.

Uniform Extents - These are extents which contained pages owned by a single object.

This part of the logic deals with updating distribution pages and providing an extent management solution. Currently the extents are managed within the distribution pages themselves however this may need to be moved to ease the task of determining when objects switch from mixed-extents to uniform extents.

Once the extent management is finialised then locking can be added to ensure only a single transaction can modify a given extent at any one time.

To modify an extent you will need an exclusive lock on the extent and a shared intent lock on the distribution page in which that extent lies.

When a distribution page becomes full then a new distribution page must be used or allocated (513 pages from the last) and the process repeated.

Thankfully the device objects already know how to change size and container devices know how to pick the most suitable device for expansion so once a device has been selected for expansion and indeed expanded the final work left to do is in preparing the pages. When shrinking a device the same operations need to be done but in reverse order...

It remains to be seen as to whether it is a good idea to checkpoint after device allocations but the system will certainly checkpoint after adding or removing devices!

No comments: