Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADBDEV-6811 Throw out fault injector code blocks for release builds #1224

Open
wants to merge 7 commits into
base: adb-6.x-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
4 changes: 3 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -3321,7 +3321,9 @@ if test "${enable_debug_extensions+set}" = set; then :
enableval=$enable_debug_extensions;
case $enableval in
yes)
:

$as_echo "#define FAULT_INJECTOR 1" >>confdefs.h

;;
no)
:
Expand Down
6 changes: 4 additions & 2 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ AC_SUBST(enable_gpfdist)
#
# include debug extensions in gpcontrib
#
PGAC_ARG_BOOL(enable, debug-extensions, no,
[include debug extensions in gpcontrib])
PGAC_ARG_BOOL (enable, debug-extensions, yes,
[exclude debug extensions in gpcontrib],
[AC_DEFINE([FAULT_INJECTOR], 1,
[Define to 1 to build with fault injector. (--enable-faultinjector)])])
AC_SUBST(enable_debug_extensions)

#
Expand Down
3 changes: 3 additions & 0 deletions src/backend/executor/execHHashagg.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,13 @@ lookup_agg_hash_entry(AggState *aggstate,

Assert(mt_bind != NULL);

#ifdef FAULT_INJECTOR
if (SIMPLE_FAULT_INJECTOR("force_hashagg_stream_hashtable") == FaultInjectorTypeSkip)
if (((Agg *) aggstate->ss.ps.plan)->streaming)
return NULL;

#endif

if (p_isnew != NULL)
*p_isnew = false;

Expand Down
2 changes: 2 additions & 0 deletions src/backend/fts/fts.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,10 @@ void FtsLoop()
probe_requested = false;
skipFtsProbe = false;

#ifdef FAULT_INJECTOR
if (SIMPLE_FAULT_INJECTOR("fts_probe") == FaultInjectorTypeSkip)
skipFtsProbe = true;
#endif

if (skipFtsProbe || !has_mirrors)
{
Expand Down
2 changes: 2 additions & 0 deletions src/backend/gpopt/gpdbwrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2467,6 +2467,7 @@ gpdb::RunStaticPartitionSelection(PartitionSelector *ps)
return NULL;
}

#ifdef FAULT_INJECTOR
FaultInjectorType_e
gpdb::InjectFaultInOptTasks(const char *fault_name)
{
Expand All @@ -2478,6 +2479,7 @@ gpdb::InjectFaultInOptTasks(const char *fault_name)
GP_WRAP_END;
return FaultInjectorTypeNotSpecified;
}
#endif

gpos::ULONG
gpdb::CountLeafPartTables(Oid rel_oid)
Expand Down
2 changes: 2 additions & 0 deletions src/include/gpopt/gpdbwrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,10 @@ Node *EvalConstExpressions(Node *node);
// static partition selection given a PartitionSelector node
SelectedParts *RunStaticPartitionSelection(PartitionSelector *ps);

#ifdef FAULT_INJECTOR
// simple fault injector used by COptTasks.cpp to inject GPDB fault
FaultInjectorType_e InjectFaultInOptTasks(const char *fault_name);
#endif

// return the number of leaf partition for a given table oid
gpos::ULONG CountLeafPartTables(Oid oidRelation);
Expand Down
3 changes: 3 additions & 0 deletions src/include/pg_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
(--enable-thread-safety) */
#undef ENABLE_THREAD_SAFETY

/* Define to 1 to build with fault injector. (--enable-debug-extensions) */
#undef FAULT_INJECTOR

/* Define to nothing if C supports flexible array members, and to 1 if it does
not. That way, with a declaration like `struct s { int n; double
d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99
Expand Down
11 changes: 0 additions & 11 deletions src/include/pg_config_manual.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,6 @@
*/
/* #define WAL_DEBUG */

/*
* Enable debugging print statements for B-tree related operations; see
* also log_btree_build_stats GUC var.
*/
/* #define BTREE_BUILD_STATS */

/*
* Enable injecting faults.
*/
#define FAULT_INJECTOR 1

/*
* Enable tracing of resource consumption during sort operations;
* see also the trace_sort GUC var. For 8.1 this is enabled by default.
Expand Down
2 changes: 1 addition & 1 deletion src/include/utils/faultinjector.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef FAULTINJECTOR_H
#define FAULTINJECTOR_H

#include "pg_config_manual.h"
#include "pg_config.h"

#define FAULTINJECTOR_MAX_SLOTS 16

Expand Down