Re: Scaling XLog insertion (was Re: Moving more work outside WALInsertLock)

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Scaling XLog insertion (was Re: Moving more work outside WALInsertLock)
Date: 2012-02-17 08:59:19
Message-ID: 4F3E16E7.1050305@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16.02.2012 13:31, Fujii Masao wrote:
> On Thu, Feb 16, 2012 at 6:15 PM, Fujii Masao<masao(dot)fujii(at)gmail(dot)com> wrote:
>> BTW, when I ran the test on my Ubuntu, I could not reproduce the problem.
>> I could reproduce the problem only in MacOS.
>
> + nextslot = Insert->nextslot;
> + if (NextSlotNo(nextslot) == lastslot)
> + {
> + /*
> + * Oops, we've "caught our tail" and the oldest slot is still in use.
> + * Have to wait for it to become vacant.
> + */
> + SpinLockRelease(&Insert->insertpos_lck);
> + WaitForXLogInsertionSlotToBecomeFree();
> + goto retry;
> + }
> + myslot =&XLogCtl->XLogInsertSlots[nextslot];
> + nextslot = NextSlotNo(nextslot);
>
> nextslot can reach NumXLogInsertSlots, which would be a bug, I guess.
> When I did the quick-fix and ran the test, I could not reproduce the problem
> any more. I'm not sure if this is really the cause of the problem, though.

Ah, I see. That explains why you only see it on some platforms -
depending on ALIGNOF_XLOG_BUFFER, there is often enough padding after
the last valid slot to accommodate the extra bogus slot. Thanks for the
debugging!

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message premanand 2012-02-17 09:22:32 Re: MySQL search query is not executing in Postgres DB
Previous Message Dimitri Fontaine 2012-02-17 08:54:17 Re: Command Triggers