提交 5f765a8e 编写于 作者: A Asim R P

Do not read a persistent tuple after it is freed

This bug was found in a production environment where vacuum on
gp_persistent_relation was concurrently running with a backend
performing end-of-xact filesystem operations.  And the GUC
debug_persistent_print was enabled.

The *_ReadTuple() function was called on a persistent TID after the
corresponding tuple was deleted with frozen transaction ID.  The
concurrent vacuum recycled the tuple and it led to a SIGSEGV when the
backend tried to access values from the tuple.

Fix it by avoiding the debug log message in case when the persistent
tuple is freed (transitioning to FREE state).  All other state
transitions are logged.

In absence of concurrent vacuum, things worked just fine because the
*_ReadTuple() interface reads tuples from persistent tables directly
using TID.
上级 b50c134b
......@@ -1567,11 +1567,26 @@ PersistentFileSysObjStateChangeResult PersistentFileSysObj_StateChange(
pfree(newValues);
pfree(replaces);
if (Debug_persistent_print)
{
heap_freetuple(tupleCopy);
PersistentFileSysObj_ReadTuple(
fsObjType,
persistentTid,
values,
&tupleCopy);
(*fileSysObjData->storeData.printTupleCallback)(
Persistent_DebugPrintLevel(),
"STATE CHANGE",
persistentTid,
values);
}
}
else
{
heap_freetuple(tupleCopy);
PersistentFileSysObj_FreeTuple(
fileSysObjData,
fileSysObjSharedData,
......@@ -1580,23 +1595,7 @@ PersistentFileSysObjStateChangeResult PersistentFileSysObj_StateChange(
flushToXLog);
}
if (Debug_persistent_print)
{
PersistentFileSysObj_ReadTuple(
fsObjType,
persistentTid,
values,
&tupleCopy);
(*fileSysObjData->storeData.printTupleCallback)(
Persistent_DebugPrintLevel(),
"STATE CHANGE",
persistentTid,
values);
heap_freetuple(tupleCopy);
}
heap_freetuple(tupleCopy);
pfree(values);
return PersistentFileSysObjStateChangeResult_StateChangeOk;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册