Consultor Eletrônico



Kbase 15785: The database lock file ( .lk ), How Progress uses it.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
The database lock file ( .lk ), How Progress uses it.

INTRODUCTION
The database lock file (.lk) is the only protection we have against
multiple processes starting the database. If multiple processes are
allowed to start the database, then crash recovery will not work!!
=====================================================================

ERROR ERROR TEXT
===== ===============================================================
263 ** The database <file-name> is in use in single-user mode.
276 ** The database <file-name> is in use in multi-user mode.

WHAT'S IN THE LOCK FILE?
=====================================================================
The .lk file contains three pieces of information:
1) The mode in which the database was started.
2) The process id (pid) of the process that started the database.
3) The hostname where the process that started it is running.

HOW DOES PROGRESS USE THIS INFORMATION?
=====================================================================
When a process attempts to start a database it first tests for the
existance of a .lk file. If there is no .lk file, the process
creates it and starts up the database.

If a .lk file already exists, the process reads it to determine if it
is a valid .lk file. This determination is done as follows:

1)Do a gethostname(2) call. This should return the same information
as a uname -n command. If this call fails, then no determination
can be made about the .lk file, so we assume it is valid. Go to
step 6.

2)Check if the hostname returned by the gethostname(2) call matches
the hostname stored in the .lk file. If it does not match, then
no determination can be made about the .lk file, so we assume it is
valid. Go to step 6.

3)If the hostname matches (that is, we are on the same host that is
in the .lk file), check if the pid stored in the .lk file is an
active pid on the system.

4)If the pid is not active, then the .lk file is not valid, so we
remove the existing .lk file, create a new one and startup the
database.

5)If the pid is active, then the .lk file is valid and we cannot
startup the database.

6)If the .lk file is valid, give a message appropriate to the mode
entry in the .lk file.

Progress Software Technical Support Note # 15785