1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-13 01:00:23 +02:00

Add lock module initialization.

Each call to lockAcquireP() passed enough information to initialize the lock system. This was somewhat inefficient and as locks become more complicated it will lead to more code duplication. Since a process can only take one type of lock it makes sense to do most of the initialization up front.

Also reduce the log level of lockRelease() since it is only called at exit and the lock will be released in any case.
This commit is contained in:
David Steele
2023-03-25 14:07:31 +07:00
parent f1caecc4ff
commit 8ff956ad7e
20 changed files with 197 additions and 133 deletions

View File

@ -725,11 +725,8 @@ testRun(void)
{
HRN_FORK_CHILD_BEGIN()
{
TEST_RESULT_VOID(
lockAcquireP(
cfgOptionStr(cfgOptLockPath), cfgOptionStr(cfgOptStanza), STRDEF("999-dededede"), cfgLockType(),
.timeout = 30000, .returnOnNoLock = true),
"acquire lock");
lockInit(cfgOptionStr(cfgOptLockPath), STRDEF("999-dededede"), cfgOptionStr(cfgOptStanza), cfgLockType());
TEST_RESULT_VOID(lockAcquireP(.timeout = 30000, .returnOnNoLock = true), "acquire lock");
// Notify parent that lock has been acquired
HRN_FORK_CHILD_NOTIFY_PUT();