提交 5b6fcda5 编写于 作者: A Abhijit Subramanya

Add new fault injector to make the transaction management test more stable.

The fault `twophase_transaction_commit_prepared` would cause the segment to
PANIC while writing a `COMMIT PREPARED` record on the segment. The master would
then retry the `COMMIT PREPARED` while the postmaster was still resetting on the
segment causing the master itself to `PANIC`. This patch introduces a new fault
injector `finish_prepared_before_commit`  which will not cause a `PANIC`, but
just error out since the intent of the test is to ensure that the retry works
correctly.
上级 0db64e68
......@@ -424,6 +424,7 @@ class GpInjectFaultProgram:
"cursor_qe_reader_after_snapshot (inject fault after QE READER has populated snashot for cursor)" \
"fsync_counter (inject fault to count buffers fsync'ed by checkpoint process), " \
"bg_buffer_sync_default_logic (inject fault to 'skip' in order to flush all buffers in BgBufferSync()), " \
"finish_prepared_after_record_commit_prepared (inject fault in FinishPreparedTransaction() after recording the commit prepared record), " \
"all (affects all faults injected, used for 'status' and 'reset'), ")
addTo.add_option("-c", "--ddl_statement", dest="ddlStatement", type="string",
metavar="ddlStatement",
......
......@@ -1646,6 +1646,8 @@ FinishPreparedTransaction(const char *gid, bool isCommit, bool raiseErrorIfNotFo
END_CRIT_SECTION();
SIMPLE_FAULT_INJECTOR(FinishPreparedAfterRecordCommitPrepared);
/* Need to figure out the memory allocation and deallocationfor "buffer". For now, just let it leak. */
return true;
......
......@@ -331,6 +331,8 @@ FaultInjectorIdentifierEnumToString[] = {
/* inject fault to 'skip' in order to flush all buffers in BgBufferSync() */
_("bg_buffer_sync_default_logic"),
/* inject fault to count buffers fsync'ed by checkpoint process */
_("finish_prepared_after_record_commit_prepared"),
/* inject fault in FinishPreparedTransaction() after recording the commit prepared record */
_("not recognized"),
};
......
......@@ -221,6 +221,7 @@ typedef enum FaultInjectorIdentifier_e {
FsyncCounter,
BgBufferSyncDefaultLogic,
FinishPreparedAfterRecordCommitPrepared,
/* INSERT has to be done before that line */
FaultInjectorIdMax,
......
......@@ -65,7 +65,7 @@ non_discover_targets: aoco_compression filerep_end_to_end fts
# stages for configuration requirements.
storage: storage_vacuum_xidlimits aocoalter_catalog_loaders \
storage_queryfinish_and_transactionmanagement \
storage_uao_and_transactionmanagement \
storage_persistent_accessmethods_and_vacuum \
storage_filerep
......
......@@ -181,19 +181,17 @@ class mpp23395(MPPTestCase):
SET debug_dtm_action = "fail_begin_command";
CREATE TABLE mpp23395(a int);
'''
self.run_sequence(sql, 'twophase_transaction_commit_prepared', 'error', 2, False);
self.run_sequence(sql, 'finish_prepared_after_record_commit_prepared', 'error', 2, False);
# QE panics after writing prepare xlog record. This should cause
# master to broadcast abort but QEs handle the abort in
# Scenario 8: QE panics after writing prepare xlog record. This should
# cause master to broadcast abort but QEs handle the abort in
# DTX_CONTEXT_LOCAL_ONLY context.
sql = '''
DROP TABLE IF EXISTS mpp23395;
CREATE TABLE mpp23395(a int);
INSERT INTO mpp23395 VALUES(1), (2), (3);
BEGIN;
SET debug_abort_after_segment_prepared = true;
DELETE FROM mpp23395;
COMMIT;
'''
# No prepared transactions should remain lingering
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册