forking() and updating database

forking() and updating database

am 04.05.2004 19:18:57 von Mayuran

If I am to fork() children and have them update the database,
should i give each child a different database handle? Currently,
the parent has a database handle (global var $Dbh) which the
child inherits from the fork(), each child then reconnects to
the database (i have a sub reconnectDB that each child calls
to re-establish a connection after the fork()). I wonder if this
causes problems.. since each child is using the same handler.

Mayuran

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: forking() and updating database

am 04.05.2004 20:03:57 von Jeremy Zawodny

On Tue, May 04, 2004 at 01:18:57PM -0400, mayuran wrote:
>
> If I am to fork() children and have them update the database,
> should i give each child a different database handle?

Yes.

Jeremy
--
Jeremy D. Zawodny,
Technical Yahoo - Yahoo MySQL Geek
Desk: (408) 349-7878 Cell: (408) 685-5936

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: forking() and updating database

am 04.05.2004 20:03:57 von Jeremy Zawodny

On Tue, May 04, 2004 at 01:18:57PM -0400, mayuran wrote:
>
> If I am to fork() children and have them update the database,
> should i give each child a different database handle?

Yes.

Jeremy
--
Jeremy D. Zawodny,
Technical Yahoo - Yahoo MySQL Geek
Desk: (408) 349-7878 Cell: (408) 685-5936

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: forking() and updating database

am 04.05.2004 20:10:02 von Mayuran

Jeremy Zawodny wrote:

>On Tue, May 04, 2004 at 01:18:57PM -0400, mayuran wrote:
>
>
>>If I am to fork() children and have them update the database,
>>should i give each child a different database handle?
>>
>>
>
>Yes.
>
>Jeremy
>
>
Why is this necessary tho? what kind of problems does this produce ?

Mayuran

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: forking() and updating database

am 04.05.2004 20:10:02 von Mayuran

Jeremy Zawodny wrote:

>On Tue, May 04, 2004 at 01:18:57PM -0400, mayuran wrote:
>
>
>>If I am to fork() children and have them update the database,
>>should i give each child a different database handle?
>>
>>
>
>Yes.
>
>Jeremy
>
>
Why is this necessary tho? what kind of problems does this produce ?

Mayuran

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: forking() and updating database

am 04.05.2004 22:26:01 von Jeremy Zawodny

On Tue, May 04, 2004 at 02:10:02PM -0400, mayuran wrote:
> Jeremy Zawodny wrote:
>
> >On Tue, May 04, 2004 at 01:18:57PM -0400, mayuran wrote:
> >
> >
> >>If I am to fork() children and have them update the database,
> >>should i give each child a different database handle?
> >>
> >>
> >
> >Yes.
> >
> >Jeremy
> >
> >
> Why is this necessary tho? what kind of problems does this produce ?

All kinds. How will the procs properly syncronize their db access?

Jeremy
--
Jeremy D. Zawodny,
Technical Yahoo - Yahoo MySQL Geek
Desk: (408) 349-7878 Cell: (408) 685-5936

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: forking() and updating database

am 04.05.2004 22:26:01 von Jeremy Zawodny

On Tue, May 04, 2004 at 02:10:02PM -0400, mayuran wrote:
> Jeremy Zawodny wrote:
>
> >On Tue, May 04, 2004 at 01:18:57PM -0400, mayuran wrote:
> >
> >
> >>If I am to fork() children and have them update the database,
> >>should i give each child a different database handle?
> >>
> >>
> >
> >Yes.
> >
> >Jeremy
> >
> >
> Why is this necessary tho? what kind of problems does this produce ?

All kinds. How will the procs properly syncronize their db access?

Jeremy
--
Jeremy D. Zawodny,
Technical Yahoo - Yahoo MySQL Geek
Desk: (408) 349-7878 Cell: (408) 685-5936

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: forking() and updating database

am 05.05.2004 17:00:52 von Mayuran

Jeremy Zawodny wrote:

>On Tue, May 04, 2004 at 02:10:02PM -0400, mayuran wrote:
>
>
>>Jeremy Zawodny wrote:
>>
>>
>>
>>>On Tue, May 04, 2004 at 01:18:57PM -0400, mayuran wrote:
>>>
>>>
>>>
>>>
>>>>If I am to fork() children and have them update the database,
>>>>should i give each child a different database handle?
>>>>
>>>>
>>>>
>>>>
>>>Yes.
>>>
>>>Jeremy
>>>
>>>
>>>
>>>
>>Why is this necessary tho? what kind of problems does this produce ?
>>
>>
>
>All kinds. How will the procs properly syncronize their db access?
>
>Jeremy
>
>

The database handler $dbh is global, and is inherited by the child after
the fork(). I then call a method reconnectDB() for each child which
re-establishes the connection. I dont see why this would be a problem,
since each child has its own copy of the $dbh variable. Am I mistaken?
Or is this ok?

Thanks

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: forking() and updating database

am 05.05.2004 17:00:52 von Mayuran

Jeremy Zawodny wrote:

>On Tue, May 04, 2004 at 02:10:02PM -0400, mayuran wrote:
>
>
>>Jeremy Zawodny wrote:
>>
>>
>>
>>>On Tue, May 04, 2004 at 01:18:57PM -0400, mayuran wrote:
>>>
>>>
>>>
>>>
>>>>If I am to fork() children and have them update the database,
>>>>should i give each child a different database handle?
>>>>
>>>>
>>>>
>>>>
>>>Yes.
>>>
>>>Jeremy
>>>
>>>
>>>
>>>
>>Why is this necessary tho? what kind of problems does this produce ?
>>
>>
>
>All kinds. How will the procs properly syncronize their db access?
>
>Jeremy
>
>

The database handler $dbh is global, and is inherited by the child after
the fork(). I then call a method reconnectDB() for each child which
re-establishes the connection. I dont see why this would be a problem,
since each child has its own copy of the $dbh variable. Am I mistaken?
Or is this ok?

Thanks

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: forking() and updating database

am 05.05.2004 18:48:32 von Rudy Lippan

On Wed, 5 May 2004, mayuran wrote:

> >All kinds. How will the procs properly syncronize their db access?
> >
> >Jeremy
> >
> >
>
> The database handler $dbh is global, and is inherited by the child after
> the fork(). I then call a method reconnectDB() for each child which
> re-establishes the connection. I dont see why this would be a problem,
> since each child has its own copy of the $dbh variable. Am I mistaken?
> Or is this ok?

It should be ok, but you will need to look at the InactiveDestroy attribute.

Rudy


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: forking() and updating database

am 05.05.2004 18:48:32 von Rudy Lippan

On Wed, 5 May 2004, mayuran wrote:

> >All kinds. How will the procs properly syncronize their db access?
> >
> >Jeremy
> >
> >
>
> The database handler $dbh is global, and is inherited by the child after
> the fork(). I then call a method reconnectDB() for each child which
> re-establishes the connection. I dont see why this would be a problem,
> since each child has its own copy of the $dbh variable. Am I mistaken?
> Or is this ok?

It should be ok, but you will need to look at the InactiveDestroy attribute.

Rudy


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org