Probable bug with CreateFakeRelcacheEntry

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Probable bug with CreateFakeRelcacheEntry
Дата
Msg-id 1347327239.4161.20.camel@sussancws0025
обсуждение исходный текст
Ответы Re: Probable bug with CreateFakeRelcacheEntry (now with reproducible test case)  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-bugs
I haven't produced a real problem in a small test case (yet), but I
convinced myself that it's wrong enough to be called a bug.

If you add the following assertion to BufferAlloc:

  Assert(relpersistence == RELPERSISTENCE_PERMANENT ||
         relpersistence == RELPERSISTENCE_UNLOGGED ||
         relpersistence == RELPERSISTENCE_TEMP);

(which seems like a reasonable assertion to me), then do:

  create table foo(i int);
  insert into foo values(1);
  vacuum foo;
  vacuum foo;
  insert into foo values(2);

Then do an immediate shutdown, then restart, you hit the assertion.

The problem is using CreateFakeRelcacheEntry, which has the following
comment:

  Only the fields related to physical storage, like rd_rel, are
  initialized, so the fake entry is only usable in low-level
  operations like ReadBuffer().

That doesn't seem right, because ReadBuffer needs relpersistence set.

One of the consequences is that you can get buffers with the wrong flags
set; in particular, missing BM_PERMANENT, which seems like it could be a
serious problem.

Are there other areas where we might have similar problems?

Regards,
    Jeff Davis

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

Предыдущее
От: Mike Toews
Дата:
Сообщение: Re: initdb.exe changes --locale option
Следующее
От: Dave Page
Дата:
Сообщение: Re: initdb.exe changes --locale option