The following example explains how the system synchronizes the local buffers. We have a system with two application servers, called Server1 and Server2.
Initial situation: neither server has accessed the records of the fully buffered table TAB yet. The local buffers of both servers do not yet contain the records of the table. The following 12 steps describe the buffer synchronization in detail.
- Server 1 reads records from table TAB in the database.
- Table TAB is completely loaded into the local buffer of Server 1. Accesses by Server 1 to the data of table TAB now use the local buffer of this server.
- Server 2 accesses records of the table. Since the table is not yet in the local buffer of Server 2, the records are read directly from the database.
- Table TAB is completely loaded into the local buffer of Server 2. Server 2 then also accesses the data in TAB using its local buffer the next time it reads.
- Server 1 deletes records from table TAB and updates the database.
- Server 1 writes an entry in the synchronization table.
- Server 1 updates its local buffer.
- Server 2 accesses the deleted data records. Since table TAB is in its local buffer, access uses this local buffer.
Server 2 finds the records, although they are no longer in the database table.
If an application program on Server 1 executes the same access , this program would see that the records no longer exist. The behavior of an application program at this time depends on the server on which it is executing.
- It is now time for synchronization. Both servers check the synchronization table to find out whether one of the tables in its local buffer has been changed in the meantime.
- Server 2 finds that table TAB was modified by Server 1 in the meantime. Server 2 invalidates the table in its local buffer. The next time Server 2 accesses the data in table TAB, it uses the database. Server 1 does not have to invalidate the table in its buffer because it alone changed table TAB. Server 1 uses its local buffer the next time it accesses records of table TAB.
- The system has already invalidated TAB in the local buffer of Server 2. When Server 2 again accesses records of table TAB, it accesses directly to the database.
- The system loads again the table into the local buffer of Server 2. The information about table TAB is now consistent for both servers and the database.