200 likes | 398 Views
Storage and File structure. Lecture Notes. COP 4720 Lecture 20. Outline. Chapter 10: Storage and File Structures. RAID levels Storage access File Organization. Sec 10.3, 10.5, 10.6. RAID Levels. Schemes to provide redundancy at lower cost by using disk
E N D
Storage and File structure Lecture Notes COP 4720 Lecture 20
Outline Chapter 10: Storage and File Structures • RAID levels • Storage access • File Organization Sec 10.3, 10.5, 10.6
RAID Levels • Schemes to provide redundancy at lower cost by using disk • striping combined with parity bits. • Different RAID organizations (RAID levels) have differing • cost, performances and reliability characteristics. • Level 0: Striping at the level of blocks; non-redundant. • Used in high performance applications where data • loss is not critical. B1 B2 B3 B4 B4 B5
RAID Levels • Level 1: Mirrored disks; offers the best write performance. • Popular for applications such as storing log files in • a database system. Mirrored Disks
RAID Levels • Level 2: Memory style Error-Correcting-Codes with bit stripping Data disks bit striped ECC bits Not used in practice
RAID Levels • Level 3 : Bit-Interleaved Parity; • a single parity bit can be used for error correction, • not just detection. Parity bit disk Use the fact that the disk unit can detect error sectors
RAID Levels • Level 4: Block interleaved parity. • Uses block-level striping and keeps a parity block on • a separate disk for corresponding blocks from N • other disks. Block parity disk
RAID Levels • Level 5: Block-Interleaved Distributed Parity; • partitions data and parity among all N+1 disks. Data and Parity blocks • Level 6: similar to level 5 but with ECC schemes
Storage Access • A database file is partitioned into fixed-length storage units called • blocks • Database systems seek to minimize the number of block transfers • between disk and memory. • Buffer – portion of main memory available to store copies of disk • blocks. • Buffer manager – subsystem responsible for allocating buffer space in main memory.
Buffer Replacement Policies • Most operating systems use LRU • Not always the best strategy for queries • join involves a repeated scan • a mixed strategy with help from the query optimizer is often used • pinned and toss-immediate
File Organization • The database is stored as a collection of files • one approach • assume fixed record size • each file has records of one particular type only • different files are used for different relations
Fixed Length Records • record i is stored starting at byte (i – 1) * n • simple • but may cross block boundaries • deletion of a record i • fill in the empty space with a shift left • move last record to ith location • keep a free space list.
Free Space List • File header • info about file and ptr to 1st free location • each free location points to the next free location
Variable Length Records • Variable length records arise in database systems by: • storage of multiple record type is a file • record types that allow variable length fields • record types that allow repeating fields • can be represented by a byte string • use special character to represent EOR • difficulty with deletion • difficulty with expansion
Variable Length Records: slotted page structure • Header contains • # of record entries • end of free space in the block (after header) • location & size of each record • records can be moved around within the block • update header • pointers point to the entry position in the header
Variable Length Records:fixed length representation • two techniques • 1. reserved space • -know the maximum length • -short records are right filled with special character • -best when most records have length near max
Variable Length Records:fixed length representation 2. Pointer method -pointers chain together block entries belonging to the same record -implemented with anchor block and an overflow block.