Message 29

even more strange (de)allocate behaviour

X-Added: With Flames (bblib $Revision: 1.4 $)
Return-path: <xico+@andrew.cmu.edu>
X-Andrew-Authenticated-as: 49947;andrew.cmu.edu;Francisco MacHado Aires Pereira
Received: from po1.andrew.cmu.edu via trymail for bb+academic.cs.15-721@andrew.cmu.edu
          ID </afs/andrew.cmu.edu/usr0/bb/Mailbox/AvfTtAm00UdZ0YPE40>;
          Sun, 23 Sep 2001 11:22:52 -0400 (EDT)
Received: from unix12.andrew.cmu.edu via qmail
          ID </afs/andrew.cmu.edu/service/mailqs/q001/QF.QvfTrVi00UjI01ck5n>;
          Sun, 23 Sep 2001 11:21:05 -0400 (EDT)
Received: from unix12.andrew.cmu.edu via qmail
          ID </afs/andrew.cmu.edu/usr25/xico/.Outgoing/QF.8vfTrV200UjIQ=tH4p>;
          Sun, 23 Sep 2001 11:21:05 -0400 (EDT)
Received: from mms.4.60.Jul.16.2001.15.09.31.sun4.57.EzMail.2.0.CUILIB.3.45.SNAP.NOT.LINKED.unix12.andrew.cmu.edu.sun4x.57
          via MS.5.6.unix12.andrew.cmu.edu.sun4_57;
          Sun, 23 Sep 2001 11:21:04 -0400 (EDT)
Message-ID: <IvfTrUy00UjI8=tGxg@andrew.cmu.edu>
Date: Sun, 23 Sep 2001 11:21:04 -0400 (EDT)
From: Francisco MacHado Aires Pereira <xico+@andrew.cmu.edu>
X-Andrew-Message-Size:    1283+0
Content-Type: text/plain
If-Type-Unsupported: alter
To: Andrew BBoard Account <bb+academic.cs.15-721@andrew.cmu.edu>
Subject: even more strange (de)allocate behaviour
Cc: Leejay.Wu@cs.cmu.edu

Hi,

as Thomas mentioned previously, allocate and deallocate rely on the
Buffer Manager to bring in pages containing information about what's on
the db.
Unfortunately, it's not quite true that we do not have to take this into
bearing when writing our own code, for the reason that follows.

In one of the tests in Test2, the buffer is full with pinned pages and
freePage is called. This, in turn, calls deallocate to destroy the page
in the database.

Because the buffer is full, deallocate will fail when trying to pin and
bring in the page containing database information.

We can get around this by first freeing the frame in the buffer
corresponding to the page that is about to be destroyed, so that the
information page can be loaded in that frame.

This might seem a reasonable thing to do, but note that it would fail if
deallocate used more than one page of database information.

Moreover, it certainly compromises the ability to delete any page on the
database using freePage when the buffer is full and the page we want to
free  is not in the buffer. We don't know if freePage is meant to be
used that way, but maybe it means the specs are not as clear as they
should be.

Hopefully, this will spare other people the time it took us to figure it out...

Francisco and Dan