Commit 1591a3e
Update fault injector to better handle tableName argument.
Calls to FaultInjector_InjectFaultIfSet that provide tableName as an
argument currently break early if the tableName does not match the
hash entry (set by gp_inject_fault) for the fault. This is problematic
because the fault must be set with a specific table name to be triggered at all.
This commit modifies the behavior to only check for matching tableName
if the hash entry has a tableName set. This allows for more targeted
testing.
Example:
Setting fault without a tableName will trigger for any table:
```
postgres=# SELECT gp_inject_fault('AppendOnlyStorageRead_ReadNextBlock_success', 'skip', '', '', '', 1, 100, 0, dbid)
FROM gp_segment_configuration WHERE content = 1 AND role = 'p';
gp_inject_fault
-----------------
Success:
(1 row)
postgres=# copy alter_attach_t1 to '/dev/null';
COPY 100000
postgres=# copy alter_attach_t2 to '/dev/null';
COPY 100000
postgres=# SELECT gp_inject_fault('AppendOnlyStorageRead_ReadNextBlock_success', 'status', dbid)
FROM gp_segment_configuration WHERE content = 1 AND role = 'p';
gp_inject_fault
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Success: fault name:'AppendOnlyStorageRead_ReadNextBlock_success' fault type:'skip' ddl statement:'' database name:'' table name:'' start occurrence:'1' end occurrence:'100' extra arg:'0' fault injection state:'completed' num times hit:'100' +
```
Setting fault with a given tableName will trigger only for that table.
```
postgres=# SELECT gp_inject_fault('AppendOnlyStorageRead_ReadNextBlock_success', 'skip', '', '', 'alter_attach_t1', 1, 100, 0, dbid)
FROM gp_segment_configuration WHERE content = 1 AND role = 'p';
gp_inject_fault
-----------------
Success:
(1 row)
postgres=# copy alter_attach_t1 to '/dev/null';
COPY 100000
postgres=# copy alter_attach_t2 to '/dev/null';
COPY 100000
postgres=# SELECT gp_inject_fault('AppendOnlyStorageRead_ReadNextBlock_success', 'status', dbid)
FROM gp_segment_configuration WHERE content = 1 AND role = 'p';
gp_inject_fault
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Success: fault name:'AppendOnlyStorageRead_ReadNextBlock_success' fault type:'skip' ddl statement:'' database name:'' table name:'alter_attach_t1' start occurrence:'1' end occurrence:'100' extra arg:'0' fault injection state:'triggered' num times hit:'51' +
```
Authored-by: Brent Doil <bdoil@vmware.com>1 parent e32c497 commit 1591a3e
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| |||
0 commit comments