From: Tomas Vondra Date: Wed, 5 Jul 2017 23:37:33 +0000 (+0200) Subject: Fix compilation errors in stormstats X-Git-Tag: XL_10_R1BETA1~253 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=9b7535fe8e5fbbf555bc106bb823a70179b72cb2;p=postgres-xl.git Fix compilation errors in stormstats There were three simple issues: 1) missing headers, so shmem-related functions were not defined 2) using LWLockId instead of plain LWLock 3) missing ProcessUtility changes from commit ab1f0c8225714aaa18d This commit fixes all of those compile-time issues. --- diff --git a/contrib/stormstats/stormstats.c b/contrib/stormstats/stormstats.c index ee13bc7ff7..12af8ab3ca 100644 --- a/contrib/stormstats/stormstats.c +++ b/contrib/stormstats/stormstats.c @@ -20,12 +20,15 @@ #include "funcapi.h" #include "stormstats.h" #include "storage/fd.h" +#include "storage/shmem.h" +#include "storage/lwlock.h" #include "pgxc/pgxc.h" #include "pgxc/pgxcnode.h" #include "pgxc/planner.h" #include "pgxc/execRemote.h" + /* mark this dynamic library to be compatible with PG */ PG_MODULE_MAGIC; @@ -72,7 +75,7 @@ typedef struct LocalStatsEntry typedef struct StormSharedState { - LWLockId lock; + LWLock *lock; } StormSharedState; static bool sp_save; /* whether to save stats across shutdown */ @@ -109,26 +112,25 @@ static ProcessUtility_hook_type prev_ProcessUtility = NULL; static int max_tracked_dbs; static void -ProcessUtility_callback(Node *parsetree, - const char *queryString, - ProcessUtilityContext context, +ProcessUtility_callback(PlannedStmt *pstmt, + const char *queryString, ProcessUtilityContext context, ParamListInfo params, + QueryEnvironment *queryEnv, DestReceiver *dest, -#ifdef PGXC bool sentToRemote, -#endif /* PGXC */ char *completionTag) { + Node *parsetree; + elog( DEBUG1, "STORMSTATS: using plugin." ); - standard_ProcessUtility(parsetree, queryString, context, params, dest, -#ifdef PGXC - sentToRemote, -#endif /* PGXC */ - completionTag); + standard_ProcessUtility(pstmt, queryString, context, params, queryEnv, + dest, sentToRemote, completionTag); stats_store(get_database_name(MyDatabaseId), CMD_UNKNOWN, false, true); + parsetree = pstmt->utilityStmt; + /* * Check if it's a CREATE/DROP DATABASE command. Update entries in the * shared hash table accordingly.