Since a temporary table may be accessed by multiple backends on a datanode, XL
mostly treats such tables as regular tables. But the technique that was used to
distingush between temporary tables that may need shared storage vs those which
are accessed only by a single backend, wasn't very full proof. We were relying
on global session activation to make that distinction. This clearly fails when
a background process, such as autovacuuum process, tries to figure out whether
a table is using local or shared storage. This was leading to various problems,
such as, when the underlying file system objects for the table were getting
cleaned up, but without first discarding all references to the table from the
shared buffers.
We now make all temp tables to use shared storage on the datanodes and thus
simplify things. Only EXECUTE DIRECT anyways does not set up global session, so
I don't think this will have any meaningful impact on the performance.
This should fix the checkpoint failures during regression tests.
#define RELFILENODE_H
#include "common/relpath.h"
+#include "pgxc/pgxc.h"
#include "storage/backendid.h"
/*
#ifdef XCP
#define RelFileNodeBackendIsTemp(rnode) \
- (!OidIsValid(MyCoordId) && ((rnode).backend != InvalidBackendId))
+ (!IS_PGXC_DATANODE && ((rnode).backend != InvalidBackendId))
#else
#define RelFileNodeBackendIsTemp(rnode) \
((rnode).backend != InvalidBackendId)
typedef SMgrRelationData *SMgrRelation;
-#ifdef XCP
-#define SmgrIsTemp(smgr) \
- (!OidIsValid(MyCoordId) && \
- RelFileNodeBackendIsTemp((smgr)->smgr_rnode))
-#else
#define SmgrIsTemp(smgr) \
RelFileNodeBackendIsTemp((smgr)->smgr_rnode)
-#endif
extern void smgrinit(void);
extern SMgrRelation smgropen(RelFileNode rnode, BackendId backend);