Re: WIP: Rework access method interface - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: WIP: Rework access method interface
Date
Msg-id CAA4eK1JJc7VbwAf9VdO4Ch7MrNC97EcBF+rD-RKgOCHeWO0nUA@mail.gmail.com
Whole thread Raw
In response to Re: WIP: Rework access method interface  (Teodor Sigaev <teodor@sigaev.ru>)
List pgsql-hackers
On Fri, Sep 25, 2015 at 7:41 PM, Teodor Sigaev <teodor@sigaev.ru> wrote:
I'm OK about continuing work on amvalidate if we can build consuensus on its design.
Could you give some feedback on amvalidate version of patch please?
http://www.postgresql.org/message-id/CAPpHfds8ZyWenz9vW6tE5RZXboL1vU_wSW181vEq+mU+v1dsiw@mail.gmail.com

In attach a bit modified patch based on 4-th version, and if there are no strong objections, I will commit it. Waiting this patch stops Alexander's development on CREATE ACCESS METHOD and he needs to move forward.


1.
+InitIndexAmRoutine(Relation relation)
+{
+ IndexAmRoutine *result, *tmp;
+
+ result = (IndexAmRoutine *)MemoryContextAlloc(CacheMemoryContext,
+ sizeof(IndexAmRoutine));
+ tmp = (IndexAmRoutine *)DatumGetPointer(
+ OidFunctionCall0(relation->rd_am->amhandler));
+ memcpy(result, tmp, sizeof(IndexAmRoutine));
+ relation->amroutine = result;
+}

Is it appropriate to use CacheMemoryContext here?
Currently in load_relcache_init_file(), all the other information
like rd_indoption, rd_aminfo in Relation is allocated in indexcxt
which ofcourse in allocated in CacheMemoryContext, but still is
there a reason why this also shouldn't be allocated in same
context.

2.
- aform = (Form_pg_am) MemoryContextAlloc(CacheMemoryContext, sizeof *aform);
+ aform = (Form_pg_am)MemoryContextAlloc(CacheMemoryContext, sizeof *aform);

Spurious change.


With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: PATCH: index-only scans with partial indexes
Next
From: Michael Paquier
Date:
Subject: Re: pageinspect patch, for showing tuple data