System Architecture 2-79
Writing Data to a Blobspace
At the time that the blob data is being transferred, the row itself may not yet
exist. During an insert, for example, the blob is transferred before the rest of
the row data. After the blob is stored, the data row is created with a 56-byte
descriptor that points to the location of the blob. (Refer to page 2-143 for
further information on blob storage and the blob descriptor that is stored in
the data row.)
During the procedure for writing blob data to a blobspace, OnLine attempts
to perform I/O based on the user-defined blobpage size. If, for example, the
blobpage size is 32 KB, OnLine attempts to read or write blob data in 32,768-
byte increments. If the underlying hardware (such as the disk controller)
cannot transfer this amount of data in a single operation, the UNIX kernel
loops internally (in kernel mode) until the transfer is complete. The following
paragraphs describe this procedure as it occurs when a blob is inserted into
a blobspace.
To receive blob data from the application development tool, the OnLine
server process establishes an open blob for the specific table and row,
meaning that a blob is about to be created.
As part of establishing an open blob, a set of blobspace blob buffers is created.
The set is always composed of two buffers, each the size of one blobspace
blobpage. At any time, only one set of blobspace blob buffers can be used to
transfer blobspace blob data. That is, only one user process can transfer
blobspace blob data to the disk at a time. Only the OnLine server process that
established the open blob can gain access to the buffers.
Blob data is transferred from the application development tool to the OnLine
database server in 1-KB chunks. The server process begins filling the buffers
with the 1-KB pieces and attempts to buffer two blobpages at a time. The
reason for the attempt to fill both buffers is to determine if this is the last page
to be written or if a forwarding pointer to the next page is needed. If both
buffers fill, the server process learns that it must add a forwarding pointer to
the data in the first blobpage buffer when it is stored.
When the OnLine server process begins writing the first blobspace blobpage
buffer to disk, it attempts to perform the I/O based on the blobpage size, as
explained earlier.