mirror of
https://github.com/postgres/postgres.git
synced 2025-11-15 03:41:20 +03:00
Use Snapshot in heap access methods.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.9 1998/06/15 19:29:36 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.10 1998/07/27 19:38:18 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -72,8 +72,8 @@ int4notin(int16 not_in_arg, char *relation_and_attr)
|
||||
/* the last argument should be a ScanKey, not an integer! - jolly */
|
||||
/* it looks like the arguments are out of order, too */
|
||||
/* but skeyData is never initialized! does this work?? - ay 2/95 */
|
||||
scan_descriptor = heap_beginscan(relation_to_scan, false, false, 0,
|
||||
&skeyData);
|
||||
scan_descriptor = heap_beginscan(relation_to_scan, false, SnapshotNow,
|
||||
0, &skeyData);
|
||||
|
||||
retval = true;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.20 1998/07/20 16:57:01 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.21 1998/07/27 19:38:19 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -55,7 +55,7 @@ regprocin(char *proname)
|
||||
(RegProcedure) F_NAMEEQ,
|
||||
(Datum) proname);
|
||||
|
||||
procscan = heap_beginscan(proc, 0, false, 1, &key);
|
||||
procscan = heap_beginscan(proc, 0, SnapshotNow, 1, &key);
|
||||
if (!HeapScanIsValid(procscan))
|
||||
{
|
||||
heap_close(proc);
|
||||
@@ -111,7 +111,7 @@ regprocout(RegProcedure proid)
|
||||
(RegProcedure) F_INT4EQ,
|
||||
(Datum) proid);
|
||||
|
||||
procscan = heap_beginscan(proc, 0, false, 1, &key);
|
||||
procscan = heap_beginscan(proc, 0, SnapshotNow, 1, &key);
|
||||
if (!HeapScanIsValid(procscan))
|
||||
{
|
||||
heap_close(proc);
|
||||
@@ -189,7 +189,7 @@ oid8types(Oid (*oidArray)[])
|
||||
(RegProcedure) F_INT4EQ,
|
||||
(Datum) *sp);
|
||||
|
||||
typescan = heap_beginscan(type, 0, false, 1, &key);
|
||||
typescan = heap_beginscan(type, 0, SnapshotNow, 1, &key);
|
||||
if (!HeapScanIsValid(typescan))
|
||||
{
|
||||
heap_close(type);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.19 1998/06/15 19:29:37 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.20 1998/07/27 19:38:20 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -349,7 +349,7 @@ gethilokey(Oid relid,
|
||||
key[0].sk_argument = ObjectIdGetDatum(relid);
|
||||
key[1].sk_argument = Int16GetDatum((int16) attnum);
|
||||
key[2].sk_argument = ObjectIdGetDatum(opid);
|
||||
sdesc = heap_beginscan(rdesc, 0, false, 3, key);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 3, key);
|
||||
tuple = heap_getnext(sdesc, 0, (Buffer *) NULL);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.14 1998/07/20 16:57:02 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.15 1998/07/27 19:38:21 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -123,7 +123,7 @@ SetDefine(char *querystr, char *typename)
|
||||
oidKey[0].sk_argument = ObjectIdGetDatum(setoid);
|
||||
pg_proc_scan = heap_beginscan(procrel,
|
||||
0,
|
||||
true,
|
||||
SnapshotSelf,
|
||||
1,
|
||||
oidKey);
|
||||
tup = heap_getnext(pg_proc_scan, 0, &buffer);
|
||||
|
||||
4
src/backend/utils/cache/catcache.c
vendored
4
src/backend/utils/cache/catcache.c
vendored
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.30 1998/07/20 16:57:03 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.31 1998/07/27 19:38:22 vadim Exp $
|
||||
*
|
||||
* Notes:
|
||||
* XXX This needs to use exception.h to handle recovery when
|
||||
@@ -994,7 +994,7 @@ SearchSysCache(struct catcache * cache,
|
||||
*/
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
|
||||
sd = heap_beginscan(relation, 0, false,
|
||||
sd = heap_beginscan(relation, 0, SnapshotNow,
|
||||
cache->cc_nkeys, cache->cc_skey);
|
||||
|
||||
/* should this buffer be ReleaseBuffer'd? --djm 8/20/96 */
|
||||
|
||||
16
src/backend/utils/cache/relcache.c
vendored
16
src/backend/utils/cache/relcache.c
vendored
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.43 1998/07/26 04:30:57 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.44 1998/07/27 19:38:23 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -53,11 +53,7 @@
|
||||
#include "catalog/indexing.h"
|
||||
#include "catalog/pg_aggregate.h"
|
||||
#include "catalog/pg_attrdef.h"
|
||||
#ifdef MULTIBYTE
|
||||
#include "catalog/pg_attribute_mb.h"
|
||||
#else
|
||||
#include "catalog/pg_attribute.h"
|
||||
#endif
|
||||
#include "catalog/pg_index.h"
|
||||
#include "catalog/pg_proc.h"
|
||||
#include "catalog/pg_class.h"
|
||||
@@ -376,7 +372,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
|
||||
if (!IsInitProcessingMode())
|
||||
RelationSetLockForRead(pg_class_desc);
|
||||
pg_class_scan =
|
||||
heap_beginscan(pg_class_desc, 0, false, 1, &key);
|
||||
heap_beginscan(pg_class_desc, 0, SnapshotNow, 1, &key);
|
||||
pg_class_tuple = heap_getnext(pg_class_scan, 0, &buf);
|
||||
|
||||
/* ----------------
|
||||
@@ -546,7 +542,7 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
|
||||
*/
|
||||
pg_attribute_desc = heap_openr(AttributeRelationName);
|
||||
pg_attribute_scan =
|
||||
heap_beginscan(pg_attribute_desc, 0, false, 1, &key);
|
||||
heap_beginscan(pg_attribute_desc, 0, SnapshotNow, 1, &key);
|
||||
|
||||
/* ----------------
|
||||
* add attribute data to relation->rd_att
|
||||
@@ -717,7 +713,7 @@ RelationBuildRuleLock(Relation relation)
|
||||
*/
|
||||
pg_rewrite_desc = heap_openr(RewriteRelationName);
|
||||
pg_rewrite_scan =
|
||||
heap_beginscan(pg_rewrite_desc, 0, false, 1, &key);
|
||||
heap_beginscan(pg_rewrite_desc, 0, SnapshotNow, 1, &key);
|
||||
pg_rewrite_tupdesc =
|
||||
RelationGetTupleDescriptor(pg_rewrite_desc);
|
||||
|
||||
@@ -1705,7 +1701,7 @@ AttrDefaultFetch(Relation relation)
|
||||
break;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(adrel, false, iptr, &buffer);
|
||||
tuple = heap_fetch(adrel, SnapshotNow, iptr, &buffer);
|
||||
pfree(indexRes);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
continue;
|
||||
@@ -1793,7 +1789,7 @@ RelCheckFetch(Relation relation)
|
||||
break;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(rcrel, false, iptr, &buffer);
|
||||
tuple = heap_fetch(rcrel, SnapshotNow, iptr, &buffer);
|
||||
pfree(indexRes);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
continue;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.13 1998/07/26 04:31:07 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.14 1998/07/27 19:38:26 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -22,12 +22,7 @@
|
||||
#include "access/heapam.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/catname.h"
|
||||
#ifdef MULTIBYTE
|
||||
#include "catalog/pg_database_mb.h"
|
||||
#include "mb/pg_wchar.h"
|
||||
#else
|
||||
#include "catalog/pg_database.h"
|
||||
#endif
|
||||
#include "fmgr.h"
|
||||
#include "miscadmin.h"
|
||||
#include "storage/bufmgr.h"
|
||||
@@ -62,7 +57,7 @@ GetDatabaseInfo(char *name, Oid *owner, char *path)
|
||||
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
|
||||
F_NAMEEQ, NameGetDatum(name));
|
||||
|
||||
scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
|
||||
scan = heap_beginscan(dbrel, 0, SnapshotNow, 1, &scanKey);
|
||||
if (!HeapScanIsValid(scan))
|
||||
elog(ERROR, "GetDatabaseInfo: cannot begin scan of %s", DatabaseRelationName);
|
||||
|
||||
@@ -184,11 +179,7 @@ ExpandDatabasePath(char *dbpath)
|
||||
* --------------------------------
|
||||
*/
|
||||
void
|
||||
#ifdef MULTIBYTE
|
||||
GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path, int *encoding)
|
||||
#else
|
||||
GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path)
|
||||
#endif
|
||||
{
|
||||
int dbfd;
|
||||
int fileflags;
|
||||
@@ -275,25 +266,14 @@ GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path)
|
||||
* means of getting at sys cat attrs.
|
||||
*/
|
||||
tup_db = (Form_pg_database) GETSTRUCT(tup);
|
||||
#ifdef MULTIBYTE
|
||||
/* get encoding from template database.
|
||||
This is the "default for default" for
|
||||
create database command.
|
||||
*/
|
||||
if (strcmp("template1",tup_db->datname.data) == 0)
|
||||
{
|
||||
SetTemplateEncoding(tup_db->encoding);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcmp(name, tup_db->datname.data) == 0)
|
||||
{
|
||||
*db_id = tup->t_oid;
|
||||
strncpy(path, VARDATA(&(tup_db->datpath)),
|
||||
(VARSIZE(&(tup_db->datpath)) - VARHDRSZ));
|
||||
*(path + VARSIZE(&(tup_db->datpath)) - VARHDRSZ) = '\0';
|
||||
#ifdef MULTIBYTE
|
||||
*encoding = tup_db->encoding;
|
||||
#endif
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user