Slotted-Page Introduction and fixed-length records page of SSD storage

Introduces paged dynamic data structures allocated in conventional hard disk space: Slotted-Page structure (slotted page structure)

It has the following features:

1. Records (records) sequentially stores (block from the head / tail)

2. Add the order pointer to the starting location of each record (from the tail / block header)

3. The recording position is movable in a page

 

As shown, there footer each pointer pointing to the recording start position.

When there is a new record is inserted, it will be added later in the sequence of FIG. 52, but also one more tail pointer to this new record.

When a record is deleted, the system will release the space, removing the related information pointer, subsequent recording can move forward to fill this gap.

 

We assume that the database system only with fixed-length record (fixed length records) store. For conventional hard drive, the above-described slotted-page approach is a viable option.

If you use a SSD to store, how to design it?

First, a brief introduction SSD:

Wherein the flash memory (flash) into one or more dies (chips), each die is divided into 4 * 2018 = 8192 blocks (blocks), each block comprising 32-64 pages, and the page is the smallest unit of read and write .

Restrictions (Constraints):

Erase-Constraint: unless erased block that page is located, or can not write coverage (over-written) page

Write-Constraint: a block within the page must be written to the high-order address from the lower address

Wear-Constraint: a number of times the erased block is limited (typically 10000-100000 times)

 

We can imitate the traditional slotted-page method, except to remove the tail of the original store pointer slotted table, so there is extra space to store data.

Access records: using linear addressing (the index is calculated for each record slotID-page offset recorded). For example, assume 16 bytes for each record, then Offset = 16 * slotID

Delete Record: When a record is deleted, the position will be stored in a special storage location of records deleted page (State Index Page). Page of memory pointers pointing to all invalid records. When accessing a record, you must first search page in the SIP address is valid.

Update records: update = delete + insert. For each update, the new record will be inserted into a new location, the address of the old record will be added to the SIP page, be marked as invalid.

 

Garbage collection of three conditions:

1. SIP page no space.

2. periodic garbage collection

3. an invalid recording / all records> threshold (e.g. 70%)

When garbage collection occurs, all valid records the original page will be moved (added) to another page there is enough space, the original page can be re-used.

Guess you like

Origin www.cnblogs.com/zzb666/p/12418089.html