Re: [PATCHES] Thread-safe PREPARE in ecpg

2007-09-26 Thread Michael Meskes
On Wed, Sep 26, 2007 at 01:43:34PM +0900, ITAGAKI Takahiro wrote:
 Here is a revised patch against CVS HEAD.
 I fixed a bug in ECPGdeallocate_all().

Applied to CVS HEAD. I also added your example to the regression tests.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: [EMAIL PROTECTED]
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[PATCHES] Thread-safe PREPARE in ecpg

2007-09-25 Thread ITAGAKI Takahiro
Here is a WIP patch to make prepared statements thread-safe in ecpg.
The variable prep_stmts was global but not protected by any locks.
I divided it into per-connection field so that we can access prepared
statements separately in each thread.

I needed to change the following exported functions, but it will
introduce an incompatibility issue. It might be ok for CVS HEAD,
but I'd like to port the fix to back versions. Do you have any
thoughts on how we can accomplish this better?

From:
  - bool ECPGdeallocate(int, int, const char *name);
  - bool ECPGdeallocate_all(int, int);
  - char *ECPGprepared_statement(const char *name, int);
To:
  - bool ECPGdeallocate(int, int, const char *connection_name, const char 
*name);
  - bool ECPGdeallocate_all(int, int, const char *connection_name);
  - char *ECPGprepared_statement(const char *connection_name, const char *name, 
int);
(connection_name argument is added.)

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center



ecpg_prepare.patch
Description: Binary data

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [PATCHES] Thread-safe PREPARE in ecpg

2007-09-25 Thread Michael Meskes
On Tue, Sep 25, 2007 at 03:22:13PM +0900, ITAGAKI Takahiro wrote:
 Here is a WIP patch to make prepared statements thread-safe in ecpg.
 The variable prep_stmts was global but not protected by any locks.
 I divided it into per-connection field so that we can access prepared
 statements separately in each thread.

Thanks a lot. This is exactly how I was planning to implement it, but I
haven't even found the time to start coding yet. :-)

Could you please create a small example that we could add to the
regression suite?

 I needed to change the following exported functions, but it will
 introduce an incompatibility issue. It might be ok for CVS HEAD,
 but I'd like to port the fix to back versions. Do you have any
 thoughts on how we can accomplish this better?

No idea at the moment, sorry. 

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: [EMAIL PROTECTED]
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [PATCHES] Thread-safe PREPARE in ecpg

2007-09-25 Thread ITAGAKI Takahiro
Here is a revised patch against CVS HEAD.
I fixed a bug in ECPGdeallocate_all().

Michael Meskes [EMAIL PROTECTED] wrote:

 Could you please create a small example that we could add to the
 regression suite?

The attached prep.pgc is an example for this fix,
that repeats EXEC SQL PREPARE and EXECUTE in loops.
It works with pthread and Win32 thread.

  I needed to change the following exported functions, but it will
  introduce an incompatibility issue. It might be ok for CVS HEAD,
  but I'd like to port the fix to back versions. Do you have any
  thoughts on how we can accomplish this better?
 
 No idea at the moment, sorry. 

For porting back to 8.2, I'm planning to keep ECPGdeallocate,
ECPGdeallocate_all and ECPGprepared_statement as their original names,
and add new versions with different names. If users use only thread
default connection, the simplified version would work enough.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center



ecpg_prepare-8.3.patch
Description: Binary data


prep.pgc
Description: Binary data

---(end of broadcast)---
TIP 6: explain analyze is your friend