Re: logical decoding - GetOldestXmin
От | Andres Freund |
---|---|
Тема | Re: logical decoding - GetOldestXmin |
Дата | |
Msg-id | 20121213200344.GB28882@awork2.anarazel.de обсуждение исходный текст |
Ответ на | Re: logical changeset generation v3 - git repository (Andres Freund <andres@2ndquadrant.com>) |
Ответы |
Re: logical decoding - GetOldestXmin
Re: logical decoding - GetOldestXmin |
Список | pgsql-hackers |
On 2012-12-13 18:29:00 +0100, Andres Freund wrote: > On 2012-12-13 00:05:41 +0000, Peter Geoghegan wrote: > > Initialisation means finding a free “logical slot” from shared memory, > > then looping until the new magic xmin horizon for logical walsenders > > (stored in their “slot”) is that of the weakest link (think local > > global xmin). > > > > + * FIXME: think about solving the race conditions in a nicer way. > > + */ > > + recompute_xmin: > > + walsnd->xmin = GetOldestXmin(true, true); > > + ComputeLogicalXmin(); > > + if (walsnd->xmin != GetOldestXmin(true, true)) > > + goto recompute_xmin; > > > > Apart from the race conditions that I'm not confident are addressed > > here, I think that the above could easily get stuck indefinitely in > > the event of contention. > > I don't like that part the slightest bit but I don't think its actually > in danger of looping forever. In fact I think its so broken it won't > ever loop ;). (ComputeLogicalXmin() will set the current global minimum > which will then be returned by GetOldestXmin()). > > I would like to solve this properly without copying GetOldestXmin once > more (so we can compute and set the logical xmin while holding > ProcArrayLock), but I am not yet sure how a nice way to do that would > look like. > > I guess GetOldestXminNoLock? That gets called while we already hold the > procarray lock? Yuck. Does anybody have an opinion on the attached patches? Especially 0001, which contains the procarray changes? It moves a computation of the sort of: result -= vacuum_defer_cleanup_age; if (!TransactionIdIsNormal(result)) result = FirstNormalTransactionId; inside ProcArrayLock. But I can't really imagine that to be relevant... Another alternative to this would be to get a snapshot with GetSnapshotData(), copy the xmin to the logical slot, then call ProcArrayEndTransaction(). But that doesn't really seem to be nicer to me. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Вложения
В списке pgsql-hackers по дате отправления: