On Fri, Sep 25, 2015 at 7:41 PM, Teodor Sigaev <teo...@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+v1d...@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