| 1 |
<!-- $Id: Session_control.html,v 1.5 1999/04/28 13:13:23 fw Exp $ --> |
| 2 |
<head> |
| 3 |
<title>Session_control</title> |
| 4 |
</head> |
| 5 |
|
| 6 |
<BODY BGCOLOR=#ffffff> |
| 7 |
|
| 8 |
<h2>Acedb sessions and the control window</h2> |
| 9 |
|
| 10 |
|
| 11 |
<H3>What is session ?</H3> |
| 12 |
In Acedb a session can be thought of as a collection of modifications |
| 13 |
between "Gain write access" and "Save" actions. |
| 14 |
<P> |
| 15 |
When the database starts up, this initial state is session 1. Every |
| 16 |
time the user gains write access, a new session (called <B>This_session</B>) |
| 17 |
is derived from the previous. |
| 18 |
Sessions are given sequential numbers. All initial additions before first save |
| 19 |
after the database was initialized will be stored in session 2. |
| 20 |
Changes to the new objects are newly added ones are stored in Session 3 etc. |
| 21 |
<P> |
| 22 |
A new session inherits all the data from its predecessor and it will also |
| 23 |
store modifications. |
| 24 |
<P> |
| 25 |
Objects can modified either interactively or by parsing ace-files. |
| 26 |
Until the user saves, all modified objects are held in a cache. |
| 27 |
When the database saves it copies those modified objects 'flushed' |
| 28 |
out of the cache and copied into the main-database. |
| 29 |
<P> |
| 30 |
Any user starting the database after that "save" will be able to 'see' |
| 31 |
the changes. Users who started the same database before that "save" |
| 32 |
occurred will not notice the changes and continue looking at the |
| 33 |
old data (if they happen to look at an object which was modified). |
| 34 |
<P> |
| 35 |
|
| 36 |
<H3>Session garbage collection</H3> |
| 37 |
|
| 38 |
When a new process starts up the database, it build up an image |
| 39 |
of where objects are stored in the database. This enables it to |
| 40 |
quickly find an object on disk and display it on the screen. |
| 41 |
<P> |
| 42 |
When objects are added or modified in a new session they are stored |
| 43 |
in a different place in the database. This way an process that has started |
| 44 |
before the save can still find the older objects in their original place, |
| 45 |
and the user can continue browsing the database. |
| 46 |
<P> |
| 47 |
There is however an overhead to this. If every old version of an object was |
| 48 |
kept in the database it would quickly grow out of proportion. |
| 49 |
This is why the database flushes older data out of the database in regular intervals |
| 50 |
to reclaim their disk space. That is a process known as garbage collection. |
| 51 |
<P> |
| 52 |
All changes to the database are always nicely bundled into a session. It is therefor |
| 53 |
convenient to destroy older sessions, every time a new one is saved. |
| 54 |
For reasons of data security a certain number of older sessions is kept alive. |
| 55 |
This number is usually 2 or 3 and it can be configured for a given database |
| 56 |
by adding this line to the file <CODE>wspec/database.wrm</CODE>: |
| 57 |
|
| 58 |
<BLOCKQUOTE>SESSION_KEEP_ALIVE 2</BLOCKQUOTE> |
| 59 |
|
| 60 |
This configuration feature is available since version 4.7b, earlier versions |
| 61 |
will most likely use the number 2 by default. It may be configured to be bigger |
| 62 |
than that, but the smallest number allowed is 2. |
| 63 |
<P> |
| 64 |
|
| 65 |
<H3>Session read-locks</H3> |
| 66 |
|
| 67 |
We have discussed the notion of processes still being able to browse |
| 68 |
objects in their original place in the database, although another process |
| 69 |
has updated the database which has moved some objects to a new location. |
| 70 |
If an updating process performs a lot of saves, it may 'garbage collect' |
| 71 |
older sessions. This would crash a process that was still looking at objects from |
| 72 |
older sessions, if their sessions were deleted virtually under their feet |
| 73 |
by another updating process. |
| 74 |
<P> |
| 75 |
A protection mechanism is available since version 4.7b to protect such session |
| 76 |
from deletion if another program is still looking at it. This mechanism is called a |
| 77 |
"read-lock". It tells the database if there are any programs still browsing through |
| 78 |
data from older sessions before destroying them. |
| 79 |
<P> |
| 80 |
When the database quits normally its read-lock is removed and its sessions |
| 81 |
must no longer be kept alive. If however, the database exited in an unexpected way |
| 82 |
(like a computer failure or a program crash) it's read-lock may remain in the database. |
| 83 |
For this reason, every read-lock which is older than a certain time-span is ignored |
| 84 |
by an updating program which checks which old sessions can be destroyed. |
| 85 |
In Acedb version 4.7b this 'grace_period' is fixed to 8 hours, but it may become |
| 86 |
configurable in future releases. |
| 87 |
<P> |
| 88 |
|
| 89 |
<HR> |
| 90 |
This is an example of a session control window : |
| 91 |
|
| 92 |
<P><IMG SRC="sessctrl.gif" WIDTH=580 HEIGHT=607></P> |
| 93 |
|
| 94 |
<P>to <a href="TOC.html">Table of Contents</a><p> |
| 95 |
|
| 96 |
last edited: Dec 1998<p> |
| 97 |
|
| 98 |
</BODY> |
| 99 |
|
| 100 |
<!-- |
| 101 |
********************************************************************* |
| 102 |
************************ CVS change log ***************************** |
| 103 |
********************************************************************* |
| 104 |
|
| 105 |
$Log: Session_control.html,v $ |
| 106 |
Revision 1.5 1999/04/28 13:13:23 fw |
| 107 |
added BODY tag with white BGCOLOR |
| 108 |
|
| 109 |
Revision 1.4 1999/03/22 14:45:41 fw |
| 110 |
corrected syntax of comment at the top |
| 111 |
|
| 112 |
Revision 1.3 1999/01/15 18:13:22 fw |
| 113 |
first version of this file with actual content, |
| 114 |
it explains acedb sessions, garbage collection of old sessions |
| 115 |
and readlocks. |
| 116 |
It will need work, as novice users may not understand what I'm talking about. |
| 117 |
|
| 118 |
|
| 119 |
--> |