Fix compilation errors in stormstats
authorTomas Vondra <[email protected]>
Wed, 5 Jul 2017 23:37:33 +0000 (01:37 +0200)
committerTomas Vondra <[email protected]>
Wed, 5 Jul 2017 23:37:33 +0000 (01:37 +0200)
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.

contrib/stormstats/stormstats.c

index ee13bc7ff72e7e48af79b163ffe78563db680adf..12af8ab3cafc65d93c452a6527662aefb7490343 100644 (file)
 #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.