Refactor tests which use debug_dtm_action to use faultinjector#1967
Merged
Refactor tests which use debug_dtm_action to use faultinjector#1967
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
RekGRpth
reviewed
Aug 25, 2025
RekGRpth
reviewed
Aug 25, 2025
RekGRpth
reviewed
Aug 25, 2025
RekGRpth
reviewed
Aug 25, 2025
RekGRpth
reviewed
Aug 25, 2025
RekGRpth
reviewed
Aug 25, 2025
RekGRpth
reviewed
Aug 25, 2025
whitehawk
reviewed
Aug 25, 2025
This comment was marked as resolved.
This comment was marked as resolved.
|
In the PR description: |
whitehawk
reviewed
Aug 25, 2025
src/test/isolation2/sql/udf_exception_blocks_panic_scenarios.sql
Outdated
Show resolved
Hide resolved
src/test/isolation2/sql/udf_exception_blocks_panic_scenarios.sql
Outdated
Show resolved
Hide resolved
src/test/isolation2/sql/udf_exception_blocks_panic_scenarios.sql
Outdated
Show resolved
Hide resolved
RekGRpth
reviewed
Aug 25, 2025
RekGRpth
reviewed
Aug 25, 2025
This comment was marked as resolved.
This comment was marked as resolved.
whitehawk
reviewed
Aug 26, 2025
Author
Thanks for pointing to guc.h. Fixed |
RekGRpth
reviewed
Aug 27, 2025
whitehawk
reviewed
Aug 27, 2025
RekGRpth
reviewed
Aug 27, 2025
Following changes are made to faultinjector code 1. In the gp_inject_fault extension, one extra parameter added to C language function gp_inject_fault - nestingLevel for nesting subtransaction 2. Compatibility SQL function with same number of argumetns as former C function is created to avoid incompatibilites. 3. DDLStatement_e enumeration is extended to cover all SQL and DTX statements which are used in tests with debug_dtm_action (they are not all ddl, but...) 4. Since string names of some of these statements as they are used in the code, contain spaces, scanf format in HandleFaultMessage is changed to handle strings with spaces. 5. Parameter nestingLevel is added to function FaultInjector_InjectFaultIfSet_out_of line. 6. Since SQL Statement Tag present in the context where fault injection code is called as string, created new function FaultInjector_InjectFaultIfSet_SQL_out_of_line and corresponding macro which wraps basic fault injection function and translates string statement info DDLStatement_e value 7. Since DTXProtocol command is available as enumeration, but not same as DLLStatement_e, recoding table is added to faultinjector.c and function FaultInjector_InjectFaultIfSet_DTX_out of_line, which analogous to prevoius step. 8. To make definition of DtxtProtocolCommand enumeration available in the context of faultinjector.h (where function from previous point is declared) header files postgres.h and cdb/cdbtm.h are included into this file.
There were three functions where debug_dtm_action GUC variables were checked and faults thrown: exec_mpp_query exec_simple_query and exec_mpp_dtx_protocol_command First two have two ereport calls at start and at end of functions. Last have three ereport calls because at start it was possible to throw either ERROR or PANIC. Faultinjector is able to throw both error and panic from any incection point, so there are now just two injection points in all three functions. Functions exec_mpp_query and exec_simple_query have string variable commandTag with printable of command. So we use this value to define ddlStatement condition For exec_mpp_dtx_query we use dtxProtocolCommand with enumerated type DtxProtocolCommand. Injection points are named dtm_exec_mpp_query_start dtm_exec_mpp_query_end dtm_exec_simple_command_start dtm_exec_simple_command_end exec_mpp_dtx_protocol_start exec_mpp_dtx_protocol_end Old static helper functions CheckDebugDtmActionSqlCommandTag and CheckDebugDtmActionProtocol are removed.
This commit removes all debug_dtm_action* GUC variables and corresponing global variables, defines, string-to-enum recoding tables. It is made separate commit because we have to be sure that our replacement of these variables with gp_inject_fault function is complete.
This commit replaces all references for debug_dtm_action* GUC variables in the tests (including helper C program twophase_pqexecparams.c) with calls to gp_inject_fault function. This also requires changes to src/test/regress/greenplum_schedule because there were no check that tests which inject faults using debug_dtm_action GUC variables are not executed as part of parallel group, but such check present for tests which use gp_inject_fault. And it is probaly right thing because injected fault may unexpectedly disrupt parallel sessions. If GUC variables are very seldom reset before next test, gp_inject_fault requires reset each time before injecting to same injection point with different parameters.
Expected results of these tests have to be altered, because expeced results contain all SQL commands and their output, so SET debug_dtm_action* have to be removed and SELECT gp_inject_fault(...) FROM... added. Also, when injected fault message not caught, it also have to be changed.
Documented additional fault injection macros and parameters required to replace debug_dtm_action variables, and documented some previously undocumented parts of faultinjector.
Refactoring of faultinjector and removing GUC variables cause ABI changes. This change is harmless because this GUC variables are never used outside tests and faultinjector is not compiled in in production builds. Moreover, compatibility macros are provided to preserve to FaultInjector_InjectFaultIfSet behavoir
added 9 commits
August 29, 2025 16:58
Improve formatting of calls to gp_inject_fault, remove diffs with old expected results which are ignored during computation of regression.diffs
RekGRpth
reviewed
Sep 1, 2025
RekGRpth
reviewed
Sep 1, 2025
RekGRpth
reviewed
Sep 1, 2025
RekGRpth
reviewed
Sep 1, 2025
RekGRpth
reviewed
Sep 1, 2025
src/test/isolation2/expected/udf_exception_blocks_panic_scenarios.out
Outdated
Show resolved
Hide resolved
added 2 commits
September 2, 2025 16:33
Remove erroneuously added empty line in src/test/regress/sql/not_out_of_shmem_exit_slots.sql and return back end-of-line space in src/test/regress/sql/udf_exception_blocks.sql Revert changes of line order in query output in src/test/isolation2/expected/udf_exception_blocks_panic_scenarios.out because this line order is ignored during diff.
silent-observer
previously approved these changes
Sep 4, 2025
Leave only brief usage instructions in faultinjector.h Also reformat function FaultInjector_InjectFault_out_of_line_SQL.
silent-observer
approved these changes
Sep 4, 2025
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Author
Fixed paragraph formatting to 80 chars/per line. Any other suggestions? |
Author
Fixed |
whitehawk
approved these changes
Sep 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor tests which use debug_dtm_action to use faultinjector
gpdb tests use two mechanisms to generate artificial faults.
debug_dtm_action.This patch changes all tests from
debug_dtm_actionto faultinjector.It includes following extensions to faultinjector:
subtransaction nesting level;
use
gp_inject_faultwithout that new condition;DDLStatement_eenumeration to include all SQL operators and DTXprotocol messages used in tests, which previously used
debug_dtm_action;tags and DTX protocol message code to
DDLStatement_e;gp_inject_faultextension, which documents thesechanges and also documents some already existing functionality which was
left undocumented.
Apart from faultinjector changes patch includes following changes:
debug_dtm_actionvariables withcalls to faultinjector macros;
debug_dtm_action_*GUC variables from guc_gp.clSET debug_dtm_action*in the tests to calls togp_inject_faultfunction;injected error and echo of SQL statements which inject an error.