Merge pull request #30 from citusdata/v13

Support for v13
merge-cstore-pykello
jeff-davis 2020-11-02 07:52:32 -08:00 committed by GitHub
commit d455ef6785
5 changed files with 117 additions and 40 deletions

View File

@ -45,6 +45,20 @@ jobs:
paths: paths:
- install-12.tar - install-12.tar
build-13:
docker:
- image: 'citus/extbuilder:13.0'
steps:
- checkout
- run:
name: 'Configure, Build, and Install'
command: |
PG_MAJOR=13 .circleci/build.sh
- persist_to_workspace:
root: .
paths:
- install-13.tar
test-11_checkinstall: test-11_checkinstall:
docker: docker:
- image: 'citus/exttester:11.9' - image: 'citus/exttester:11.9'
@ -85,6 +99,26 @@ jobs:
- codecov/upload: - codecov/upload:
flags: 'test_12,installcheck' flags: 'test_12,installcheck'
test-13_checkinstall:
docker:
- image: 'citus/exttester:13.0'
working_directory: /home/circleci/project
steps:
- checkout
- attach_workspace:
at: .
- run:
name: 'Prepare Container & Install Extension'
command: |
chown -R circleci:circleci /home/circleci
tar xfv "${CIRCLE_WORKING_DIRECTORY}/install-${PG_MAJOR}.tar" --directory /
- run:
name: 'Run Test'
command: |
gosu circleci .circleci/run_test.sh installcheck
- codecov/upload:
flags: 'test_13,installcheck'
workflows: workflows:
version: 2 version: 2
build_and_test: build_and_test:
@ -94,8 +128,11 @@ workflows:
- build-11 - build-11
- build-12 - build-12
- build-13
- test-11_checkinstall: - test-11_checkinstall:
requires: [build-11] requires: [build-11]
- test-12_checkinstall: - test-12_checkinstall:
requires: [build-12] requires: [build-12]
- test-13_checkinstall:
requires: [build-13]

View File

@ -3,7 +3,7 @@
DO $proc$ DO $proc$
BEGIN BEGIN
IF version() ~ '12' THEN IF version() ~ '12' or version() ~ '13' THEN
EXECUTE $$ EXECUTE $$
CREATE FUNCTION cstore_tableam_handler(internal) CREATE FUNCTION cstore_tableam_handler(internal)
RETURNS table_am_handler RETURNS table_am_handler

View File

@ -20,7 +20,11 @@
#include "access/heapam.h" #include "access/heapam.h"
#include "access/reloptions.h" #include "access/reloptions.h"
#if PG_VERSION_NUM >= 130000
#include "access/heaptoast.h"
#else
#include "access/tuptoaster.h" #include "access/tuptoaster.h"
#endif
#include "access/xact.h" #include "access/xact.h"
#include "catalog/catalog.h" #include "catalog/catalog.h"
#include "catalog/indexing.h" #include "catalog/indexing.h"
@ -110,7 +114,14 @@ static const CStoreValidOption ValidOptionArray[] =
static object_access_hook_type prevObjectAccessHook = NULL; static object_access_hook_type prevObjectAccessHook = NULL;
/* local functions forward declarations */ /* local functions forward declarations */
#if PG_VERSION_NUM >= 100000 #if PG_VERSION_NUM >= 130000
static void CStoreProcessUtility(PlannedStmt *plannedStatement, const char *queryString,
ProcessUtilityContext context,
ParamListInfo paramListInfo,
QueryEnvironment *queryEnvironment,
DestReceiver *destReceiver,
QueryCompletion *queryCompletion);
#elif PG_VERSION_NUM >= 100000
static void CStoreProcessUtility(PlannedStmt *plannedStatement, const char *queryString, static void CStoreProcessUtility(PlannedStmt *plannedStatement, const char *queryString,
ProcessUtilityContext context, ProcessUtilityContext context,
ParamListInfo paramListInfo, ParamListInfo paramListInfo,
@ -216,7 +227,8 @@ static ProcessUtility_hook_type PreviousProcessUtilityHook = NULL;
void void
cstore_fdw_init() cstore_fdw_init()
{ {
PreviousProcessUtilityHook = ProcessUtility_hook; PreviousProcessUtilityHook = (ProcessUtility_hook != NULL) ?
ProcessUtility_hook : standard_ProcessUtility;
ProcessUtility_hook = CStoreProcessUtility; ProcessUtility_hook = CStoreProcessUtility;
prevObjectAccessHook = object_access_hook; prevObjectAccessHook = object_access_hook;
object_access_hook = CStoreFdwObjectAccessHook; object_access_hook = CStoreFdwObjectAccessHook;
@ -284,13 +296,20 @@ cstore_ddl_event_end_trigger(PG_FUNCTION_ARGS)
* the previous utility hook or the standard utility command via macro * the previous utility hook or the standard utility command via macro
* CALL_PREVIOUS_UTILITY. * CALL_PREVIOUS_UTILITY.
*/ */
#if PG_VERSION_NUM >= 100000 #if PG_VERSION_NUM >= 130000
static void static void
CStoreProcessUtility(PlannedStmt *plannedStatement, const char *queryString, CStoreProcessUtility(PlannedStmt *plannedStatement, const char *queryString,
ProcessUtilityContext context, ProcessUtilityContext context,
ParamListInfo paramListInfo, ParamListInfo paramListInfo,
QueryEnvironment *queryEnvironment, QueryEnvironment *queryEnvironment,
DestReceiver *destReceiver, char *completionTag) DestReceiver *destReceiver, QueryCompletion *queryCompletion)
#elif PG_VERSION_NUM >= 100000
static void
CStoreProcessUtility(PlannedStmt * plannedStatement, const char * queryString,
ProcessUtilityContext context,
ParamListInfo paramListInfo,
QueryEnvironment * queryEnvironment,
DestReceiver * destReceiver, char * completionTag)
#else #else
static void static void
CStoreProcessUtility(Node * parseTree, const char * queryString, CStoreProcessUtility(Node * parseTree, const char * queryString,
@ -299,6 +318,9 @@ CStoreProcessUtility(Node * parseTree, const char * queryString,
DestReceiver * destReceiver, char * completionTag) DestReceiver * destReceiver, char * completionTag)
#endif #endif
{ {
#if PG_VERSION_NUM >= 130000
char *completionTag = NULL;
#endif
#if PG_VERSION_NUM >= 100000 #if PG_VERSION_NUM >= 100000
Node *parseTree = plannedStatement->utilityStmt; Node *parseTree = plannedStatement->utilityStmt;
#endif #endif
@ -313,8 +335,7 @@ CStoreProcessUtility(Node * parseTree, const char * queryString,
} }
else else
{ {
CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, CALL_PREVIOUS_UTILITY();
destReceiver, completionTag);
} }
} }
else if (nodeTag(parseTree) == T_TruncateStmt) else if (nodeTag(parseTree) == T_TruncateStmt)
@ -330,8 +351,7 @@ CStoreProcessUtility(Node * parseTree, const char * queryString,
{ {
truncateStatement->relations = otherTablesList; truncateStatement->relations = otherTablesList;
CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, CALL_PREVIOUS_UTILITY();
destReceiver, completionTag);
/* restore the former relation list. Our /* restore the former relation list. Our
* replacement could be freed but still needed * replacement could be freed but still needed
@ -352,21 +372,18 @@ CStoreProcessUtility(Node * parseTree, const char * queryString,
{ {
AlterTableStmt *alterTable = (AlterTableStmt *) parseTree; AlterTableStmt *alterTable = (AlterTableStmt *) parseTree;
CStoreProcessAlterTableCommand(alterTable); CStoreProcessAlterTableCommand(alterTable);
CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, CALL_PREVIOUS_UTILITY();
destReceiver, completionTag);
} }
else if (nodeTag(parseTree) == T_DropdbStmt) else if (nodeTag(parseTree) == T_DropdbStmt)
{ {
/* let postgres handle error checking and dropping of the database */ /* let postgres handle error checking and dropping of the database */
CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, CALL_PREVIOUS_UTILITY();
destReceiver, completionTag);
} }
/* handle other utility statements */ /* handle other utility statements */
else else
{ {
CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, CALL_PREVIOUS_UTILITY();
destReceiver, completionTag);
} }
} }

View File

@ -10,7 +10,11 @@
#include "access/rewriteheap.h" #include "access/rewriteheap.h"
#include "access/tableam.h" #include "access/tableam.h"
#include "access/tsmapi.h" #include "access/tsmapi.h"
#if PG_VERSION_NUM >= 130000
#include "access/heaptoast.h"
#else
#include "access/tuptoaster.h" #include "access/tuptoaster.h"
#endif
#include "access/xact.h" #include "access/xact.h"
#include "catalog/catalog.h" #include "catalog/catalog.h"
#include "catalog/index.h" #include "catalog/index.h"
@ -41,6 +45,7 @@
#include "cstore.h" #include "cstore.h"
#include "cstore_customscan.h" #include "cstore_customscan.h"
#include "cstore_tableam.h" #include "cstore_tableam.h"
#include "cstore_version_compat.h"
#define CSTORE_TABLEAM_NAME "cstore_tableam" #define CSTORE_TABLEAM_NAME "cstore_tableam"
@ -70,6 +75,15 @@ static ProcessUtility_hook_type PreviousProcessUtilityHook = NULL;
static void CStoreTableAMObjectAccessHook(ObjectAccessType access, Oid classId, Oid static void CStoreTableAMObjectAccessHook(ObjectAccessType access, Oid classId, Oid
objectId, int subId, objectId, int subId,
void *arg); void *arg);
#if PG_VERSION_NUM >= 130000
static void CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
const char *queryString,
ProcessUtilityContext context,
ParamListInfo paramListInfo,
QueryEnvironment *queryEnvironment,
DestReceiver *destReceiver,
QueryCompletion *qc);
#else
static void CStoreTableAMProcessUtility(PlannedStmt *plannedStatement, static void CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
const char *queryString, const char *queryString,
ProcessUtilityContext context, ProcessUtilityContext context,
@ -77,6 +91,8 @@ static void CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
QueryEnvironment *queryEnvironment, QueryEnvironment *queryEnvironment,
DestReceiver *destReceiver, DestReceiver *destReceiver,
char *completionTag); char *completionTag);
#endif
static bool IsCStoreTableAmTable(Oid relationId); static bool IsCStoreTableAmTable(Oid relationId);
static bool ConditionalLockRelationWithTimeout(Relation rel, LOCKMODE lockMode, static bool ConditionalLockRelationWithTimeout(Relation rel, LOCKMODE lockMode,
int timeout, int retryInterval); int timeout, int retryInterval);
@ -1035,6 +1051,7 @@ CStoreExecutorEnd(QueryDesc *queryDesc)
} }
#if PG_VERSION_NUM >= 130000
static void static void
CStoreTableAMProcessUtility(PlannedStmt *plannedStatement, CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
const char *queryString, const char *queryString,
@ -1042,7 +1059,17 @@ CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
ParamListInfo paramListInfo, ParamListInfo paramListInfo,
QueryEnvironment *queryEnvironment, QueryEnvironment *queryEnvironment,
DestReceiver *destReceiver, DestReceiver *destReceiver,
char *completionTag) QueryCompletion *queryCompletion)
#else
static void
CStoreTableAMProcessUtility(PlannedStmt * plannedStatement,
const char * queryString,
ProcessUtilityContext context,
ParamListInfo paramListInfo,
QueryEnvironment * queryEnvironment,
DestReceiver * destReceiver,
char * completionTag)
#endif
{ {
Node *parseTree = plannedStatement->utilityStmt; Node *parseTree = plannedStatement->utilityStmt;
@ -1067,18 +1094,7 @@ CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
} }
} }
if (PreviousProcessUtilityHook != NULL) CALL_PREVIOUS_UTILITY();
{
PreviousProcessUtilityHook(plannedStatement, queryString, context,
paramListInfo, queryEnvironment,
destReceiver, completionTag);
}
else
{
standard_ProcessUtility(plannedStatement, queryString, context,
paramListInfo, queryEnvironment,
destReceiver, completionTag);
}
} }
@ -1087,7 +1103,8 @@ cstore_tableam_init()
{ {
PreviousExecutorEndHook = ExecutorEnd_hook; PreviousExecutorEndHook = ExecutorEnd_hook;
ExecutorEnd_hook = CStoreExecutorEnd; ExecutorEnd_hook = CStoreExecutorEnd;
PreviousProcessUtilityHook = ProcessUtility_hook; PreviousProcessUtilityHook = (ProcessUtility_hook != NULL) ?
ProcessUtility_hook : standard_ProcessUtility;
ProcessUtility_hook = CStoreTableAMProcessUtility; ProcessUtility_hook = CStoreTableAMProcessUtility;
prevObjectAccessHook = object_access_hook; prevObjectAccessHook = object_access_hook;
object_access_hook = CStoreTableAMObjectAccessHook; object_access_hook = CStoreTableAMObjectAccessHook;

View File

@ -32,18 +32,18 @@
ExplainPropertyInteger(qlabel, NULL, value, es) ExplainPropertyInteger(qlabel, NULL, value, es)
#endif #endif
#define PREVIOUS_UTILITY (PreviousProcessUtilityHook != NULL \ #if PG_VERSION_NUM >= 130000
? PreviousProcessUtilityHook : standard_ProcessUtility) #define CALL_PREVIOUS_UTILITY() \
#if PG_VERSION_NUM >= 100000 PreviousProcessUtilityHook(plannedStatement, queryString, context, paramListInfo, \
#define CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, \ queryEnvironment, destReceiver, queryCompletion)
destReceiver, completionTag) \ #elif PG_VERSION_NUM >= 100000
PREVIOUS_UTILITY(plannedStatement, queryString, context, paramListInfo, \ #define CALL_PREVIOUS_UTILITY() \
PreviousProcessUtilityHook(plannedStatement, queryString, context, paramListInfo, \
queryEnvironment, destReceiver, completionTag) queryEnvironment, destReceiver, completionTag)
#else #else
#define CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, \ #define CALL_PREVIOUS_UTILITY() \
destReceiver, completionTag) \ PreviousProcessUtilityHook(parseTree, queryString, context, paramListInfo, \
PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, destReceiver, \ destReceiver, completionTag)
completionTag)
#endif #endif
#if PG_VERSION_NUM < 120000 #if PG_VERSION_NUM < 120000
@ -56,4 +56,10 @@
#endif #endif
#if PG_VERSION_NUM >= 130000
#define heap_open table_open
#define heap_openrv table_openrv
#define heap_close table_close
#endif
#endif /* CSTORE_COMPAT_H */ #endif /* CSTORE_COMPAT_H */