inv_api.c
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:32k
- /*-------------------------------------------------------------------------
- *
- * inv_api.c
- * routines for manipulating inversion fs large objects. This file
- * contains the user-level large object application interface routines.
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- *
- * IDENTIFICATION
- * $Header: /usr/local/cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.53 1999/05/25 16:11:15 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
- #include <sys/types.h>
- #include <stdio.h> /* for sprintf() */
- #include <string.h>
- #include <sys/file.h>
- #include <sys/stat.h>
- #include "postgres.h"
- #include "access/genam.h"
- #include "access/heapam.h"
- #include "access/relscan.h"
- #include "access/tupdesc.h"
- #include "access/transam.h"
- #include "access/xact.h"
- #include "access/nbtree.h"
- #include "access/tupdesc.h"
- #include "catalog/catalog.h" /* for newoid() */
- #include "catalog/heap.h"
- #include "catalog/index.h" /* for index_create() */
- #include "catalog/pg_am.h" /* for BTREE_AM_OID */
- #include "catalog/pg_type.h" /* for INT4OID */
- #include "catalog/pg_opclass.h" /* for INT4_OPS_OID */
- #include "fmgr.h"
- #include "libpq/libpq-fs.h"
- #include "miscadmin.h"
- #include "nodes/pg_list.h"
- #include "storage/itemptr.h"
- #include "storage/bufpage.h"
- #include "storage/bufmgr.h"
- #include "storage/large_object.h"
- #include "storage/lmgr.h"
- #include "storage/smgr.h"
- #include "utils/builtins.h" /* for namestrcpy() */
- #include "utils/rel.h"
- #include "utils/relcache.h"
- /*
- * Warning, Will Robinson... In order to pack data into an inversion
- * file as densely as possible, we violate the class abstraction here.
- * When we're appending a new tuple to the end of the table, we check
- * the last page to see how much data we can put on it. If it's more
- * than IMINBLK, we write enough to fill the page. This limits external
- * fragmentation. In no case can we write more than IMAXBLK, since
- * the 8K postgres page size less overhead leaves only this much space
- * for data.
- */
- /*
- * In order to prevent buffer leak on transaction commit, large object
- * scan index handling has been modified. Indexes are persistant inside
- * a transaction but may be closed between two calls to this API (when
- * transaction is committed while object is opened, or when no
- * transaction is active). Scan indexes are thus now reinitialized using
- * the object current offset. [PA]
- *
- * Some cleanup has been also done for non freed memory.
- *
- * For subsequent notes, [PA] is Pascal Andr