Re: WIP: Access method extendability

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
Cc: Petr Jelinek <petr(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, David Steele <david(at)pgmasters(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: Access method extendability
Date: 2016-03-30 13:21:24
Message-ID: 56FBD2D4.6050703@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

GenericXLogStart(Relation relation)
{
...
if (genericXlogStatus != GXLOG_NOT_STARTED)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("GenericXLogStart: generic xlog is already started")));

Hmm, seems, generic wal whiil be in incorrect state if exception occurs between
GenericXLogStart() and GenericXLogFinish() calls because static variable
genericXlogStatus will contain GXLOG_LOGGED/GXLOG_UNLOGGED status.

Suppose, it could be solved by different ways
- remove all static variable, so, GenericXLogStart() will return an struct
(object) which incapsulated all data needed to generic wal work. As I can
see, in case of exception there isn't ane needing to extra cleanup. Also,
it would allow to use generic wal for two or more relations at the same time,
although I don't know any useful example for such feature.
- add callback via RegisterResourceReleaseCallback() which will cleanup state
of genericXlogStatus variable

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shulgin, Oleksandr 2016-03-30 13:22:36 Re: unexpected result from to_tsvector
Previous Message Stas Kelvich 2016-03-30 13:19:01 Re: Speedup twophase transactions