Re: Problem reloading regression database

Поиск
Список
Период
Сортировка
От Brent Verner
Тема Re: Problem reloading regression database
Дата
Msg-id 20020115023038.GA9619@rcfile.org
обсуждение исходный текст
Ответ на Re: Problem reloading regression database  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Problem reloading regression database
Список pgsql-hackers
[2002-01-14 00:41] Tom Lane said:
| Brent Verner <brent@rcfile.org> writes:
| > | You'll need to make sure that the code isn't expecting to palloc
| > | anything first-time-through and re-use it on later loops, but I
| > | think that will be okay.  (The attribute_buf is the most obvious
| > | risk, but that's all right, see stringinfo.c.)
| 
| > So I /can't/ palloc some things /before/ switching context to 
| > per-tuple-context?
| 
| Oh, sure you can.  That's the point of having a per-query context.
| What I was wondering was whether there were any pallocs executed
| *after* entering the loop that the code expected to live across
| loop cycles.  I don't think so, I'm just mentioning the risk as
| part of your education ;-)

gotcha.  No, I don't think anything inside that loop expects to 
persist across iterations.  The attribute_buf is static to the
file, and initialized in DoCopy.

What I ended up doing is switching to per-tuple-context prior to 
the input loop, then switching back to the (saved) query-context
after exiting the loop.  I followed ResetTupleExprContext back, and
it doesn't seem to do anything that would require a switch per loop.
Are there any problems this might cause that I'm not seeing  with 
my test case?

Memory use is now under control, and things look good (stable around 
2.8M).

sleepy:/usr/local/pg-7.2/bin
brent$ ./psql -c '\d yyy'                           Table "yyy"Column |  Type   |                   Modifiers
        
 
--------+---------+------------------------------------------------id     | integer | not null default
nextval('"yyy_id_seq"'::text)a     | integer | not null default 1b      | text    | not null default 'test'c      |
integer| 
 
Unique keys: yyy_id_key

sleepy:/usr/local/pg-7.2/bin
brent$ wc -l mmm
3200386 mmm
sleepy:/usr/local/pg-7.2/bin
brent$ head -10 mmm
\N
\N
\N
20
10
20
20
40
50
20
sleepy:/usr/local/pg-7.2/bin
brent$ ./psql -c 'copy yyy(c) from stdin' < mmm
sleepy:/usr/local/pg-7.2/bin


thanks. brent

-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Hiroshi Inoue
Дата:
Сообщение: Re: Theory about XLogFlush startup failures
Следующее
От: Lincoln Yeoh
Дата:
Сообщение: Re: bug in permission handling?