

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


1. Overview In this project, you will have a chance to study and modify the PostgreSQL source code, with a focus on one of the core modules – the buffer manager. Specifically, you are required to implement the Least Recently Used (LRU) buffer replacement policy by understanding and modifying the current code provided in PostgreSQL version 8.2. 10 , which comes with an implementation of the clock buffer replacement policy. You may find that the amount of code to write in this project is minimal, but you have to understand the codebase first before you know where and how to write your code.
whenever you obtain a buffer page from the list. For example, you can add them to the functions StrategyFreeBuffer and StrategyGetBuffer, respectively. By adding these two lines of code, the database server will output some messages every time it manipulates the free buffer queue. Recall that in project 1, you probably have done the following to start the server: ~/bin/postgres – D ~/mydir/data > logfile 2>& By this, the output message from the elog function calls will be written into a file named ‘logfile’. In addition to that, you can also control the total number of buffers in starting the server. For example, ~/bin/postgres – B 100 – D ~/mydir/data > logfile 2>& will run PostgreSQL with only 100 buffer pages. You need to modify relevant functions (e.g., UnpinBuffer) in bugmgr.c to put buffer back to freelist when the buffet is unpinned and reaches a refcount of 0. Since understanding code is the main component of this project, I tend not to provide more detailed instructions on the PostgreSQL buffer manager code. Feel free to send me emails if you have questions about code organization in the buffer manager.