1414
1515#include "access/relation.h"
1616#include "access/table.h"
17+ #include "catalog/objectaccess.h"
1718#include "catalog/pg_extension.h"
1819#include "commands/extension.h"
1920#include "miscadmin.h"
2324#include "aqo_shared.h"
2425#include "cardinality_hooks.h"
2526#include "path_utils.h"
27+ #include "postmaster/bgworker.h"
2628#include "preprocessing.h"
2729#include "learn_cache.h"
2830#include "storage.h"
29- #include "postmaster/bgworker.h"
30- #include "catalog/objectaccess.h"
3131
3232
3333PG_MODULE_MAGIC ;
@@ -118,6 +118,9 @@ ExplainOneNode_hook_type prev_ExplainOneNode_hook;
118118static shmem_request_hook_type prev_shmem_request_hook = NULL ;
119119object_access_hook_type prev_object_access_hook ;
120120
121+ PGDLLEXPORT void aqo_bgworker_cleanup (Datum main_arg );
122+ static void aqo_bgworker_startup (void );
123+
121124/*****************************************************************************
122125 *
123126 * CREATE/DROP EXTENSION FUNCTIONS
@@ -156,18 +159,18 @@ aqo_shmem_request(void)
156159 * Entry point for CleanupWorker's process.
157160 */
158161void
159- aqo_bgworker_cleanup (void )
162+ aqo_bgworker_cleanup (Datum main_arg )
160163{
161164 int fs_num ;
162165 int fss_num ;
163166
164167 cleanup_aqo_database (true, & fs_num , & fss_num );
165168}
166169
167- /*
170+ /*
168171 * Object access hook
169172 */
170- void
173+ static void
171174aqo_drop_access_hook (ObjectAccessType access ,
172175 Oid classId ,
173176 Oid objectId ,
@@ -198,7 +201,7 @@ aqo_drop_access_hook(ObjectAccessType access,
198201 }
199202}
200203
201- void
204+ static void
202205aqo_bgworker_startup (void )
203206{
204207 BackgroundWorker worker ;
@@ -355,7 +358,7 @@ _PG_init(void)
355358 & fs_max_items ,
356359 10000 ,
357360 1 , INT_MAX ,
358- PGC_SUSET ,
361+ PGC_POSTMASTER ,
359362 0 ,
360363 NULL ,
361364 NULL ,
@@ -368,7 +371,7 @@ _PG_init(void)
368371 & fss_max_items ,
369372 100000 ,
370373 0 , INT_MAX ,
371- PGC_SUSET ,
374+ PGC_POSTMASTER ,
372375 0 ,
373376 NULL ,
374377 NULL ,
@@ -406,7 +409,7 @@ _PG_init(void)
406409 NULL ,
407410 & cleanup_bgworker ,
408411 false,
409- PGC_USERSET ,
412+ PGC_SUSET ,
410413 0 ,
411414 NULL ,
412415 NULL ,
@@ -484,7 +487,7 @@ _PG_init(void)
484487 */
485488 AQOLearnMemCtx = AllocSetContextCreate (AQOTopMemCtx ,
486489 "AQOLearnMemoryContext" ,
487- ALLOCSET_DEFAULT_SIZES );
490+ ALLOCSET_DEFAULT_SIZES );
488491 RegisterResourceReleaseCallback (aqo_free_callback , NULL );
489492 RegisterAQOPlanNodeMethods ();
490493
0 commit comments