Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 236
Support separation of catalog and compute#138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
f6c2ecfce02c5d4dbcda7e3ddd0f60e9089adc9b3285ba413b5f5525d3fa1988e698c1File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -133,16 +133,16 @@ typedef enum | ||
| static SlruErrorCause slru_errcause; | ||
| static int slru_errno; | ||
| /* | ||
| * Hooks for plugins to get control in SlruPhysicalReadPage/SlruPhysicalWritePage/SimpleLruReadPage | ||
| */ | ||
| SlruPhysicalReadPage_hook_type SlruPhysicalReadPage_hook = NULL; | ||
| SlruPhysicalWritePage_hook_type SlruPhysicalWritePage_hook = NULL; | ||
| SimpleLruReadPage_hook_type SimpleLruReadPage_hook = NULL; | ||
| static void SimpleLruZeroLSNs(SlruCtl ctl, int slotno); | ||
| static void SimpleLruWaitIO(SlruCtl ctl, int slotno); | ||
| static void SlruInternalWritePage(SlruCtl ctl, int slotno, SlruWriteAll fdata); | ||
| static bool SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno); | ||
| static bool SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, | ||
| SlruWriteAll fdata); | ||
| static void SlruReportIOError(SlruCtl ctl, int pageno, TransactionId xid); | ||
| static int SlruSelectLRUPage(SlruCtl ctl, int pageno); | ||
| static bool SlruScanDirCbDeleteCutoff(SlruCtl ctl, char *filename, | ||
| int segpage, void *data); | ||
| static void SlruInternalDeleteSegment(SlruCtl ctl, int segno); | ||
| @@ -319,7 +319,7 @@ SimpleLruZeroPage(SlruCtl ctl, int pageno) | ||
| * | ||
| * This assumes that InvalidXLogRecPtr is bitwise-all-0. | ||
| */ | ||
| static void | ||
| void | ||
| SimpleLruZeroLSNs(SlruCtl ctl, int slotno) | ||
| { | ||
| SlruShared shared = ctl->shared; | ||
| @@ -336,7 +336,7 @@ SimpleLruZeroLSNs(SlruCtl ctl, int slotno) | ||
| * | ||
| * Control lock must be held at entry, and will be held at exit. | ||
| */ | ||
| static void | ||
| void | ||
| SimpleLruWaitIO(SlruCtl ctl, int slotno) | ||
| { | ||
| SlruShared shared = ctl->shared; | ||
| @@ -396,6 +396,9 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok, | ||
| { | ||
| SlruShared shared = ctl->shared; | ||
| if (SimpleLruReadPage_hook) | ||
| return (*SimpleLruReadPage_hook) (ctl, pageno, write_ok, xid); | ||
| /* Outer loop handles restart if we must wait for someone else's I/O */ | ||
| for (;;) | ||
| { | ||
| @@ -496,6 +499,12 @@ SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno, TransactionId xid) | ||
| SlruShared shared = ctl->shared; | ||
| int slotno; | ||
| if (SimpleLruReadPage_hook) | ||
| { | ||
| LWLockAcquire(shared->ControlLock, LW_EXCLUSIVE); | ||
| return (*SimpleLruReadPage_hook) (ctl, pageno, true, xid); | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where release lock ? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lock released by the caller. | ||
| } | ||
| /* Try to find the page while holding only shared lock */ | ||
| LWLockAcquire(shared->ControlLock, LW_SHARED); | ||
| @@ -679,7 +688,7 @@ SimpleLruDoesPhysicalPageExist(SlruCtl ctl, int pageno) | ||
| * For now, assume it's not worth keeping a file pointer open across | ||
| * read/write operations. We could cache one virtual file pointer ... | ||
| */ | ||
| static bool | ||
| bool | ||
| SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno) | ||
| { | ||
| SlruShared shared = ctl->shared; | ||
| @@ -688,6 +697,13 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno) | ||
| off_t offset = rpageno * BLCKSZ; | ||
| char path[MAXPGPATH]; | ||
| int fd; | ||
| bool result; | ||
| if (SlruPhysicalReadPage_hook && | ||
| SlruPhysicalReadPage_hook(ctl, pageno, slotno, &result)) | ||
| { | ||
| return result; | ||
| } | ||
| SlruFileName(ctl, path, segno); | ||
| @@ -760,6 +776,7 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruWriteAll fdata) | ||
| off_t offset = rpageno * BLCKSZ; | ||
| char path[MAXPGPATH]; | ||
| int fd = -1; | ||
| bool result; | ||
| /* update the stats counter of written pages */ | ||
| pgstat_count_slru_page_written(shared->slru_stats_idx); | ||
| @@ -806,6 +823,12 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruWriteAll fdata) | ||
| } | ||
| } | ||
| if (SlruPhysicalWritePage_hook && | ||
| SlruPhysicalWritePage_hook(ctl, pageno, slotno, &result)) | ||
| { | ||
| return result; | ||
| } | ||
| /* | ||
| * During a WriteAll, we may already have the desired file open. | ||
| */ | ||
| @@ -926,7 +949,7 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruWriteAll fdata) | ||
| * Issue the error message after failure of SlruPhysicalReadPage or | ||
| * SlruPhysicalWritePage. Call this after cleaning up shared-memory state. | ||
| */ | ||
| static void | ||
| void | ||
| SlruReportIOError(SlruCtl ctl, int pageno, TransactionId xid) | ||
| { | ||
| int segno = pageno / SLRU_PAGES_PER_SEGMENT; | ||
| @@ -1011,7 +1034,7 @@ SlruReportIOError(SlruCtl ctl, int pageno, TransactionId xid) | ||
| * | ||
| * Control lock must be held at entry, and will be held at exit. | ||
| */ | ||
| static int | ||
| int | ||
| SlruSelectLRUPage(SlruCtl ctl, int pageno) | ||
| { | ||
| SlruShared shared = ctl->shared; | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.