dbTalk Databases Forums  

Background processes inside the database.

comp.databases.informix comp.databases.informix


Discuss Background processes inside the database. in the comp.databases.informix forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Topher TheRead
 
Posts: n/a

Default Background processes inside the database. - 10-03-2003 , 11:19 AM






I am looking for a way to have a session spawn a background process
and release.

The user needs to be able to start a job which could conceivably take
days (don't ask what the job is, as I have customers reading this
froup and I do not want them to realise how messed up their database
is). The user's session must, therefore disconnect before the job is
completed, and no network connection can be expected to maintain a
connexion that long, so the app cannot just spawn another app to run
the job.

On the OS, it is fairly easy to have one executable start a second
that runs in the background and not wait for the second to complete.
So, I can have an SPL procedure which makes a system call to the first
and more or less achieve my goal. This is our only option in IDS 7,
at least as far as I can make out, but system calls are a pain.

I would hope a more elegant solution exists through UDR's, but I have
not found one. The mi_tab_execute_on_background() call was suggested,
but I can get no documentation on this.

Does anyone have any advice, information, or suggestions?

Sincerely (His and hers),
Topher B|

Who knows what evil lurks in the hearts of SPL system calls?

Reply With Quote
  #2  
Old   
Jack Parker
 
Posts: n/a

Default Re: Background processes inside the database. - 10-03-2003 , 03:15 PM







You could always go for an intermediate step. Set a flag in a table, have
an OS process (cron scheduled or whatnot) check that table to see if it
should spawn the process you really want to run.

cheers
j.
-.-- --- ..- / -. . . -.. / - --- / --. . - / .- / .-.. .. ..-. . .-.-.- /
.... --- / -.. --- / .. .-.-.-
----- Original Message -----
From: "Topher TheRead" <tophertheread (AT) netscape (DOT) net>
To: <informix-list (AT) iiug (DOT) org>
Sent: Friday, October 03, 2003 12:19 PM
Subject: Background processes inside the database.


Quote:
I am looking for a way to have a session spawn a background process
and release.

The user needs to be able to start a job which could conceivably take
days (don't ask what the job is, as I have customers reading this
froup and I do not want them to realise how messed up their database
is). The user's session must, therefore disconnect before the job is
completed, and no network connection can be expected to maintain a
connexion that long, so the app cannot just spawn another app to run
the job.

On the OS, it is fairly easy to have one executable start a second
that runs in the background and not wait for the second to complete.
So, I can have an SPL procedure which makes a system call to the first
and more or less achieve my goal. This is our only option in IDS 7,
at least as far as I can make out, but system calls are a pain.

I would hope a more elegant solution exists through UDR's, but I have
not found one. The mi_tab_execute_on_background() call was suggested,
but I can get no documentation on this.

Does anyone have any advice, information, or suggestions?

Sincerely (His and hers),
Topher B|

Who knows what evil lurks in the hearts of SPL system calls?

sending to informix-list


Reply With Quote
  #3  
Old   
Topher TheRead
 
Posts: n/a

Default Re: Background processes inside the database. - 10-08-2003 , 11:19 AM



"Jack Parker" <vze2qjg5 (AT) verizon (DOT) net> dashed out a message saying:
Quote:
You could always go for an intermediate step. Set a flag in a table, have
an OS process (cron scheduled or whatnot) check that table to see if it
should spawn the process you really want to run.
Thanks, Jack, and sorry for the delay responding.

For long and tedious reasons, not worth divulging, we are trying to
eliminate the use of a daemon or polling process. I was hoping that
9.4 would make it unneccessary.

Sincerely (His and hers),
Topher B|

Quote:
-.-- --- ..- / -. . . -.. / - --- / --. . - / .- / .-.. .. ..-. . .-.-.- /
... --- / -.. --- / .. .-.-.-
... / .- --. .-. . . / -... ..- - / - .... . / .--- --- -... / ..
-. - . .-. ..-. . .-. . ...


Reply With Quote
  #4  
Old   
Topher TheRead
 
Posts: n/a

Default Re: Background processes inside the database. - 10-13-2003 , 03:55 PM



Well, I did find some information on a method to execute background
sessions in the database server.

I was informed of an undocumented function which will create a new
session and execute another undocumented function in the new session.

/*
************************************************** ******************************
* mi_execute_background_session(mi_am_td *td, mi_string
*udrname)
*
* Arguments:
*
* Td: Index descriptor that was passed in to the blade function
by vii.
* This is used to extract the Fragment identifier for the
index,
* servername, database name, owner and the name of the
index.
* These are passed as arguments to the entry routine of the
* background session. This information is needed to build a
* new index descriptor, which will be passed in to the blade
routine.
*
* udrname: Name of blade routine which will be executed in the
background
* session. This routine has a fixed signature with a single
* argument: the index descriptor.
*
*
* Description:
*
* mi_execute_background_session() will create a new session
* and execute function sq_background_session() in the new
session.
*
* Arguments passed in to sq_background_session() via the
newly created
* scb are: fragment identifier, indexname, servername,
owner, name of
* blade udr to be executed in the background session and the
* version number.
*
* Return value: MI_OK on success, MI_ERROR on failure.
*
************************************************** *******************************/

Frankly, I would not be willing to use these two undocumented
functions in a UDR. I will stick with the workarounds.

Still, it is nice to know it is possible. Maybe IBM will document
them someday.

Sincerely (His and hers),
Topher B|

None of this would be necessary if I had not inherited the world's
worst database design.

Reply With Quote
  #5  
Old   
Obnoxio The Clown
 
Posts: n/a

Default Re: Background processes inside the database. - 10-13-2003 , 05:12 PM



Topher TheRead wrote:

Quote:
None of this would be necessary if I had not inherited the world's
worst database design.
Oh no, you haven't!

--
Ciao,
The Obnoxious One

"Ogni uomo mi guarda come se fossi una testa di cazzo"


Reply With Quote
  #6  
Old   
Topher TheRead
 
Posts: n/a

Default Re: Background processes inside the database. - 10-15-2003 , 02:07 PM



Obnoxio The Clown <obnoxio (AT) hotmail (DOT) com> challenged
Quote:
Oh no, you haven't!
Oh, yes I have, but I cannot describe it or my two customers who read
this froup will know what's up.


Reply With Quote
  #7  
Old   
Obnoxio The Clown
 
Posts: n/a

Default Re: Background processes inside the database. - 10-15-2003 , 04:13 PM



Topher TheRead wrote:

Quote:
Obnoxio The Clown <obnoxio (AT) hotmail (DOT) com> challenged
Oh no, you haven't!

Oh, yes I have, but I cannot describe it or my two customers who read
this froup will know what's up.
I'll take the Pepsi challenge anyday, mate! )

--
Ciao,
The Obnoxious One

"Ogni uomo mi guarda come se fossi una testa di cazzo"


Reply With Quote
  #8  
Old   
fellfrosh
 
Posts: n/a

Default Re: Background processes inside the database. - 10-16-2003 , 06:46 AM



tophertheread (AT) netscape (DOT) net (Topher TheRead) wrote in message news:<719e0031.0310080819.149b63ef (AT) posting (DOT) google.com>...
Quote:
"Jack Parker" <vze2qjg5 (AT) verizon (DOT) net> dashed out a message saying:
You could always go for an intermediate step. Set a flag in a table, have
an OS process (cron scheduled or whatnot) check that table to see if it
should spawn the process you really want to run.

Thanks, Jack, and sorry for the delay responding.

For long and tedious reasons, not worth divulging, we are trying to
eliminate the use of a daemon or polling process. I was hoping that
9.4 would make it unneccessary.
Why don't create a stored procedure and make a system call which
starts a background process?

create procedure system_call ()
....
system ("/mypath/set_environment_script_and_start_whatever &");
....
end procedure;


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.