diff options
author | Pavan Deolasee | 2017-08-02 06:52:14 +0000 |
---|---|---|
committer | Pavan Deolasee | 2017-08-02 06:52:14 +0000 |
commit | abee5fd1ac0a3156d82a926000cd0ad792ad2144 (patch) | |
tree | c85f93b3dbd02b1dd12898301b10ae9f86c93bf7 | |
parent | 06130a5602ed83ab7b450e46b10173c926b241b5 (diff) |
Make temporary tables use shared storage on datanodes
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.
-rw-r--r-- | src/include/storage/relfilenode.h | 3 | ||||
-rw-r--r-- | src/include/storage/smgr.h | 6 |
2 files changed, 2 insertions, 7 deletions
diff --git a/src/include/storage/relfilenode.h b/src/include/storage/relfilenode.h index 075ce6b077..593ca91a1f 100644 --- a/src/include/storage/relfilenode.h +++ b/src/include/storage/relfilenode.h @@ -15,6 +15,7 @@ #define RELFILENODE_H #include "common/relpath.h" +#include "pgxc/pgxc.h" #include "storage/backendid.h" /* @@ -77,7 +78,7 @@ typedef struct RelFileNodeBackend #ifdef XCP #define RelFileNodeBackendIsTemp(rnode) \ - (!OidIsValid(MyCoordId) && ((rnode).backend != InvalidBackendId)) + (!IS_PGXC_DATANODE && ((rnode).backend != InvalidBackendId)) #else #define RelFileNodeBackendIsTemp(rnode) \ ((rnode).backend != InvalidBackendId) diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index 27c33af846..06a1db8339 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -78,14 +78,8 @@ typedef struct SMgrRelationData 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); |