It may happen that we try to read the status of a transaction
authorMason Sharp <[email protected]>
Mon, 2 May 2016 18:44:53 +0000 (14:44 -0400)
committerPavan Deolasee <[email protected]>
Tue, 18 Oct 2016 10:05:06 +0000 (15:35 +0530)
in clog before the page has been committed.

There are places in the code that try to extend clog,
but here we simply just do one retry if it looks like
we failed to read the desired page.

src/backend/access/transam/slru.c

index e17c06a6da0d629fe758b3010110312181a85d1b..743e591b3714bf6e3a27125e44e6db947de572fa 100644 (file)
@@ -409,6 +409,17 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
                /* Do the read */
                ok = SlruPhysicalReadPage(ctl, pageno, slotno);
 
+               /*
+                * If we failed, it may be because we tried to read the status
+                * before the page was created. Retry once
+                */
+               if (!ok && slru_errcause == SLRU_READ_FAILED)
+               {
+                       ExtendLogs(xid);
+                       /* Retry */
+                       ok = SlruPhysicalReadPage(ctl, pageno, slotno);
+               }
+
                /* Set the LSNs for this newly read-in page to zero */
                SimpleLruZeroLSNs(ctl, slotno);