Re: error: could not find pg_class tuple for index 2662

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: error: could not find pg_class tuple for index 2662
Дата
Msg-id 3568.1312560631@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: error: could not find pg_class tuple for index 2662  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: error: could not find pg_class tuple for index 2662  (daveg <daveg@sonic.net>)
Список pgsql-hackers
I wrote:
> Ahh ... you know what, never mind about stack traces, let's just see if
> the attached patch doesn't fix it.

On reflection, that patch would only fix the issue for pg_class, and
that's not the only catalog that gets consulted during relcache reloads.
I think we'd better do it as attached, instead.

            regards, tom lane

diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 81cea8b..337300f 100644
*** a/src/backend/utils/cache/relcache.c
--- b/src/backend/utils/cache/relcache.c
*************** RelationCacheInvalidate(void)
*** 2159,2164 ****
--- 2159,2169 ----
      List       *rebuildList = NIL;
      ListCell   *l;

+     /*
+      * Reload relation mapping data before starting to reconstruct cache.
+      */
+     RelationMapInvalidateAll();
+
      /* Phase 1 */
      hash_seq_init(&status, RelationIdCache);

*************** RelationCacheInvalidate(void)
*** 2184,2189 ****
--- 2189,2204 ----
          else
          {
              /*
+              * If it's a mapped relation, immediately update its rd_node in
+              * case its relfilenode changed.  We must do this during phase 1
+              * in case the relation is consulted during rebuild of other
+              * relcache entries in phase 2.  It's safe since consulting the
+              * map doesn't involve any access to relcache entries.
+              */
+             if (RelationIsMapped(relation))
+                 RelationInitPhysicalAddr(relation);
+
+             /*
               * Add this entry to list of stuff to rebuild in second pass.
               * pg_class_oid_index goes on the front of rebuildFirstList, other
               * nailed indexes on the back, and everything else into
*************** RelationCacheInvalidate(void)
*** 2209,2219 ****
       */
      smgrcloseall();

-     /*
-      * Reload relation mapping data before starting to reconstruct cache.
-      */
-     RelationMapInvalidateAll();
-
      /* Phase 2: rebuild the items found to need rebuild in phase 1 */
      foreach(l, rebuildFirstList)
      {
--- 2224,2229 ----

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: GetSnapshotData() comments
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Further news on Clang - spurious warnings