Andres Freund <andres@anarazel.de> writes:
> On 2025-02-12 22:52:52 +0100, Jelte Fennema-Nio wrote:
>> + /*
>> + * Bump the soft limit to the hard limit to not run into low
>> + * file limits.
>> + */
>> + rlim.rlim_cur = rlim.rlim_max;
>> + if (setrlimit(RLIMIT_NOFILE, &rlim) == -1)
>> + pg_fatal("setrlimit failed: %m");
>> +
>> if (rlim.rlim_cur < nclients + 3)
> Why not do this only in the if (rlim.rlim_cur < nclients + 3) case?
+1, otherwise you're introducing a potential failure mode for nothing.
It'd take a couple extra lines to deal with the scenario where
rlim_max is still too small, but that seems fine.
> Other than this I think we should just apply this.
Agreed on the pgbench change. I don't have an opinion yet on the
server changes.
regards, tom lane