.ad 8
.bm 8
.fm 4
.bt $Copyright (c) 2000-2004 SAP AG$$Page %$
.tm 12
.hm 6
.hs 3
.tt 1 $SQL$Project Distributed Database System$VAK95$
.tt 2 $$$
.tt 3 $ElkeZ$Timeoutprocess$2000-11-10$
***********************************************************
.nf
 
 
    ========== licence begin  GPL
    Copyright (c) 2000-2004 SAP AG
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    ========== licence end
 
.fo
.nf
.sp
Module  : Timeoutprocess
=========
.sp
Purpose : This module controls the request- and lock timeout
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :
 
        PROCEDURE
              a95_timeout_process (VAR t : tgg00_TransContext);
 
.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :
 
        FROM
              Kernel_Sink_1 : VAK341;
 
        PROCEDURE
              ak341OmsInspectTimeout;
 
      ------------------------------ 
 
        FROM
              pagestore : VBD10;
 
        PROCEDURE
              bd10CheckAndStartSavepoint( VAR Trans : tgg00_TransContext );
 
      ------------------------------ 
 
        FROM
              object_garbage_collection : VBD91;
 
        PROCEDURE (* PTS 1116157 FF 2002-06-07 *)
              bd91StartOMSGarbageCollectionIfRequired (VAR Trans : tgg00_TransContext);
 
      ------------------------------ 
 
        FROM
              KB_locklist : VKB51;
 
        PROCEDURE
              k51clear_locklist (VAR t : tgg00_TransContext);
 
      ------------------------------ 
 
        FROM
              KB_Logging : VKB560;
 
        PROCEDURE
              kb560CheckForLogSaveAndSavepoint (VAR trans : tgg00_TransContext);
 
      ------------------------------ 
 
        FROM
              Configuration_Parameter : VGG01;
 
        FUNCTION
              g01is_livecache : boolean;
 
      ------------------------------ 
 
        FROM
              KernelAdministration_Interface : VGG999;
 
        FUNCTION
              gg999KernelStateIsOnline : boolean;
 
        PROCEDURE
              gg999TriggerSynchronize (VAR trans : tgg00_TransContext);
 
      ------------------------------ 
 
        FROM
              RTE_kernel : VEN101;
 
        PROCEDURE
              vclock (
                    VAR sec      : tsp00_Int4;
                    VAR microsec : tsp00_Int4);
 
        PROCEDURE
              vsleep (
                    pid   : tsp00_TaskId;
                    limit : tsp00_Int2);
 
.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :
 
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : ElkeZ
.sp
.cp 3
Created : 1983-07-29
.sp
.cp 3
.sp
.cp 3
Release :      Date : 2000-11-10
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:
.CM *-END-* specification -------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:
.sp 2
TIMEOUT_HANDLING
.sp
The control of the two timeout values
takes place in this procedure with the aid of
two KB procedures. Timeout control need only operate during warm operation;
during cold operation, it is possible at most for the utility process to be in
the Lock/Request list anyway.
.br;It is essential for the Lock list to be checked first before the Request
list is checked, so that a process does not perform a rollback for itself
(thrown out of the Request list) and so that the timeout process performs the
rollback for the same process, because it threw it out of the Lock list.
.br;The Lock list timeout and the Request list timeout run independently of one
another in time.
.sp 2;A95_TIMEOUT_PROCESS
.sp
Only the Trans_no is initialized for the timeout process, with the process
requiring this entry when it performs rollbacks for other processes.
.br;Then the process sleeps in a loop until one of the two timeout values has
to be controlled and TIMEOUT_HANDLING is called.
It is then determined how long the
process again has to sleep for until the next timeout value has to be
controlled.
.br;The loop is endless.
.CM *-END-* description ---------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.nf
.oc _/1
Structure:
 
.CM *-END-* structure -----------------------------------
.sp 2
**********************************************************
.sp
.cp 10
.nf
.oc _/1
.CM -lll-
Code    :
 
 
(*------------------------------*) 
 
PROCEDURE
      ak95timeout_handling (VAR t : tgg00_TransContext);
 
BEGIN
IF  gg999KernelStateIsOnline
THEN
    BEGIN
    k51clear_locklist (t);
    IF  (t.trError_gg00 = e_ok) AND g01is_livecache
    THEN
        ak341OmsInspectTimeout; (* PTS 1110287 *)
    (*ENDIF*) 
    IF  t.trError_gg00 = e_ok
    THEN
        kb560CheckForLogSaveAndSavepoint (t);
    (*ENDIF*) 
    IF  t.trError_gg00 = e_ok
    THEN
        gg999TriggerSynchronize (t);
    (*ENDIF*) 
    END;
(*ENDIF*) 
IF  (t.trError_gg00 = e_ok) AND g01is_livecache
THEN
    bd91StartOMSGarbageCollectionIfRequired (t); (* PTS 1116157 FF 2002-06-07 *)
(*ENDIF*) 
IF  (t.trError_gg00 = e_ok)
THEN
    bd10CheckAndStartSavepoint(t);
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a95_timeout_process (VAR t : tgg00_TransContext);
 
VAR
      do_forever      : boolean;
      timeout_value   : tsp00_Int4;
      timeout_interval: tsp00_Int4;
      start_time      : tsp00_Int4;
      stop_time       : tsp00_Int4;
      microsec        : tsp00_Int4;
 
BEGIN
do_forever := true;
(* "&ifdef NOTUSED" removed: PTS 1108234 JA 2000-11-08 *)
IF  g01is_livecache (* PTS 1110314 *)
THEN
    timeout_interval := cgg04_lc_timeout_interval
ELSE
    timeout_interval := cgg04_timeout_interval;
(*ENDIF*) 
timeout_value := timeout_interval;
WHILE do_forever DO
    BEGIN
    WITH t DO
        BEGIN
        trIndex_gg00     := cgg_nil_transindex;
        trTempCount_gg00 := 0;
        trError_gg00     := e_ok;
        trState_gg00     := [ ];
        trWarning_gg00   := [ ]
        END;
    (*ENDWITH*) 
    vsleep (t.trTaskId_gg00, timeout_value);
    vclock (start_time, microsec);
    ak95timeout_handling (t);
    vclock (stop_time, microsec);
    timeout_value := timeout_interval - (stop_time - start_time);
    IF  timeout_value < 0
    THEN
        timeout_value := 0; (* reschedule *)
    (* just to make aix-kompilation warning-free *)
    (*ENDIF*) 
    do_forever := (timeout_value >= 0);
    END
(*ENDWHILE*) 
END;
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
.PA 
