Review: Hot standby - Mailing list pgsql-hackers

From Pavan Deolasee
Subject Review: Hot standby
Date
Msg-id 2e78013d0811202352s7ca6f43fs4c146df296636f9b@mail.gmail.com
Whole thread Raw
Responses Re: Review: Hot standby  ("Pavan Deolasee" <pavan.deolasee@gmail.com>)
Re: Review: Hot standby  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
<br />I think we should avoid the #define's like below which uses a local variable. I guess the same #define is used
elsewherein the code as well. If the code is rearranged or the variable name is changed, the code would break.<br /><br
/>Theuse of malloc should also be avoided (unless the memory subsystem is not up yet; I haven't checked).<br /><br
/><br/>***************<br />*** 706,713 ****<br />                    (errcode(ERRCODE_OUT_OF_MEMORY),<br
/>                    errmsg("out of memory")));<br />         Assert(snapshot->subxip == NULL);<br />       
snapshot->subxip= (TransactionId *)<br />!           malloc(arrayP->maxProcs * PGPROC_MAX_CACHED_SUBXIDS *
sizeof(TransactionId));<br/>        if (snapshot->subxip == NULL)<br />             ereport(ERROR,<br
/>                   (errcode(ERRCODE_OUT_OF_MEMORY),<br />--- 1003,1011 ----<br />                   
(errcode(ERRCODE_OUT_OF_MEMORY),<br/>                     errmsg("out of memory")));<br />        
Assert(snapshot->subxip== NULL);<br />+ #define maxNumSubXids (arrayP->maxProcs * PGPROC_MAX_CACHED_SUBXIDS)<br
/>       snapshot->subxip = (TransactionId *)<br />!           malloc(maxNumSubXids * sizeof(TransactionId));<br />
       if (snapshot->subxip == NULL)<br />            ereport(ERROR,<br />                   
(errcode(ERRCODE_OUT_OF_MEMORY),<br/><br /><br clear="all" />Thanks,<br />Pavan<br /><br />-- <br />Pavan Deolasee<br
/>EnterpriseDB    <a href="http://www.enterprisedb.com">http://www.enterprisedb.com</a><br /> 

pgsql-hackers by date:

Previous
From: Philip Warner
Date:
Subject: Re: Opening a recovering DB in for read-only access?
Next
From: "Pavan Deolasee"
Date:
Subject: Re: Review: Hot standby