Re: pgbench logging broken by time logic changes
От | Thomas Munro |
---|---|
Тема | Re: pgbench logging broken by time logic changes |
Дата | |
Msg-id | CA+hUKG+2NAmDZ9g4GMjy939AsVifj117O40M1h7zUj02bzwjcA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: pgbench logging broken by time logic changes (Fabien COELHO <coelho@cri.ensmp.fr>) |
Ответы |
Re: pgbench logging broken by time logic changes
|
Список | pgsql-hackers |
On Thu, Jul 1, 2021 at 8:50 PM Fabien COELHO <coelho@cri.ensmp.fr> wrote: > Attached a v14 in that spirit. Thanks! This doesn't seem to address the complaint, though. Don't you need to do something like this? (See also attached.) + initStats(&aggs, start - (start + epoch_shift) % 1000000); That should reproduce what pgbench 13 does implicitly when it uses time(NULL). Namely, it rewinds to the start of the current *wall clock* second, so that all future aggregates also start at round number wall clock times, at the cost of making the first aggregate miss out on a fraction of a second. I wonder if some of the confusion on the other thread about the final aggregate[1] was due to this difference. By rounding down, we get a "head start" (because the first aggregate is short), so we usually manage to record the expected number of aggregates before time runs out. It's a race though. Your non-rounding version was more likely to lose the race and finish before the final expected aggregate was logged, so you added code to force a final aggregate to be logged. Do I have this right? I'm not entirely sure how useful a partial final aggregate is (it's probably one you have to throw away, like the first one, no? Isn't it better if we only have to throw away the first one?). I'm not sure, but if we keep that change, a couple of very minor nits: I found the "tx" parameter name a little confusing. Do you think it's clearer if we change it to "final" (with inverted sense)? For the final aggregate, shouldn't we call doLog() only if agg->cnt > 0? I think I'd be inclined to take that change back out though, making this patch very small and net behaviour like pgbench 13, if you agree with my explanation for why you had to add it and why it's not actually necessary with the fixed rounding shown above. (And perhaps in v15 we might consider other ideas like using hi-res times in the log and not rounding, etc, a topic for later.) I don't really see the value in the test that checks that $delay falls in the range 1.5s - 2.5s and then ignores the result. If it hangs forever, we'll find out about it, and otherwise no human or machine will ever care about that test. I removed it from this version. Were you really attached to it? I made some very minor language tweaks in comments (we don't usually shorten "benchmark" to "bench" in English, "series" keeps the -s in singular (blame the Romans), etc). I think we should make it clear when we mean the *Unix* epoch (a comment "switch to epoch" isn't meaningful on its own, to me at least), so I changed that in a few places. [1] https://www.postgresql.org/message-id/alpine.DEB.2.22.394.2106102323310.3698412%40pseudo
Вложения
В списке pgsql-hackers по дате отправления: