On Tue, Jan 2, 2024 at 3:36 PM Ashutosh Bapat <ashutosh.bapat....@gmail.com> wrote:
> > I will look at 0002 next. One more comment on 0001 InjectionPointAttach() doesn't test whether the given function exists in the given library. Even if InjectionPointAttach() succeeds, INJECTION_POINT might throw error because the function doesn't exist. This can be seen as an unwanted behaviour. I think InjectionPointAttach() should test whether the function exists and possibly load it as well by adding it to the local cache. 0002 comments --- /dev/null +++ b/src/test/modules/test_injection_points/expected/test_injection_points.out When built without injection point support, this test fails. We should add an alternate output file for such a build so that the behaviour with and without injection point support is tested. Or set up things such that the test is not run under make check in that directory. I will prefer the first option. + +SELECT test_injection_points_run('TestInjectionError'); -- error +ERROR: error triggered for injection point TestInjectionError +-- Re-load and run again. What's getting Re-loaded here? \c will create a new connection and thus a new backend. Maybe the comment should say "test in a fresh backend" or something of that sort? + +SELECT test_injection_points_run('TestInjectionError'); -- error +ERROR: error triggered for injection point TestInjectionError +-- Remove one entry and check the other one. Looks confusing to me, we are testing the one removed as well. Am I missing something? +(1 row) + +-- All entries removed, nothing happens We aren't removing all entries TestInjectionLog2 is still there. Am I missing something? 0003 looks mostly OK. 0004 comments + +# after recovery, the server will not start, and log PANIC: could not locate a valid checkpoint record IIUC the comment describes the behaviour with 7863ee4def65 reverted. But the test after this comment is written for the behaviour with 7863ee4def65. That's confusing. Is the intent to describe both behaviours in the comment? + + /* And sleep.. */ + ConditionVariablePrepareToSleep(&inj_state->wait_point); + ConditionVariableSleep(&inj_state->wait_point, test_injection_wait_event); + ConditionVariableCancelSleep(); According to the prologue of ConditionVariableSleep(), that function should be called in a loop checking for the desired condition. All the callers that I examined follow that pattern. I think we need to follow that pattern here as well. Below comment from ConditionVariableTimedSleep() makes me think that the caller of ConditionVariableSleep() can be woken up even if the condition variable was not signaled. That's why the while() loop around ConditionVariableSleep(). * If we're still in the wait list, then the latch must have been set * by something other than ConditionVariableSignal; though we don't * guarantee not to return spuriously, we'll avoid this obvious case. */. That's all I have for now. -- Best Wishes, Ashutosh Bapat