Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
63c678d1
Commit
63c678d1
authored
Mar 03, 2007
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for COPY-after-truncate feature.
Simon Riggs
parent
ae35867a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
9 deletions
+28
-9
src/backend/catalog/index.c
src/backend/catalog/index.c
+2
-1
src/backend/utils/cache/relcache.c
src/backend/utils/cache/relcache.c
+23
-7
src/include/utils/relcache.h
src/include/utils/relcache.h
+3
-1
No files found.
src/backend/catalog/index.c
View file @
63c678d1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.2
79 2007/02/14 01:58:56 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.2
80 2007/03/03 20:08:41 momjian
Exp $
*
*
*
*
* INTERFACE ROUTINES
* INTERFACE ROUTINES
...
@@ -1250,6 +1250,7 @@ setNewRelfilenode(Relation relation)
...
@@ -1250,6 +1250,7 @@ setNewRelfilenode(Relation relation)
/* Remember we did this in current transaction, to allow later optimisations */
/* Remember we did this in current transaction, to allow later optimisations */
relation
->
rd_newRelfilenodeSubid
=
GetCurrentSubTransactionId
();
relation
->
rd_newRelfilenodeSubid
=
GetCurrentSubTransactionId
();
RelationCacheResetAtEOXact
();
/* Make sure the relfilenode change is visible */
/* Make sure the relfilenode change is visible */
CommandCounterIncrement
();
CommandCounterIncrement
();
...
...
src/backend/utils/cache/relcache.c
View file @
63c678d1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.25
6 2007/02/27 23:48:09 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.25
7 2007/03/03 20:08:41 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1915,9 +1915,6 @@ RelationCacheInvalidateEntry(Oid relationId)
...
@@ -1915,9 +1915,6 @@ RelationCacheInvalidateEntry(Oid relationId)
* so we do not touch new-in-transaction relations; they cannot be targets
* so we do not touch new-in-transaction relations; they cannot be targets
* of cross-backend SI updates (and our own updates now go through a
* of cross-backend SI updates (and our own updates now go through a
* separate linked list that isn't limited by the SI message buffer size).
* separate linked list that isn't limited by the SI message buffer size).
* We don't do anything special for newRelfilenode-in-transaction relations,
* though since we have a lock on the relation nobody else should be
* generating cache invalidation messages for it anyhow.
*
*
* We do this in two phases: the first pass deletes deletable items, and
* We do this in two phases: the first pass deletes deletable items, and
* the second one rebuilds the rebuildable items. This is essential for
* the second one rebuilds the rebuildable items. This is essential for
...
@@ -1960,6 +1957,14 @@ RelationCacheInvalidate(void)
...
@@ -1960,6 +1957,14 @@ RelationCacheInvalidate(void)
if
(
relation
->
rd_createSubid
!=
InvalidSubTransactionId
)
if
(
relation
->
rd_createSubid
!=
InvalidSubTransactionId
)
continue
;
continue
;
/*
* Reset newRelfilenode hint. It is never used for correctness, only
* for performance optimization. An incorrectly set hint can lead
* to data loss in some circumstances, so play safe.
*/
if
(
relation
->
rd_newRelfilenodeSubid
!=
InvalidSubTransactionId
)
relation
->
rd_newRelfilenodeSubid
=
InvalidSubTransactionId
;
relcacheInvalsReceived
++
;
relcacheInvalsReceived
++
;
if
(
RelationHasReferenceCountZero
(
relation
))
if
(
RelationHasReferenceCountZero
(
relation
))
...
@@ -2011,6 +2016,17 @@ RelationCacheInvalidate(void)
...
@@ -2011,6 +2016,17 @@ RelationCacheInvalidate(void)
list_free
(
rebuildList
);
list_free
(
rebuildList
);
}
}
/*
* RelationCacheResetAtEOXact
*
* Register that work will be required at main-transaction commit or abort
*/
void
RelationCacheResetAtEOXact
(
void
)
{
need_eoxact_work
=
true
;
}
/*
/*
* AtEOXact_RelationCache
* AtEOXact_RelationCache
*
*
...
@@ -2161,7 +2177,7 @@ AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid,
...
@@ -2161,7 +2177,7 @@ AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid,
if
(
isCommit
)
if
(
isCommit
)
relation
->
rd_newRelfilenodeSubid
=
parentSubid
;
relation
->
rd_newRelfilenodeSubid
=
parentSubid
;
else
else
relation
->
rd_newRelfilenodeSubid
=
InvalidSubTransactionId
;
relation
->
rd_newRelfilenodeSubid
=
InvalidSubTransactionId
;
}
}
/*
/*
...
@@ -2255,7 +2271,7 @@ RelationBuildLocalRelation(const char *relname,
...
@@ -2255,7 +2271,7 @@ RelationBuildLocalRelation(const char *relname,
rel
->
rd_newRelfilenodeSubid
=
InvalidSubTransactionId
;
rel
->
rd_newRelfilenodeSubid
=
InvalidSubTransactionId
;
/* must flag that we have rels created in this transaction */
/* must flag that we have rels created in this transaction */
need_eoxact_work
=
true
;
RelationCacheResetAtEOXact
()
;
/* is it a temporary relation? */
/* is it a temporary relation? */
rel
->
rd_istemp
=
isTempNamespace
(
relnamespace
);
rel
->
rd_istemp
=
isTempNamespace
(
relnamespace
);
...
@@ -2911,7 +2927,7 @@ RelationSetIndexList(Relation relation, List *indexIds, Oid oidIndex)
...
@@ -2911,7 +2927,7 @@ RelationSetIndexList(Relation relation, List *indexIds, Oid oidIndex)
relation
->
rd_oidindex
=
oidIndex
;
relation
->
rd_oidindex
=
oidIndex
;
relation
->
rd_indexvalid
=
2
;
/* mark list as forced */
relation
->
rd_indexvalid
=
2
;
/* mark list as forced */
/* must flag that we have a forced index list */
/* must flag that we have a forced index list */
need_eoxact_work
=
true
;
RelationCacheResetAtEOXact
()
;
}
}
/*
/*
...
...
src/include/utils/relcache.h
View file @
63c678d1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.5
7 2007/01/05 22:19:59
momjian Exp $
* $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.5
8 2007/03/03 20:08:41
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -60,6 +60,8 @@ extern void RelationCacheInvalidateEntry(Oid relationId);
...
@@ -60,6 +60,8 @@ extern void RelationCacheInvalidateEntry(Oid relationId);
extern
void
RelationCacheInvalidate
(
void
);
extern
void
RelationCacheInvalidate
(
void
);
extern
void
RelationCacheResetAtEOXact
(
void
);
extern
void
AtEOXact_RelationCache
(
bool
isCommit
);
extern
void
AtEOXact_RelationCache
(
bool
isCommit
);
extern
void
AtEOSubXact_RelationCache
(
bool
isCommit
,
SubTransactionId
mySubid
,
extern
void
AtEOSubXact_RelationCache
(
bool
isCommit
,
SubTransactionId
mySubid
,
SubTransactionId
parentSubid
);
SubTransactionId
parentSubid
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment