fsync with sync, and Win32 unlink
От | Bruce Momjian |
---|---|
Тема | fsync with sync, and Win32 unlink |
Дата | |
Msg-id | 200403102256.i2AMu7b14062@candle.pha.pa.us обсуждение исходный текст |
Список | pgsql-hackers |
I have talked to Tom today and he is willing to implement the discussed method of doing fsync on every file modified between checkpoints, and add unlink handling for open files for Win32. Here are the implementation details: 1) Create a list in shared memory that holds a fixed number of dirty files and files that win32 can't delete because they are open. The list will need to be locked for each insertion. Periodially, the background writer will lock and empty the list and store it in its own local memory. Each entry will contain dbid, relfilenode, and the offset of extent number of the file. As an optimization, inserts will check to see if the previous entry already matches. 2) Checkpoint behavior will be moved into the background writer. 3) On checkpoint request, either by the user or postmaster, the background writer will create a subprocess, do a sync(), wait, then do fsync of all files that were marked as dirty. The sync() should flush out most of the dirty files in an optimal manner. 4) Losing the shared memory list of delete files during a crash will not be a problem. In case of a crash, the WAL logs contain information about deleted files (new in 7.5), and those files will be delete on recovery. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
В списке pgsql-hackers по дате отправления: