80
80
* Portions Copyright (c) 1994, Regents of the University of California
81
81
*
82
82
* IDENTIFICATION
83
- * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.95 2010/02/08 04:33:54 tgl Exp $
83
+ * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.96 2010/02/13 16:15:47 sriggs Exp $
84
84
*
85
85
*-------------------------------------------------------------------------
86
86
*/
@@ -861,15 +861,6 @@ xactGetCommittedInvalidationMessages(SharedInvalidationMessage **msgs,
861
861
* ProcessCommittedInvalidationMessages is executed by xact_redo_commit()
862
862
* to process invalidation messages added to commit records.
863
863
*
864
- * If we have to invalidate the relcache init file we need to extract
865
- * the database id from each message so we can correctly locate the database
866
- * path and so remove that database's init file. We note that the relcache
867
- * only contains entries for catalog tables from a single database, or
868
- * shared relations. There are smgr invalidations that reference other
869
- * databases but they never cause relcache file invalidations.
870
- * So we only need to access either global or default tablespaces and
871
- * never have need to scan pg_database to discover tablespace oids.
872
- *
873
864
* Relcache init file invalidation requires processing both
874
865
* before and after we send the SI messages. See AtEOXact_Inval()
875
866
*
@@ -879,79 +870,22 @@ xactGetCommittedInvalidationMessages(SharedInvalidationMessage **msgs,
879
870
*/
880
871
void
881
872
ProcessCommittedInvalidationMessages (SharedInvalidationMessage * msgs ,
882
- int nmsgs , bool RelcacheInitFileInval )
873
+ int nmsgs , bool RelcacheInitFileInval ,
874
+ Oid dbid , Oid tsid )
883
875
{
884
- Oid dboid = 0 ;
885
- bool invalidate_global = false ;
876
+ if ( nmsgs < = 0 )
877
+ return ;
886
878
887
- if (nmsgs > 0 )
888
- elog (trace_recovery (DEBUG4 ), "replaying commit with %d messages%s" , nmsgs ,
879
+ elog (trace_recovery (DEBUG4 ), "replaying commit with %d messages%s" , nmsgs ,
889
880
(RelcacheInitFileInval ? " and relcache file invalidation" : "" ));
890
- else
891
- return ;
892
881
893
882
if (RelcacheInitFileInval )
894
- {
895
- int i ;
896
-
897
- /*
898
- * Check messages to record dboid
899
- */
900
- for (i = 0 ; i < nmsgs ; i ++ )
901
- {
902
- SharedInvalidationMessage * inval_msg = & (msgs [i ]);
903
- Oid loop_dboid = 0 ;
904
-
905
- /*
906
- * Extract the database Oid from the message
907
- */
908
- if (inval_msg -> id >= 0 )
909
- loop_dboid = inval_msg -> cc .dbId ;
910
- else if (inval_msg -> id == SHAREDINVALRELCACHE_ID )
911
- loop_dboid = inval_msg -> rc .dbId ;
912
- else
913
- {
914
- /*
915
- * Invalidation message is a catalog or nontransactional inval,
916
- * which never cause relcache file invalidation,
917
- * so we ignore them, no matter which db they're for.
918
- */
919
- continue ;
920
- }
921
-
922
- if (loop_dboid == 0 )
923
- invalidate_global = true;
924
- else
925
- {
926
- Assert (dboid == 0 || dboid == loop_dboid );
927
- dboid = loop_dboid ;
928
- }
929
- }
930
-
931
- /*
932
- * If shared, dboid will be the global tablespace, otherwise it will
933
- * be a local catalog relation in the default tablespace.
934
- */
935
- if (invalidate_global )
936
- RecoveryRelationCacheInitFileInvalidate (0 , GLOBALTABLESPACE_OID , true);
937
-
938
- if (dboid != 0 )
939
- RecoveryRelationCacheInitFileInvalidate (dboid , DEFAULTTABLESPACE_OID , true);
940
- }
883
+ RecoveryRelationCacheInitFileInvalidate (dbid , tsid , true);
941
884
942
885
SendSharedInvalidMessages (msgs , nmsgs );
943
886
944
887
if (RelcacheInitFileInval )
945
- {
946
- /*
947
- * Second invalidation, very similar to above. See RelationCacheInitFileInvalidate()
948
- */
949
- if (invalidate_global )
950
- RecoveryRelationCacheInitFileInvalidate (0 , GLOBALTABLESPACE_OID , false);
951
-
952
- if (dboid != 0 )
953
- RecoveryRelationCacheInitFileInvalidate (dboid , DEFAULTTABLESPACE_OID , false);
954
- }
888
+ RecoveryRelationCacheInitFileInvalidate (dbid , tsid , false);
955
889
}
956
890
957
891
/*
0 commit comments