Re: Getting oid of 0 when doing LargeObjectManager.create()

Поиск
Список
Период
Сортировка
От Barry Lind
Тема Re: Getting oid of 0 when doing LargeObjectManager.create()
Дата
Msg-id 3D2DAA5B.7050703@xythos.com
обсуждение исходный текст
Ответ на Re: Getting oid of 0 when doing LargeObjectManager.create()  ("Chris White" <cjwhite@cisco.com>)
Список pgsql-jdbc
Chris,

Sorry I wasn't very clear in my first response.  It isn't the OID that
becomes invalid, it is the FastPath function reference used by the jdbc
LargeObject implementation that becomes invalid at the end of a
transaction.  Once you get an OID insert it and commit you are fine.
 But getting back an OID of 0 is an indication the the underlying code
is using a reference that is no longer valid in the current transaction.

The bug I recently fixed occured when garbage collection ran after a
commit had occurred.  The LargeObject instance had a finalize() method
that was called during garbage collection that tried to close the
LargeObject using the reference it had.  However since a commit already
had happened the reference was no longer valid and thus using it to
close the LargeObject caused an error.  Because this was garbage
collection related it would happen seemingly randomly (i.e. whenever gc
ran).

thanks,
--Barry

Chris White wrote:

>I am using jdbc7.2dev-1.2.jar. So I will try the latest development version.
>
>I do have auto commit turned off, but don't I have to do a commit once I
>have written and closed the Large Object in order for it to retained in the
>database? Also, I thought I needed to store the oid in the database so I
>could read/delete the Large object later, so how come it becomes invalid on
>a commit, which I use all the time after doing inserts and updates?
>
>Chris
>
>-----Original Message-----
>From: pgsql-jdbc-owner@postgresql.org
>[mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Barry Lind
>Sent: Wednesday, July 10, 2002 8:57 PM
>To: cjwhite@cisco.com
>Cc: pgsql-jdbc@postgresql.org
>Subject: Re: [JDBC] Getting oid of 0 when doing
>LargeObjectManager.create()
>
>
>Chris,
>
>What version are you using?  I just fixed a bug last week on this, so
>have you tried the latest development driver build from jdbc.postgresql.org?
>
>If this isn't related to the bug I fixed then it is likely related to
>the fact that you are trying to use a large object after having done a
>commit.  In order to use large objects you must run with autocommit
>turned off since the large object pointer becomes invalid on a commit.
>
>thanks,
>--Barry
>
>Chris White wrote:
>
>
>
>>I am getting a oid value of 0 returned when I do a
>>LargeObjectManager.create(). This tells me that I can't create a large
>>object. What reasons would cause this? and what I can do to solve the
>>problems.
>>
>>thanks
>>Chris White
>>
>>
>
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>
>
>



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

Предыдущее
От: Barry Lind
Дата:
Сообщение: Re: Date time problem with timstamp with no timezone data
Следующее
От: Matthew Kennedy
Дата:
Сообщение: Re: ConnectionPool