TEXT   67

Buffer Manager Test

Guest on 22nd August 2022 01:46:25 PM

  1. Buffer Manager Test Page
  2.  
  3. The buffer manager reads disk pages into a main memory page as needed. The collection of main memory pages (called frames) used by the buffer manager for this purpose is called the buffer pool. This is just an array of Page objects. The buffer manager is used by access methods, heap files and relational operators to read/write/allocate/deallocate pages. A run of pages can be allocated with a single call. The Buffer Manager uses the interface to the underlying DB class object which actually performs these functions on disk pages.
  4.  
  5.  
  6.  
  7. Test 1
  8. All normal operations are checked here. A run of pages is allocated, each page in the run is written upon and then unpinned (with the dirty flag set to TRUE). Later, each page is pinned again and the data on each page is compared with the data written on it (obviously, it has to be the same). Finally, all the pages are freed.
  9.  
  10.  
  11. Test 2
  12. Test 2 does some illegal buffer manager operations. First, it tries to pin more pages than there are frames in the buffer pool. This operation should fail. It also tries to free a pinned page, and tries to unpin an already unpinned page. Again, these operations should fail.
  13.  
  14.  
  15. Test 3
  16. Test 3 allocates several new pages, dirties them and randomly leaves some of them pinned. All the newly allocated pages are pinned again, which means some of the pages are doubly pinned. Data written on them is checked and then all the pages are unpinned.

Raw Paste


Login or Register to edit or fork this paste. It's free.