Logging & file Load on startup

Hi,

I am trying to use following command to start q instance

w32\q.exe Common -p 2029 -L

Or

w32\q.exe Common/starter.q -p 2029 -L

Above commands work without -L or -l option. But not able to run together. I am getting following error in 2nd Case:

'Common/starter.q

I want to load initial script on q startup and any changes later must be logged and on the restart of the q, i should get all my changes back. Looks like i am doing something wrong.

From: http://code.kx.com/wiki/Cookbook/Logging

if starting these processes from different directories, be sure to specify the absolute path for the logging process, e.g.

q /mylogs/test -l -p 5000

the replicating process will receive this information when it connects. On startup, the replicating process will load the .qdb file and play back the log file, and continue to receive updates via ipc.

Thanks Manish for the reply. I went through the above article and also following one:
http://www.kx.com/q/d/help.q

but somehow I am not able to understand it. I have to load starter.q file with -l command. Not sure how to do it. Or only qdf files can be loaded.

Hi Vikas,

Could you explain the specific problem a little bit more.

As an example; here’s what I would do (let me know if it’s relevant!);

So I have a q script called ‘tick.q’ in this directory ‘/home/chromozorz/KDBPlus_3_1_0/q’

To load this script (and a port) whilst starting q, I would type ‘q /home/chromozorz/KDBPlus_3_1_0/q/tick.q -p 5003’.

This works perfectly fine. If I wanted this script to be loaded every time I started q (and a specific port opened); all I need to do is add the following lines to the file ‘q.q’ (if it doesn’t exist, then create it.)


\l /home/chromozorz/KDBPlus_3_1_0/q/tick.q;

\p 5003;

Then I can just open q and the script will be loaded and port 5003 will be opened automatically.

Thanks,

Chromozorz

Btw, if you added those lines to your q.q file, then just type ‘w32\q.exe’ and your script will be loaded and port opened automatically.

""

Hi Vikas,

Could you explain the specific problem a little bit more.

As an example; here’s what I would do (let me know if it’s relevant!);

So I have a q script called ‘tick.q’ in this directory ‘/home/chromozorz/KDBPlus_3_1_0/q’


To load this script (and a port) whilst starting q, I would type ‘q /home/chromozorz/KDBPlus_3_1_0/q/tick.q -p 5003’.


This works perfectly fine. If I wanted this script to be loaded every time I started q (and a specific port opened); all I need to do is add the following lines to the file ‘q.q’ (if it doesn’t exist, then create it.)

--------------------------------------------------------------------------------

\l /home/chromozorz/KDBPlus_3_1_0/q/tick.q;

\p 5003;
--------------------------------------------------------------------------------


Then I can just open q and the script will be loaded and port 5003 will be opened automatically.

Thanks,

Chromozorz

Btw, if you added those lines to your q.q file, then just type ‘w32\q.exe’ and your script will be loaded and port opened automatically.

Thanks Michael.
I was not knowing that we can use q.q for loading initial scripts. It works great for the first time, when there is no log or qdb file. Not sure but for me q.q file was not working or the calls get overridden if using Log.

I did following to make initial load of functions and data work in case of failure.

  1. Started Q with following options

w32\q.exe Common/log -l -p 2029

  1. Places log.q in Common folder, that will just load functions. Because when q gets terminated log/qdb file contains only commands/data.

  2. Loaded initial data in q prompt and issued \l command for checkpoint that created qdb file with all data. Only issue i can see is that size of the qdb file is much larger than normal backup file using set command for whole workspace.

  3. Now even if q restarts then initial functions and data gets loaded.

Need more insights that if I am doing things correct and if any way i can reduce the size of qdb file.