Re: [Zope-dev] Making a ZSQL.DA fully multi-threaded?

2004-07-16 Thread Andy Dustman
On Fri, 16 Jul 2004 10:36:27 -0400, Brad Clements [EMAIL PROTECTED] wrote:

 The SAP  folks say their adapter is multi-thread capable, but I've come to believe 
 that only
 means that it's ok to open a connection in one thread and use it in another, but NOT 
 to have
 2 threads make requests on the same connection at the same time.

I would be surprised to find any database API that allowed that.
Generally thread-safe means that there are no global state
variables, i.e. all connection state is encapsulated in the connection
object/struct. Generally I would not try to share connections between
threads at all. To do it, you'd need to ensure that a thread performs
a commit or rollback on the connection before another thread can use
it, i.e. performs a complete transaction or none at all. Otherwise you
will have all sorts of interesting problems.

 Also, two threads can' t open a connection at the same time because their 
 connection table
 management isn't thread safe.

That does suck, but it doesn't seem like an insurmountable problem for
a DA. You just need a per-DA instance mutex which you acquire before
opening a connection release afterwards.
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


RE: [Zope-dev] where is Zope 2.5.1?

2002-03-13 Thread Andy Dustman

On Wed, 2002-03-13 at 12:04, Brian Lloyd wrote:

   - Absolutely eliminate SQL db access as a cause (it sounds 
 like we have proof of this now)

This sounds like it is not specific to any DA. Is that the case?

-- 
Andy Dustman PGP: 0x930B8AB6
@   .net http://dustman.net/andy
You can have my keys when you pry them from my dead, cold neurons.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Zope 2.6 planning - call for contributors!

2002-03-01 Thread Andy Dustman

On Fri, 2002-03-01 at 04:16, Dario Lopez-Kästen wrote:
 I'd like to see ZSQL methods altered so that bind variables could be used in
 SQL queries.

+1, even though MySQL doesn't bind variables (yet, apparently in the
works for 4.0).

Another thing I would like (and could probably write) is an additional
skip_rows parameter (default 0) to Z SQL Methods to complement max_rows.
Since this needs to be passed to the DA's query(), and no DA's currently
accept this parameter, one of these things need to happen:

1) Trap the TypeError that results from calling a query() that doesn't
recognize skip_rows (used as a keyword parameter). In that case, fall
back to query(q, max_rows+skip_rows) and return result[skip_rows:] in
the Z SQL Method.

2) Add a new DA method query_range(q, skip_rows, max_rows); if
AttributeError, fall back like #1.

3) Simply require all DA's to implement it in query() as a keyword
parameter to maintain backwards compatibility with older Zopes.

Adding this would make Z SQL Methods work a bit more like dtml-in ...
start=skip_rows size=max_rows. There may be issues with result caching,
but I don't think it'll be too much of a problem.

-- 
Andy Dustman PGP: 0x930B8AB6
@   .net http://dustman.net/andy
You can have my keys when you pry them from my dead, cold neurons.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: hooking up gdb (was Re: [Zope-dev] More signal 11 restarts....)

2001-12-06 Thread Andy Dustman

On Wed, 2001-12-05 at 15:41, Matthew T. Kromer wrote:
 Leonardo Rochael Almeida wrote:
 
 We aren't getting any core files, even after setting ulimit correctly
 (although we could be setting it uncorrectly. I'll look into that
 further). Anyway, someone else in this list said that core dumps for
 threaded apps in Linux were mostly useless, so we aren't investing much
 energy in it anyway.
 
 With the short restart times we have, I'd prever a solution that didn't
 involve keeping a dead site dead for too long (as in, debugging with
 gdb). We are working in a ZEO scheme that would switch over the
 accelerator to proxy another zeo client, but we are not there yet.
 
 It would be ideal if we could instruct python to grab the SIG11, invoke
 gdb, get a C stacktrace for all threads and let Zope die in peace. If it
 all happend in a few seconds, we will still keep the client happy.
 
 Well largely, ALL I want is the backtrace -- and I'm wondering if I 
 could cobble something together that could get it.  The problem is it 
 needs to look at the symbol table, and I dont know how to get at that 
 via C -- ie, gdb doesnt have an interface that I know of that you can 
 link in to grab a stack trace and exit.

If you don't think a core dump is going to be useful, gdb isn't going to
be either.

I know I have gotten Zope to dump core before, and I think I did this
with -Z '', i.e. don't start a management process. Then you need some
other way to start Zope when it dies.

As for ZMySQLDA/MySQLdb, I do know that the MySQL client libraries will
crash if you try use the same connection more than once simultaneously
in two different threads. I have never quite been sure whether or not
there is some kind of locking in Zope to prevent threads from
simultaneously using two database connections, since I expect this would
cause problems on virtually all implementations.

-- 
Andy Dustman PGP: 0x930B8AB6
@   .net http://dustman.net/andy
You can have my keys when you pry them from my dead, cold neurons.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] general ZMySQL question-wierd results

2001-04-13 Thread Andy Dustman

On Thu, 12 Apr 2001 [EMAIL PROTECTED] wrote:

 Here is how I created the tables:
 CREATE TABLE farm (
 owner_id int primary key not null auto_increment,
 farm_name char (40),
 discipline char (30),
 owner_fname char(30),
 owner_lname char(30),
 farm_address1 char(50),
 farm_address2 char(50),
 city char(30),
 state char(2),
 zip char(5),
 country char (20),
 phone_area_code char(3),
 phone_no_area char(10),
 fax char(13),
 url char(30),
 email char(15),
 nearest_city char(15),
 nearest_city_distance int,
 add_date date,
 edit_date date,
 details char (250))

 Here is how I populate the first record:

 insert into horse101.farm
 (owner_id,farm_name,discipline,owner_fname,owner_lname,farm_address1,farm_addr
 ess2,city,state,zip,country,phone_area_code,phone_no_area,fax,url,email,nearest_cit
 y,nearest_city_distance,add_date,edit_date,details) values(0,'Riverbed
 Farm','dressage','Vicki','Wall-Kelley','Volkerts
 Rd.','','Sebastopol','CA','95472','USA','707','829-5824','425-123-
 1234','http://www.dressage.to','[EMAIL PROTECTED]','San Francisco',60,2001-04-
 10,2001-04-10,'Providing dressage instruction, training, judging as well
 as offering for sale imported and domestic dressage prospects.')

 Here is how I attempt to see the records:
 select *
 from farm

 Here are my results:
 Owner id= P Farm name=r Discipline=o Owner fname=v ,etc.  You see, the last
 field is being inserted into the other fields one char at a time.
 Any help would be GREATLY appreciated.

Owner id (owner_id) can't be 'P' because it is a numeric column. I suspect
if you use the mysql client program, you will find that the correct values
are in there.

-- 
Andy Dustman PGP: 0xC72F3F1D
@   .net http://dustman.net/andy
"Normally with carbonara you use eggs, but I used lobster brains instead."
-- Masahiko Kobe (Iron Chef Italian): 30-year-old Giant Lobster Battle



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] LONGing for normal inetegers...

2001-02-14 Thread Andy Dustman

On 12 Feb 2001, Morten W. Petersen wrote:

 [Jon Franz]
 
 | I had this problem in the past and hacked the mysql DA to fix it, then
 | dicovered to my dismay I was using an out-of-date mysqlDA and it had already
 | been fixed... Which DA are you using?
 
 Using Python 2.0 could solve this problem, as longs are no longer rendered
 with the L suffix.

That's my preferred solution, but also see:

http://www.zope.org/Members/adustman/Tips/no_el

-- 
Andy Dustman PGP: 0xC72F3F1D
@   .net http://dustman.net/andy
"Normally with carbonara you use eggs, but I used lobster brains instead."
-- Masahiko Kobe (Iron Chef Italian): 30-year-old Giant Lobster Battle


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )