Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
711 changes: 709 additions & 2 deletions configure

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -872,15 +872,29 @@ AS_IF([test "$enable_yezzey" = yes],
#
PGAC_ARG_BOOL(enable, sr_plan, yes, [disable sr_plan support],
[AC_DEFINE([USE_SR_PLAN], 1,
[Define to 1 to build with yezzey (--enable-sr-plan)])])
AC_MSG_RESULT([checking whether to build with yezzey... $enable_sr_plan])
[Define to 1 to build with sr_plan (--enable-sr-plan)])])
AC_MSG_RESULT([checking whether to build with sr_plan... $enable_sr_plan])
AC_SUBST(enable_sr_plan)

AS_IF([test "$enable_sr_plan" = yes],
[ # then
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
]) # fi

#
# pgaudit, enabled by default
#
PGAC_ARG_BOOL(enable, pgaudit, yes, [disable pgaudit support],
[AC_DEFINE([USE_PGAUDIT], 1,
[Define to 1 to build with pgaudit (--enable-pgaudit)])])
AC_MSG_RESULT([checking whether to build with pgaudit... $enable_sr_plan])
AC_SUBST(enable_pgaudit)

AS_IF([test "$enable_pgaudit" = yes],
[ # then
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
]) # fi

#
# ic-proxy
#
Expand Down
12 changes: 11 additions & 1 deletion docker/test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,23 @@ make destroy-demo-cluster && make create-demo-cluster
export USER=gpadmin
source gpAux/gpdemo/gpdemo-env.sh

gpconfig -c shared_preload_libraries -v yezzey
gpconfig -c shared_preload_libraries -v pgaudit

# ADD CGROUPS
if [ "${TEST_CGROUP}" = "true" ]; then
gpconfig -c gp_resource_manager -v "group"
fi

# Accept local connections for tests
cat >>gpAux/gpdemo/datadirs/qddir/demoDataDir-1/pg_hba.conf <<EOL
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/24 trust
# IPv6 local connections:
host all all ::1/128 trust
EOL

gpstop -a -i && gpstart -a

createdb $USER
Expand Down
18 changes: 12 additions & 6 deletions gpcontrib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,13 @@ orafce:
fi

sr_plan:
@if [ "$(enable_sr_plan)" == "yes" ]; then \
$(MAKE) -C sr_plan USE_PGXS=1 && \
$(MAKE) -C sr_plan USE_PGXS=1 install; \
@if [ "$(enable_sr_plan)" = "yes" ]; then \
$(MAKE) -C sr_plan && \
fi

pgaudit:
@if [ "$(enable_pgaudit)" == "yes" ]; then \
$(MAKE) -C pgaudit USE_PGXS=1 && \
$(MAKE) -C pgaudit USE_PGXS=1 install; \
@if [ "$(enable_pgaudit)" = "yes" ]; then \
$(MAKE) -C pgaudit && \
fi


Expand All @@ -98,6 +96,12 @@ install:
@if [ "$(enable_yezzey)" = "yes" ]; then \
$(MAKE) -C yezzey install; \
fi
@if [ "$(enable_pgaudit)" = "yes" ]; then \
$(MAKE) -C pgaudit install; \
fi
@if [ "$(enable_sr_plan)" = "yes" ]; then \
$(MAKE) -C sr_plan install; \
fi
@if [ "$(enable_mapreduce)" = "yes" ]; then \
$(MAKE) -C gpmapreduce install; \
fi
Expand All @@ -119,6 +123,8 @@ distclean:
if [ "$(enable_gpcloud)" = "yes" ]; then $(MAKE) -C gpcloud distclean; fi
if [ "$(enable_yezzey)" = "yes" ]; then $(MAKE) -C yezzey distclean; fi
if [ "${enable_orafce}" = "yes" ]; then $(MAKE) -C orafce NO_PGXS=true distclean; fi
if [ "${enable_sr_plan}" = "yes" ]; then $(MAKE) -C sr_plan distclean; fi
if [ "${enable_pgaudit}" = "yes" ]; then $(MAKE) -C pgaudit distclean; fi

installcheck:
$(MAKE) -C gp_internal_tools installcheck
Expand Down
4 changes: 2 additions & 2 deletions gpcontrib/pgaudit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DATA = pgaudit--1.0.9.sql pgaudit--1.0--1.0.6.sql pgaudit--1.0.6--1.0.7.sql pgau
PGFILEDESC = "pgAudit - An audit logging extension for PostgreSQL"

REGRESS = pgaudit
REGRESS_OPTS = --temp-config=$(top_srcdir)/contrib/pgaudit/pgaudit.conf
REGRESS_OPTS = --init-file=$(top_srcdir)/src/test/regress/init_file

ifdef USE_PGXS
PG_CONFIG = pg_config
Expand All @@ -18,5 +18,5 @@ else
subdir = gpcontrib/pgaudit
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/gpcontrib/contrib-global.mk
include $(top_srcdir)/contrib/contrib-global.mk
endif
5 changes: 4 additions & 1 deletion gpcontrib/pgaudit/expected/pgaudit.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
\set VERBOSITY terse
-- Create pgaudit extension
CREATE EXTENSION IF NOT EXISTS gp_aux_catalog;
-- Create pgaudit extension
CREATE EXTENSION IF NOT EXISTS pgaudit;
-- Make sure events don't get logged twice when session logging
SET pgaudit.log = 'all';
Expand Down Expand Up @@ -882,7 +884,7 @@ BEGIN
id INT
);
END $$;",<none>
ERROR: schema "bogus" does not exist at character 14
ERROR: schema "bogus" does not exist
--
-- Test alter table statements
ALTER TABLE public.test
Expand Down Expand Up @@ -1175,6 +1177,7 @@ DROP TABLE wombat;
NOTICE: AUDIT: SESSION,70,1,DDL,DROP TABLE,TABLE,public.wombat,DROP TABLE wombat;,<none>
SET pgaudit.log = 'NONE';
DROP EXTENSION pgaudit;
DROP EXTENSION gp_aux_catalog;
DROP OPERATOR <> (text, text);
ERROR: cannot drop operator <>(text,text) because it is required by the database system
DROP FUNCTION my_ne(text, text);
Expand Down
30 changes: 18 additions & 12 deletions gpcontrib/pgaudit/pgaudit.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#include "utils/syscache.h"
#include "utils/timestamp.h"

// For GpIdentity
#include "cdb/cdbvars.h"

PG_MODULE_MAGIC;

void _PG_init(void);
Expand Down Expand Up @@ -1977,21 +1980,24 @@ _PG_init(void)
GUC_NOT_IN_SAMPLE,
NULL, NULL, NULL);

/*
* Install our hook functions after saving the existing pointers to
* preserve the chains.
*/
next_ExecutorStart_hook = ExecutorStart_hook;
ExecutorStart_hook = pgaudit_ExecutorStart_hook;

next_ExecutorCheckPerms_hook = ExecutorCheckPerms_hook;
ExecutorCheckPerms_hook = pgaudit_ExecutorCheckPerms_hook;
if (GpIdentity.segindex == -1) {
/*
* Install our hook functions after saving the existing pointers to
* preserve the chains.
*/
next_ExecutorStart_hook = ExecutorStart_hook;
ExecutorStart_hook = pgaudit_ExecutorStart_hook;

next_ExecutorCheckPerms_hook = ExecutorCheckPerms_hook;
ExecutorCheckPerms_hook = pgaudit_ExecutorCheckPerms_hook;

next_ProcessUtility_hook = ProcessUtility_hook;
ProcessUtility_hook = pgaudit_ProcessUtility_hook;
next_ProcessUtility_hook = ProcessUtility_hook;
ProcessUtility_hook = pgaudit_ProcessUtility_hook;

next_object_access_hook = object_access_hook;
object_access_hook = pgaudit_object_access_hook;
next_object_access_hook = object_access_hook;
object_access_hook = pgaudit_object_access_hook;
}

/* Log that the extension has completed initialization */
#ifndef EXEC_BACKEND
Expand Down
1 change: 1 addition & 0 deletions gpcontrib/pgaudit/sql/pgaudit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,7 @@ DROP TABLE wombat;

SET pgaudit.log = 'NONE';
DROP EXTENSION pgaudit;
DROP EXTENSION gp_aux_catalog;

DROP OPERATOR <> (text, text);
DROP FUNCTION my_ne(text, text);
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.global.in
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ enable_mapreduce = @enable_mapreduce@
enable_gpcloud = @enable_gpcloud@
enable_yezzey = @enable_yezzey@
enable_sr_plan = @enable_sr_plan@
enable_pgaudit = @enable_pgaudit@
enable_gpperfmon = @enable_gpperfmon@
enable_ic_proxy = @enable_ic_proxy@

Expand Down
Loading